示例#1
0
        private void SignInButton_Click(object sender, RoutedEventArgs e)
        {
            bool isAccountFound = Database.IsUserFound(EmailSignInTextBox.Text, PasswordSignInTextBox.Password);

            if (isAccountFound == true)
            {
                if (Database.AccountType == "User")
                {
                    // Open User Main Window
                    UserWindow UserWindowTemp = new UserWindow(Database.AccountID);
                    UserWindowTemp.Show();
                }
                else
                {
                    // Open Admin Main Window
                    AdminWindow AdminWindowTemp = new AdminWindow(Database.AccountID);
                    AdminWindowTemp.Show();
                }

                // Close Signing Window
                Close();
            }
            else
            {
                // Display error when the user is not found
                ErrorsSnackbar.MessageQueue.Enqueue("Incorrect Email Or Password");
            }
        }
示例#2
0
        public AdminWindow(int signedInAdminID)
        {
            InitializeComponent();
            AdminWindowObject = this;

            signedInAdmin = new AdminModel(signedInAdminID);

            // Initialize DataContext with signedInAdmin Model
            DataContext = signedInAdmin;

            ControlUpdateNewAdminPasswordGrid(signedInAdmin.ID);

            // Initialize AdminWindowPages Objects

            AdminHomePageObject       = new AdminHomePage();
            ChallengesSetupPageObject = new ChallengesSetupPage();
            AdminSettingsPageObject   = new AdminSettingsPage();

            // Initialize Listbox Selected Index
            AdminWindowPagesListBox.SelectedIndex = 0;

            // Intialize MessagesQueue and Assign it to MessagesSnackbar's MessageQueue
            var MessagesQueue = new SnackbarMessageQueue(System.TimeSpan.FromMilliseconds(2000));

            MessagesSnackbar.MessageQueue = MessagesQueue;
        }