Esempio n. 1
0
 public UIViewController GetAuthenticateUI()
 {
     return Twitter.GetAuthenticateUI (acc =>
     {
         _account = acc;
         IsAuthenticated = true;
         AccountStore.Create().Save(acc, "Twitter");
         OnAuthenricationComplete();
     });
 }
 public void AddNewAccount(Account actNewAccount)
 {
     m_aclAccounts.Add(actNewAccount);
     Save();
     actNewAccount.Connect();
 }
Esempio n. 3
0
        public void Reset(Action<bool> done)
        {
            Logout(delegate(bool didLogOut)
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains(kTwitterCredential))
                {
                    IsolatedStorageSettings.ApplicationSettings.Remove(kTwitterCredential);
                    IsolatedStorageSettings.ApplicationSettings.Save();
                }

                instance = new Account();

                done(didLogOut);
            });
        }
Esempio n. 4
0
        void RemoveTwitterAccount(Account account, string username)
        {
            lock (m_TwitterAccounts) {
                if (m_TwitterAccounts.ContainsKey(username)) {
                    var handler = m_TwitterAccounts[username];
                    if (handler.Accounts.Contains(account)) {
                        handler.Accounts.Remove(account);
                    }

                    if (handler.Accounts.Count == 0) {
                        handler.Dispose();
                        m_TwitterAccounts.Remove(username);

                        var shoutService = ServiceManager.Get<ShoutService>();
                        shoutService.RemoveHandler(handler);
                    }
                }
            }
        }
Esempio n. 5
0
 void HandleAccountRemoved(Account account)
 {
     string username = account.GetProperty("Twitter.Username");
     if (!String.IsNullOrEmpty(username)) {
         RemoveTwitterAccount(account, username);
     }
 }
Esempio n. 6
0
        void HandleAccountAdded(Account account)
        {
            if (!String.IsNullOrEmpty(account.GetProperty("Twitter.Username")) &&
                !String.IsNullOrEmpty(account.GetProperty("Twitter.Password")))
            {
                string username = account.GetProperty("Twitter.Username");
                string password = account.GetProperty("Twitter.Password");
                account.GetFeature<UserWebIdentities>().SetIdentity("twitter", username);

                AddTwitterAccount(account, username, password);
            }
        }
Esempio n. 7
0
        void AddTwitterAccount(Account account, string username, string password)
        {
            lock (m_TwitterAccounts) {
                if (!m_TwitterAccounts.ContainsKey(username)) {
                    var handler = new TwitterAccountHandler(username, password);
                    m_TwitterAccounts.Add(username, handler);

                    var shoutService = ServiceManager.Get<ShoutService>();
                    shoutService.AddHandler(handler);

                    handler.Accounts.Add(account);

                    Console.WriteLine("Added twitter account: " + username);
                } else if (m_TwitterAccounts[username].Accounts.Contains(account)) {
                    m_TwitterAccounts[username].Password = password;
                    m_TwitterAccounts[username].Accounts.Add(account);
                }
            }
        }
Esempio n. 8
0
 public void AccountConfigUpdated(Account account, string oldUsername, string newUsername, string newPassword)
 {
     lock (m_TwitterAccounts) {
         if (oldUsername != newUsername) {
             RemoveTwitterAccount(account, oldUsername);
         }
         if (!String.IsNullOrEmpty(newUsername) && !String.IsNullOrEmpty(newPassword)) {
             AddTwitterAccount(account, newUsername, newPassword);
         }
     }
 }
 private void m_aclAccounts_AccountAdded(object sender, Account actSubject)
 {
     actSubject.UserStream.Receive += new API.Streaming.UserStream.ReceiveHandler(Account_UserStream_Receive);
 }
Esempio n. 10
0
 private void m_aclAccounts_UserObjectReceived(object sender, Account actSubject)
 {
     AsyncContentManager.GetManager().RequestImage(actSubject.UserObject["profile_image_url"].ToString(), AccountGetAvatarCallback, actSubject);
 }