Пример #1
0
        private void Login(object sender, RoutedEventArgs e)
        {
            string       username = this.mwUsernameField?.Text;
            SecureString password = this.mwPasswordBox?.SecurePassword;

            bool[] login       = GiftManager.Login(username, password);
            bool   isLoggedIn  = login[0];
            bool   isAdminUser = login[1];

            if (isLoggedIn)
            {
                if (isAdminUser)
                {
                    var dashboard = new AdminDashboard {
                        CurrentUsername = username
                    };
                    dashboard.Show();
                    this.Close();
                }
                else
                {
                    var dashboard = new Dashboard {
                        CurrentUsername = username
                    };
                    dashboard.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Username or password was not correct", "Login Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }