Permalink
Browse files

No commit message

  • Loading branch information...
digitallyborn
digitallyborn committed Mar 9, 2010
1 parent 0e3abf5 commit a547a6e6dcf555940bb3ea3764ac79eb382a50d9
View
@@ -8,6 +8,7 @@
<Word>Retweet</Word>
<Word>Retweeted</Word>
<Word>Retweets</Word>
+ <Word>Username</Word>
</Recognized>
</Words>
</Dictionary>
@@ -55,7 +55,7 @@ public partial class Authenticate : Form
/// </summary>
public Authenticate()
{
- InitializeComponent();
+ this.InitializeComponent();
}
/// <summary>
@@ -100,7 +100,7 @@ private void PinButton_Click(object sender, EventArgs e)
ConfigurationManager.AppSettings["Twitterizer.Desktop.ConsumerKey"],
ConfigurationManager.AppSettings["Twitterizer.Desktop.ConsumerSecret"],
this.requestToken,
- PinTextBox.Text);
+ this.PinTextBox.Text);
Configuration appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
appConfig.AppSettings.Settings.Add("Twitterizer.Desktop.AccessToken", accessTokens.Token);
@@ -109,7 +109,7 @@ private void PinButton_Click(object sender, EventArgs e)
appConfig.AppSettings.Settings.Add("Twitterizer.Desktop.ScreenName", accessTokens.ScreenName);
appConfig.Save();
- ConfigurationManager.RefreshSection("AppSettings");
+ ConfigurationManager.RefreshSection("appSettings");
MessageBox.Show(
string.Format("Thanks for authenticating, {0}.", accessTokens.ScreenName));
@@ -58,7 +58,7 @@ public partial class MainForm : Form
/// </summary>
public MainForm()
{
- InitializeComponent();
+ this.InitializeComponent();
}
/// <summary>
@@ -84,7 +84,7 @@ private void MainForm_Load(object sender, EventArgs e)
foreach (TwitterStatus status in TwitterStatus.GetHomeTimeline(this.oauthTokens))
{
- HomeTimelinePanel.Controls.Add(new TweetTimelineControl(status));
+ this.HomeTimelinePanel.Controls.Add(new TweetTimelineControl(status));
}
}
@@ -54,7 +54,7 @@ public TweetTimelineControl(TwitterStatus status)
throw new ArgumentNullException("status");
}
- InitializeComponent();
+ this.InitializeComponent();
this.userPictureBox.LoadAsync(status.User.ProfileImageLocation);
this.UserNameLabel.Text = status.User.ScreenName;
@@ -0,0 +1,102 @@
+//-----------------------------------------------------------------------
+// <copyright file="DeleteFriendshipCommand.cs" company="Patrick 'Ricky' Smith">
+// This file is part of the Twitterizer library (http://code.google.com/p/twitterizer/)
+//
+// Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+// - Neither the name of the Twitterizer nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// </copyright>
+// <author>Ricky Smith</author>
+// <summary>The delete friendship command class</summary>
+//-----------------------------------------------------------------------
+
+namespace Twitterizer.Commands
+{
+ using System;
+ using System.Globalization;
+ using Twitterizer.Core;
+
+ /// <summary>
+ /// The delete friendship command class.
+ /// </summary>
+ internal sealed class DeleteFriendshipCommand : BaseCommand<TwitterUser>
+ {
+ /// <summary>
+ /// The base address to the API method.
+ /// </summary>
+ private const string Path = "http://api.twitter.com/1/friendships/destroy.json";
+
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DeleteFriendshipCommand"/> class.
+ /// </summary>
+ /// <param name="requestTokens">The request tokens.</param>
+ public DeleteFriendshipCommand(OAuthTokens requestTokens)
+ : base("POST", new Uri(Path), requestTokens)
+ {
+ if (requestTokens == null)
+ {
+ throw new ArgumentNullException("requestTokens");
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Gets or sets the user id.
+ /// </summary>
+ /// <value>The user id.</value>
+ public long UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the username.
+ /// </summary>
+ /// <value>The username.</value>
+ public string Username { get; set; }
+
+ /// <summary>
+ /// Initializes the command.
+ /// </summary>
+ public override void Init()
+ {
+ if (this.UserId > 0)
+ {
+ this.RequestParameters.Add("user_id", this.UserId.ToString(CultureInfo.InvariantCulture));
+ }
+
+ if (this.UserId <= 0 && !string.IsNullOrEmpty(this.Username))
+ {
+ this.RequestParameters.Add("screen_name", this.Username);
+ }
+ }
+
+ /// <summary>
+ /// Validates this instance.
+ /// </summary>
+ public override void Validate()
+ {
+ this.IsValid = this.UserId > 0 || !string.IsNullOrEmpty(this.Username);
+ }
+ }
+}
@@ -0,0 +1,136 @@
+//-----------------------------------------------------------------------
+// <copyright file="ShowFriendshipCommand.cs" company="Patrick 'Ricky' Smith">
+// This file is part of the Twitterizer library (http://code.google.com/p/twitterizer/)
+//
+// Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+// - Neither the name of the Twitterizer nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// </copyright>
+// <author>Ricky Smith</author>
+// <summary>The show friendship command class.</summary>
+//-----------------------------------------------------------------------
+
+namespace Twitterizer.Commands
+{
+ using System;
+ using System.Globalization;
+ using Twitterizer.Core;
+
+ /// <summary>
+ /// The show friendship command class.
+ /// </summary>
+ internal sealed class ShowFriendshipCommand : BaseCommand<TwitterRelationship>
+ {
+ /// <summary>
+ /// The base address to the API method.
+ /// </summary>
+ private const string Path = "http://api.twitter.com/1/friendships/show.json";
+
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ShowFriendshipCommand"/> class.
+ /// </summary>
+ /// <param name="requestTokens">The request tokens.</param>
+ public ShowFriendshipCommand(OAuthTokens requestTokens)
+ : base("GET", new Uri(Path), requestTokens)
+ {
+ }
+ #endregion
+
+ #region API Parameters
+ /// <summary>
+ /// Gets or sets the id of the source user.
+ /// </summary>
+ /// <value>The source id.</value>
+ public long SourceId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the screenname of the source user.
+ /// </summary>
+ /// <value>The screenname of the source user.</value>
+ public string SourceScreenName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id of the target user.
+ /// </summary>
+ /// <value>The target id.</value>
+ public long TargetId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the screenname of the target user.
+ /// </summary>
+ /// <value>The screenname of the target user.</value>
+ public string TargetScreenName { get; set; }
+ #endregion
+
+ /// <summary>
+ /// Initializes the command.
+ /// </summary>
+ public override void Init()
+ {
+ if (this.SourceId > 0)
+ {
+ this.RequestParameters.Add("source_id", this.SourceId.ToString(CultureInfo.InvariantCulture));
+ }
+
+ // Only add the screen name if the id is not given.
+ if (!string.IsNullOrEmpty(this.SourceScreenName) && this.SourceId <= 0)
+ {
+ this.RequestParameters.Add("source_screen_name", this.SourceScreenName);
+ }
+
+ if (this.TargetId > 0)
+ {
+ this.RequestParameters.Add("target_id", this.TargetId.ToString(CultureInfo.InvariantCulture));
+ }
+
+ // Only add the screen name if the id is not given.
+ if (!string.IsNullOrEmpty(this.TargetScreenName) && this.TargetId <= 0)
+ {
+ this.RequestParameters.Add("target_screen_name", this.TargetScreenName);
+ }
+ }
+
+ /// <summary>
+ /// Validates this instance.
+ /// </summary>
+ public override void Validate()
+ {
+ // If the request is unauthorized
+ if (this.Tokens == null)
+ {
+ // Source information is required
+ if (this.SourceId <= 0 && string.IsNullOrEmpty(this.SourceScreenName))
+ {
+ this.IsValid = false;
+ return;
+ }
+ }
+
+ // Target information is always required (one of the variables)
+ this.IsValid = this.TargetId > 0 || !string.IsNullOrEmpty(this.TargetScreenName);
+ }
+ }
+}
@@ -0,0 +1,81 @@
+//-----------------------------------------------------------------------
+// <copyright file="TwitterRelationship.cs" company="Patrick 'Ricky' Smith">
+// This file is part of the Twitterizer library (http://code.google.com/p/twitterizer/)
+//
+// Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+// - Neither the name of the Twitterizer nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// </copyright>
+// <author>Ricky Smith</author>
+// <summary>The twitter relationship entity class</summary>
+//-----------------------------------------------------------------------
+
+namespace Twitterizer
+{
+ using System.Diagnostics;
+ using System.Runtime.Serialization;
+ using Twitterizer.Core;
+
+ /// <summary>
+ /// The Twitter Relationship entity class
+ /// </summary>
+ [DataContract]
+ [DebuggerDisplay("TwitterRelationship = {ScreenName}")]
+ public class TwitterRelationship : BaseObject
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TwitterRelationship"/> class.
+ /// </summary>
+ internal TwitterRelationship() : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TwitterRelationship"/> class.
+ /// </summary>
+ /// <param name="tokens">OAuth access tokens.</param>
+ public TwitterRelationship(OAuthTokens tokens)
+ : base()
+ {
+ this.Tokens = tokens;
+ }
+ #endregion
+
+ /// <summary>
+ /// Gets or sets the source.
+ /// </summary>
+ /// <value>The source.</value>
+ [DataMember(Name = "source")]
+ public TwitterUser Source { get; set; }
+
+ /// <summary>
+ /// Gets or sets the target.
+ /// </summary>
+ /// <value>The target.</value>
+ [DataMember(Name = "target")]
+ public TwitterUser Target { get; set; }
+ }
+}
Oops, something went wrong.

0 comments on commit a547a6e

Please sign in to comment.