Tutorial level: Beginner.
I did not see a simple example of using Twitterizer2 in a desktop app. For example, the Twitterizer app notes that desktop apps are not supported not being actively maintained, and in the forums Ricky notes “I am not maintaining a desktop example.” so I figured it might be useful to post one.
My guess is that there are not many times you would need a desktop app, so that makes sense. However, my project reads serial input from an Arduino and posts that, so a desktop app seemed appropriate. I just want something running in the background. If it tweets, great, but my application did not require connectivity. Putting in a dependency on being connected by hosting the app online did not seem appropriate.
Here are absolute basics of connecting using Twitterizer2 and oAuth from the desktop. I’m using the free version of MS Visual Studio 2010 and used Twitterizer2 2.3.1.
High Level View: Here are the essential steps.
- Prerequisites – download etc.
- Create a windows forms app.
- Add a button to login with.
- Create a token (you can’t tweet with it tho’).
- Get permission from Twitter for the app using a second form for the pin.
- Create a second token using the pin (this one works to tweet).
- Add a text box or two. I used 2, one to output status and a second one for the user to enter what he wants to tweet.
- Add a button to tweet.
Read the rest of this entry »