Ejemplo n.º 1
0
        void UIThread_LoginComplete(System.Net.HttpStatusCode code, string desc)
        {
            BlockerView.Hide(delegate
            {
                switch (code)
                {
                case System.Net.HttpStatusCode.OK:
                    {
                        // see if we should set their viewing campus
                        if (RockMobileUser.Instance.PrimaryFamily.CampusId.HasValue == true)
                        {
                            RockMobileUser.Instance.ViewingCampus = RockMobileUser.Instance.PrimaryFamily.CampusId.Value;
                        }

                        // if they have a profile picture, grab it.
                        RockMobileUser.Instance.TryDownloadProfilePicture(PrivateGeneralConfig.ProfileImageSize, ProfileImageComplete);

                        // hide the activity indicator, because we are now logged in,
                        // but leave the buttons all disabled.
                        //LoginActivityIndicator.Visibility = ViewStates.Gone;
                        BlockerView.Hide( );

                        // update the UI
                        FadeLoginResult(true);
                        LoginResultLabel.Text = string.Format(LoginStrings.Success, RockMobileUser.Instance.PreferredName( ));

                        // start the timer, which will notify the springboard we're logged in when it ticks.
                        LoginSuccessfulTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) =>
                        {
                            // when the timer fires, notify the springboard we're done.
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                SpringboardParent.ModalFragmentDone(null);
                            });
                        };

                        LoginSuccessfulTimer.Start( );
                        break;
                    }

                default:
                    {
                        // if we couldn't get their profile, that should still count as a failed login.
                        SetUIState(LoginState.Out);

                        FadeLoginResult(true);
                        LoginResultLabel.Text = LoginStrings.Error_Unknown;

                        RockMobileUser.Instance.LogoutAndUnbind( );
                        break;
                    }
                }
            });
        }
Ejemplo n.º 2
0
        void UIThread_LoginComplete(System.Net.HttpStatusCode code, string desc)
        {
            BlockerView.Hide(delegate
            {
                switch (code)
                {
                case System.Net.HttpStatusCode.OK:
                    {
                        // see if we should set their viewing campus
                        if (RockMobileUser.Instance.PrimaryFamily.CampusId.HasValue == true)
                        {
                            RockMobileUser.Instance.ViewingCampus = RockMobileUser.Instance.PrimaryFamily.CampusId.Value;
                        }

                        // if they have a profile picture, grab it.
                        RockMobileUser.Instance.TryDownloadProfilePicture(PrivateGeneralConfig.ProfileImageSize, ProfileImageComplete);

                        // update the UI
                        FadeLoginResult(true);
                        LoginResult.Field.Text = string.Format(LoginStrings.Success, RockMobileUser.Instance.PreferredName( ));

                        // start the timer, which will notify the springboard we're logged in when it ticks.
                        LoginSuccessfulTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) =>
                        {
                            // when the timer fires, notify the springboard we're done.
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                Springboard.ResignModelViewController(this, null);
                            });
                        };

                        LoginSuccessfulTimer.Start( );

                        break;
                    }

                default:
                    {
                        // if we couldn't get their profile, that should still count as a failed login.
                        SetUIState(LoginState.Out);

                        // failed to login for some reason
                        FadeLoginResult(true);
                        LoginResult.Field.Text = LoginStrings.Error_Unknown;

                        RockMobileUser.Instance.LogoutAndUnbind( );
                        break;
                    }
                }
            });
        }
        void UIThread_AuthorizationComplete(System.Net.HttpStatusCode code, string desc)
        {
            switch (code)
            {
            case System.Net.HttpStatusCode.OK:
            {
                // update the UI
                FadeLoginResult(true);
                LoginResult.Text = Strings.General_Welcome;
                LoginResult.SizeToFit( );

                // start the timer, which will notify the springboard we're logged in when it ticks.
                LoginSuccessfulTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) =>
                {
                    // when the timer fires, notify the springboard we're done.
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                        {
                            Parent.LoginComplete( );
                        });
                };

                LoginSuccessfulTimer.Start( );

                break;
            }

            default:
            {
                // if we couldn't get their profile, that should still count as a failed login.
                SetUIState(LoginState.Out);

                // failed to login for some reason
                FadeLoginResult(true);
                LoginResult.Text = Strings.General_Login_NotAuthorized;
                LoginResult.SizeToFit( );

                break;
            }
            }
        }