<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eclipsed4utoo&#039;s Blog&#187; Desktop</title>
	<atom:link href="http://eclipsed4utoo.com/blog/tag/desktop/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsed4utoo.com/blog</link>
	<description>Not Your Ordinary Programmer</description>
	<lastBuildDate>Thu, 26 Aug 2010 12:45:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C# &#8211; Twitter API For Desktop</title>
		<link>http://eclipsed4utoo.com/blog/twitter-api-desktop/</link>
		<comments>http://eclipsed4utoo.com/blog/twitter-api-desktop/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 14:16:58 +0000</pubDate>
		<dc:creator>Ryan Alford</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://eclipsed4utoo.com/blog/?p=259</guid>
		<description><![CDATA[I made a post almost 3 months ago about a .Net Twitter API that I had done.  Since then, I have made some modifications to the API.  I have added a couple of more features.  I also included various classes from the System.Web namespace so that I wouldn&#8217;t need a reference to that namespace.  This [...]]]></description>
			<content:encoded><![CDATA[<p>I made a post almost 3 months ago about a .Net Twitter API that I had done.  Since then, I have made some modifications to the API.  I have added a couple of more features.  I also included various classes from the System.Web namespace so that I wouldn&#8217;t need a reference to that namespace.  This allows the API to be used on a mobile device with a very small footprint(the System.Web.dll file is 5MB in size, my .dll is 52KB).</p>
<p>I am missing a few features from my API.  Most notably the new &#8220;Retweet&#8221; functionality and the &#8220;Lists&#8221; functionality.  I am also missing some of the account methods.  Other than that, I believe I have most, if not all, of the other methods.</p>
<p>This API supports both Basic Auth and OAuth.  I would advise to use OAuth, since Twitter will be depreciating Basic Auth in <a href="http://www.techcrunch.com/2009/12/09/twitter-le-web-2009/">June 2010</a>.  To learn more about how OAuth works, check out my <a href="http://eclipsed4utoo.com/blog/net-twitter-desktop-oauth-authentication/">other blog post</a> where I try to explain OAuth.</p>
<p>Remember that this API is for the Desktop OAuth only.  Feel free to download it and make changes to allow OAuth from a web application(yes, they are different &#8220;workflows&#8221;).   Basic Auth should work for both Desktop and Web applications.</p>
<p>I give credit to <a href="http://www.voiceoftech.com/swhitley/?p=681">Shannon Whitley for his original OAuth code</a>.  I made some modifications to it, but the base code of the OAuth is his.</p>
<p>Here is a code snippet on using the API for OAuth authorization.</p>
<pre class="brush: csharp;">
// creats instance and sets Consumer and ConsumerSecret values
TwitEclipseAPI twit = new TwitEclipseAPI();
twit.OAuthConsumerKey = &quot;yourConsumerKey&quot;;
twit.OAuthConsumerSecret = &quot;yourConsumerSecret&quot;;

// makes request to get unauthorized request token
// The method will concatenate the request token to Twitter's Desktop OAuth
//    url (http://twitter.com/oauth/authorize)
string url = twit.OAuthGetUnauthorizedRequestToken();

// opens the user's default browser and browses to Twitter's OAuth page
Process.Start(url);

//  You will need to get the PIN from the user
//  I just created a popup and have the user enter the PIN
//       into a textbox in the popup
frmPinPopup popup = new frmPinPopup();
popup.ShowDialog();

string PIN = popup.PIN;
popup.Dispose();

// Gets the Token and TokenSecret that will be needed for all
//   subsequent requests.  You will need to save these values to keep
//   from forcing the user to authorize your application everytime they
//   open your application.
twit.OAuthRequestAccessToken(PIN);

// You can check for success by checking the OAuthAccessToken
//    and OAuthAccessTokenSecret values.  If they are populated, then
//    it was successful.  If they are empty, then it failed.
if (!string.IsNullOrEmpty(twit.OAuthAccessToken) &amp;&amp; !string.IsNullOrEmpty(twit.OAuthAccessTokenSecret))
{
    MessageBox.Show(&quot;Authorization Successful&quot;);
}
</pre>
<p>Each method of the API will check the OAuthAccessToken and OAuthAccessTokenSecret values to determine whether it needs to do the request using OAuth or Basic Auth.</p>
<p>I have put the code on <a href="http://twiteclipseapi.codeplex.com/" target="_blank">CodePlex</a>.  It will contain both the .dll file, and the source code.  I felt it was easier to keep up with using CodePlex.</p>
<p>If you have code questions, you can post here.  However, if you are on Google Wave, <a href="https://wave.google.com/wave/#restored:search:twiteclipseapi,restored:wave:googlewave.com!w%252BtKPwoLd7A.5">you can go here</a>.  If you would like Google Wave, I have about 20 invitations that I can send out.  Using Google Wave would be much better since we could exchange code using a code snippet tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsed4utoo.com/blog/twitter-api-desktop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
