Ejemplo n.º 1
0
        private async void LoginButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (AccountAddress.Text != "" && AccountPassword.Password != "")
            {
                AccountAddress.IsEnabled  = false;
                AccountPassword.IsEnabled = false;
                LoginButton.IsEnabled     = false;

                string username = AccountAddress.Text;
                string password = AccountPassword.Password;

                if (await DropAccount.Login(username, password))
                {
                    DialogResult = true;
                }
                else
                {
                    AccountAddress.Clear();
                    AccountPassword.Clear();
                }

                AccountAddress.IsEnabled  = true;
                AccountPassword.IsEnabled = true;
                LoginButton.IsEnabled     = true;
            }
            else
            {
                MessageBox.Show("Заполните все поля!", "Внимание", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
Ejemplo n.º 2
0
        private async void CreateAccount_OnClick(object sender, RoutedEventArgs e)
        {
            CreateAccount.IsEnabled        = false;
            RegistrationPassword.IsEnabled = false;
            RegistrationUserName.IsEnabled = false;

            if (RegistrationUserName.Text != "" && RegistrationPassword.Password != "")
            {
                string username = RegistrationUserName.Text;
                string password = RegistrationPassword.Password;
                await Task.Run(() => DropAccount.Registration(username, password));
            }
            else
            {
                MessageBox.Show("Заполните все поля!", "Внимание", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }

            RegistrationUserName.Clear();
            RegistrationPassword.Clear();
            CreateAccount.IsEnabled        = true;
            RegistrationPassword.IsEnabled = true;
            RegistrationUserName.IsEnabled = true;
        }