示例#1
0
        public void OnOAuthLoginCompleted(LoginTwitterPanel loginTwitter)
        {
            if (loginTwitter.LoginSuccessful)
            {
                MainWindow.Instance.ShowLoadingPanel();

                SocialLoginCompleteLabel.Text = String.Format(
                    SocialLoginCompleteLabel.Text,
                    "Twitter",
                    "Facebook"
                    );

                TwitterLoginButton.Hide();
                SocialLinkWorker.RunWorkerAsync(loginTwitter.TwitterApi);
            }
            else
            {
                SocialLoginErrorLabel.Show();
            }
        }
示例#2
0
        private void SocialLinkWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (FacebookLoginButton.Visible || TwitterLoginButton.Visible)
                {
                    SocialLoginCompleteLabel.Show();

                    MainWindow.Instance.RemoveFromHistory <LoginTwitterPanel>();
                    MainWindow.Instance.RemoveFromHistory <LoginFacebookPanel>();
                    MainWindow.Instance.HideLoadingPanel();
                }
                else
                {
                    MainWindow.Instance.NextPanel <ProfilePanel>();
                }
            }
            else
            {
                if (e.Error is KMSWrongUserCredentials)
                {
                    SocialLoginErrorLabel.Show();

                    if (e.Result is FacebookClient)
                    {
                        FacebookLoginButton.Show();
                    }
                    else
                    {
                        TwitterLoginButton.Show();
                    }
                }
                else
                {
                    throw e.Error;
                }
            }
        }