protected override void Execute_TwitterDefinition(TwitterCommandContext context) { var interpreter = context.Interpreter; var users = context.TwitterUsers; string username = context.ReadParameter("Username").Value; string password = context.ReadParameter("Password").Value; foreach (string otherUsername in users.Keys) { if (otherUsername.Equals(username)) { throw new RoomieRuntimeException("User " + username + " already signed in."); } } try { var newUser = new Twitterizer.Framework.Twitter(username, password); users.Add(username, newUser); } catch (Twitterizer.Framework.TwitterizerException e) { throw new RoomieRuntimeException("Failed to sign in. Recieved the following error: " + e.Message); } }
public static void TwitterUpdateStatusStep( IContact contact, String UserName, String Password, String Message) { // TODO: Complete business rule implementation try { Twitterizer.Framework.Twitter t = new Twitterizer.Framework.Twitter(UserName, Password); t.Status.Update(Message); } catch (Exception ex) { } }
public static void TwitterDirectMessageStep( IContact contact, String UserName, String Password, String Message, String TwitterId) { // TODO: Complete business rule implementation try { Twitterizer.Framework.Twitter t = new Twitterizer.Framework.Twitter(UserName, Password); t.DirectMessages.New(TwitterId, Message); } catch (Exception ex) { } }
protected override void Execute_Definition(RoomieCommandContext context) { var greaterContext = new TwitterCommandContext(context); var users = greaterContext.TwitterUsers; string username = context.ReadParameter("Username").Value; if (!users.ContainsKey(username) && this.Name != "SignIn") //TODO: decouple this { throw new RoomieRuntimeException("Twitter user @" + username + " is not signed in."); } Twitterizer.Framework.Twitter user = null; if (users.ContainsKey(username)) { user = users[username]; } Execute_TwitterDefinition(greaterContext); }
public static void TwitterUserTweetsStep(IContact contact, out object result) { // TODO: Complete business rule implementation Sage.Platform.Application.Services.IUserOptionsService userOption = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.Services.IUserOptionsService>(); string userName = userOption.GetCommonOption("UserName", "Twitter"); string passWord = userOption.GetCommonOption("Password", "Twitter"); Twitterizer.Framework.Twitter t = new Twitterizer.Framework.Twitter(userName, passWord); if(t != null & !String.IsNullOrEmpty(contact.TwitterId)) { Twitterizer.Framework.TwitterParameters tp = new Twitterizer.Framework.TwitterParameters(); tp.Add(Twitterizer.Framework.TwitterParameterNames.ID, contact.TwitterId); Twitterizer.Framework.TwitterStatusCollection tsc = t.Status.UserTimeline(tp); result = tsc; } else { result = null; } }
protected override void Execute_TwitterDefinition(TwitterCommandContext context) { var interpreter = context.Interpreter; var users = context.TwitterUsers; string username = context.ReadParameter("Username").Value; string password = context.ReadParameter("Password").Value; foreach (string otherUsername in users.Keys) { if (otherUsername.Equals(username)) throw new RoomieRuntimeException("User " + username + " already signed in."); } try { var newUser = new Twitterizer.Framework.Twitter(username, password); users.Add(username, newUser); } catch (Twitterizer.Framework.TwitterizerException e) { throw new RoomieRuntimeException("Failed to sign in. Recieved the following error: " + e.Message); } }