Ejemplo n.º 1
0
        private async void BtnSignIn_Click(object sender, EventArgs e)
        {
            ((Button)sender).Enabled = false;
            signInSpinner.Visibility = ViewStates.Visible;

            var result = await AuthenticateDialog.ShowAsync(this, MsaAuthPurpose.App);

            if (result == MsaAuthResult.Success)
            {
                layouts.Add(Resource.Layout.Intro6);
                UpdateViewPagerLayout();

                GoToNextPage();
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle(result.ToString() + "\n" + "Please try again later.");
                alert.SetPositiveButton("OK", (senderAlert, args) => { });
                RunOnUiThread(() => {
                    alert.Show();
                });

                MSAAuthenticator.DeleteUserUniqueId();
                ((Button)sender).Enabled = true;
            }
            signInSpinner.Visibility = ViewStates.Gone;
        }
Ejemplo n.º 2
0
        private async void LogOutDialogClickListener(object sender, DialogClickEventArgs e)
        {
            if (await ServiceFunctions.RemoveDevice(this) == false)
            {
                Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                alert.SetTitle("Failed to log out.\nPlease make sure you have a working internet connection. If the problem persists, contact us.");
                alert.SetPositiveButton("OK", (IDialogInterfaceOnClickListener)null);
                RunOnUiThread(() =>
                {
                    alert.Show();
                });

                return;
            }

            MSAAuthenticator.DeleteUserUniqueId();

            OSHelper.ClearAppDataAndExit();
            FinishAffinity();
        }