Join 244,189 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,376 people online right now. Registration is fast and FREE... Join Now!
***UPDATE*** This program's coming along pretty quickly. I've set up a SourceForge at the following address: https://sourceforge.net/projects/x-twitter/ If you want do download it for testing or just to use, I recommend you get it from there, because it will be the latest version. Feedback is always welcome. Enjoy! ***UPDATE***
This is a subject that's interested me for quite a while: Posting data to a site. I've done a bit of this already, so far I've got:
A function to grab the most recent 20 updates from any user A function to post to your page A login screen
I'm hoping to add extra features in to this too, stuff that isn't actually featured on Twitter. Stuff like "Top 5 Tweeters."
If you've got any thoughts/suggestions, I'd be glad to take them into consideration.
Oh yeah, it's in C#.NET (surprise, surprise)
I'll post it up as soon as I get a (basic) working version.
Finally it's ready. Haven't made it parse the HTML in the tweets yet, but that's something to work on. For now, I'd love to get some feedback.
Here's some screenshots:
The main window:
The login form:
After logging in, please be patient~ I haven't put a loady thingy yet, so it looks like it isn't doing anything. In actual fact, it's connecting to your homepage and reading the 20 most recent tweets from you and your friends.
Here's the exe with source: Twitter.zip ( 119.04k )
Number of downloads: 13
I'd love to get feedback on this one, it's my first proper project for connecting to a web page behind the scenes.
And I've already done those things you said in the latest: -Automatically updates the FriendPanels every 60 seconds. -HTML has been removed in the tweets. -It puts the screen name in brackets next to the real name. -It says "logged in as" along with the username at the top.
3 downloads? Out of curiosity, is there anyone here who would actually use it?
Things to add: -Obviously it needs stabilising, it keeps crashing with this damn thread -A little popup in the bottom right corner of the screen, like when you get an update on MSN -Ability to add custom skins (it's only a background image anyway) .......-Also add the ability to change the appearance of friend panels -Make it possible to click the links in a tweet -Ability to close a panel (hide the tweet) by clicking a little 'x' -Clicking the user's name/image will open their profile -Add the time/"from" bit to the friend panels, to show when the updates were posted -Animation is a must for a slick GUI -Tweet filtering, only seeing tweets from certain users -Updating your profile (eg, changing the display picture) -And more that I can't think of right now
I'd love to get feedback on this one, it's my first proper project for connecting to a web page behind the scenes.
Well, you asked for it.
First,
csharp
} catch (Exception ex) {/* DO NOTHING */}
What could possibly go wrong? You should only ignore exceptions in very rare cases. At the very least, send something to the output window so you can tell something happened:
One class per file. Java enforces this in a draconian fashion where C# doesn't, but that doesn't mean you shouldn't follow the model. Avoid struts, that Tweet object could probably be doing more work for you.
This business of the login from the main form and self closing, ick.
csharp
public partial class MainForm : Form { void MainFormLoad(object sender, EventArgs e) { Login login = new Login(); login.ShowDialog(); if (login.login == false) this.Close(); else {
Putting it in the root is all together cleaner.
csharp
private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Login login = new Login(); login.ShowDialog(); if (login.login) { MainForm frm = new MainForm(); frm.SetLogin(login.username, login.password); frm.ShowDialog(); } }
Last, but not least, static is bad. It creates bad programming habits, grows hair on your palms, etc.
Now, a design hint. It looks like their pages are valid XHTML. Rather than playing string games, you might have an easier time with an XmlDocument and xpath.
Overall, well done. I'm rather surprised you've been working in the language for such a short time with no Java experience. Pity I have no interest in Twitter.
I'll take those tips into consideration in future~
I never even thought to put it in the root
I'll stick with the string games for now, I might update it in future to work as an XmlDocument.
Until then, here's the latest version: Twitter.zip ( 157.26k )
Number of downloads: 6
New features include automatic updates of the FriendPanels, and an MSN-style update in the bottom right corner of the screen. (I might have to move it up a bit, I forgot)
Overall, well done. I'm rather surprised you've been working in the language for such a short time with no Java experience. Pity I have no interest in Twitter.
Hell, I've got more Java experience than he's got C# experience (in terms of time), but I have a college life to attend to...and a C++ class, so I don't have a lot of time to play around and learn as quick as he does in languages that I like...such as Java. I wouldn't know the first thing about connecting to a web page...He's certainly got more experience in C# than I do in Java (in terms of skill).
By the way...C++ is far too complicated for it's own good...
This post has been edited by Locke37: 1 Oct, 2008 - 07:28 PM
I'm currently working on adding an intellisense-like feature to the text box. Basically, if you type '@' it will list all the people you're following in a listbox from where the caret is (Like intellisense, basically)
Just some code I compulsively wrote while looking at yours. As a user, and a tester, I'd still like to see some feedback when things go south.
From a design standpoint, I hate having gui and logic all clumped up together. I don't like that the form is the keeper of the current username and password. This is actually where having a real object, as opposed to all that static crap, is useful.
The idea is to have one object that keeps the current user's login info. That object is then responsable for all your calls to the datasource, in this case a website.
I used the "users show" twitter page for validation, which may be a little quicker. This probably isn't perfect, I wrote it this morning and have to stop now. I thought about keeping it to myself, but there's a chance you might find something useful and it wouldn't be fair not to share:
csharp
using System; using System.Web; using System.Net; using System.IO; using System.Diagnostics; using System.Xml;
namespace TweetTest { public class TwitterUserInfo { private string id, name, screenName, location, description, profileImageUrl;
public string Id { get { return this.id; } } public string Name { get { return this.name; } } public string ScreenName { get { return this.screenName; } } public string Location { get { return this.location; } } public string Description { get { return this.description; } } public string ProfileImageUrl { get { return this.profileImageUrl; } }