private async void Button_Clicked_1(object sender, EventArgs e)
        {
            //Změnit heslo
            if (!(String.IsNullOrWhiteSpace(oldPassword.Text)) && !(String.IsNullOrWhiteSpace(newPassword.Text)))
            {
                if (newPassword.Text == confirmPassword.Text)
                {
                    var  call     = new RestApi();
                    bool response = await call.ChangePassword(newPassword.Text, oldPassword.Text);

                    if (response)
                    {
                        var app = Application.Current as App;
                        await DisplayAlert("Upozornění", "Heslo změněno, budete ohlášen", "OK");

                        Application.Current.Properties.Clear();
                        app.MainPage = new Login();
                    }
                    else
                    {
                        await DisplayAlert("Upozornění", "Zadali jste nesprávné heslo", "OK");
                    }
                }
                else
                {
                    await DisplayAlert("Upozornění", "Zadaná hesla se neschodují", "OK");
                }
            }
            else
            {
                await DisplayAlert("Upozornění", "Vyplňte všechny pole", "OK");
            }
        }
Ejemplo n.º 2
0
 private async void Button_ClickedAsync(object sender, EventArgs e)
 {
     if (email.Text != null && password.Text != null)
     {
         activityIndicator.IsVisible = true;
         activityIndicator.IsRunning = true;
         try
         {
             var call = new RestApi();
             if (await call.Login(email.Text, password.Text))
             {
                 Application.Current.MainPage = new MenuPage();
             }
             else
             {
                 await DisplayAlert("Error", "Nesprávné jméno nebo heslo", "OK");
             }
         }
         catch
         {
             await DisplayAlert("Error", "Připojení selhalo", "OK");
         }
         activityIndicator.IsRunning = false;
         activityIndicator.IsVisible = false;
     }
     else
     {
         email.Focus();
     }
 }
        protected override async void OnAppearing()
        {
            var call = new RestApi();

            try {
                activityIndicator.IsRunning = true;
                detailListView.ItemsSource  = await call.GetOrderDetailsAsync(Order.Id);

                activityIndicator.IsRunning = false;
                activityIndicator.IsVisible = false;
            }
            catch
            {
                await DisplayAlert("Error", "Připojení k servru selhalo", "OK");

                Navigation.RemovePage(this);
            }


            base.OnAppearing();
        }