Ejemplo n.º 1
0
 private void authButton_Clicked(object sender, EventArgs e)
 {
     if (!_service.CheckAuthenticate(
             async() =>
     {
         await DisplayAlert("認証結果", "認証に成功しました", "OK");
         await Navigation.PushAsync(new UploadPage());
     },
             async() =>
     {
         await DisplayAlert("認証結果", "認証に失敗しました", "OK");
         await Navigation.PopAsync();
     }))
     {
         Navigation.PushAsync(new AuthPage());
     }
 }
Ejemplo n.º 2
0
        private async void B_SingInOnedrive_Click(object sender, RoutedEventArgs e)
        {
            ShowBusy(true);

            if (B_SingInOnedrive.Content.ToString() == traduce("EntrarOnedrive"))
            {
                if (!_service.CheckAuthenticate(
                        () =>
                {
                    //var dialog = new MessageDialog("You are authenticated!", "Success!");
                    //await dialog.ShowAsync();
                    T_Info.Text = traduce("InfoAutenticado");;
                    ShowBusy(false);

                    if (Frame.SourcePageType.Name == "AuthenticationPage")
                    {
                        Frame.GoBack();
                    }
                },
                        async() =>
                {
                    T_Info.Text = traduce("ErrorAutenticacion");
                    var dialog = new MessageDialog(traduce("ProblemaAutenticacion"), traduce("NameApp"));
                    await dialog.ShowAsync();
                    ShowBusy(false);
                    Frame.GoBack();
                }))
                {
                    Frame.Navigate(typeof(AuthenticationPage));
                }
            }
            else
            {
                //Log Out
                Exception error = null;
                ShowBusy(true);

                try
                {
                    await _service.Logout();
                }
                catch (Exception ex)
                {
                    error = ex;
                }

                if (error != null)
                {
                    var dialog = new MessageDialog(traduce("MsgErrorGeneral") + " " + error.Message, traduce("NameApp"));
                    await dialog.ShowAsync();

                    ShowBusy(false);
                    return;
                }


                T_Info.Text = traduce("MsgSalidaOneDrive");
                //var successDialog = new MessageDialog("You are now logged off", "Success");
                //await successDialog.ShowAsync();
                B_SingInOnedrive.Content = traduce("EntrarOnedrive");
                ShowBusy(false);
            }
        }