Пример #1
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (registration.LogIn())
     {
         Frame.Navigate(typeof(MenuBar));
     }
     else if (registration.LogInUser())
     {
         Frame.Navigate(typeof(HamburgerMenu));
     }
     else
     {
         var message = new MessageDialog("Your username or password is incorrect \nPlease Try again 😊 ",
                                         "Fail Login");
         message.ShowAsync();
     }
 }
Пример #2
0
        async void buttonSign_Clicked(System.Object sender, System.EventArgs e)
        {
            _loginIsCorrect = !string.IsNullOrEmpty(txtUser.Text) && !string.IsNullOrEmpty(txtPass.Text);
            if (_loginIsCorrect)
            {
                var result = await _registrationViewModel.LogIn();

                if (result)
                {
                    App.UserDatabase.AddUser(App.user);
                    App.SettingsDatabase.SaveSettingsAsync(App.settings);
                    App.isLoggined       = true;
                    App.Current.MainPage = new MainPage();
                }

                else
                {
                    userError.IsVisible = passwordError.IsVisible = true;
                }
            }
        }