Esempio n. 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");
            }
        }
Esempio n. 2
0
        public UserWindow(int signedInUserID)
        {
            InitializeComponent();
            UserWindowObject = this;

            // Initialize User Model
            signedInUser = new UserModel(signedInUserID);

            // Initialize DataContext with signedInUser Model
            DataContext = signedInUser;

            // Initialize UserWindowPages Objects
            HomePageObject               = new HomePage();
            ChallengesPageObject         = new ChallengesPage();
            PlansPageObject              = new PlansPage();
            CaloriesCalculatorPageObject = new CaloriesCalculatorPage();
            SettingsPageObject           = new SettingsPage();

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

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

            MessagesSnackbar.MessageQueue = MessagesQueue;
        }