private void btnLogin_Click(object sender, RoutedEventArgs e) { if (checkUserInput() && counter == 0 && gameOverCounter < 2) { // TODO: The user will land on a different page depending on the user's permissions. // MessageBox.Show("Login is successful", "Success", MessageBoxButton.OKCancel, MessageBoxImage.Asterisk); // navigate to MainWindow MainWindow mw = new MainWindow(); //we can send more than 1 parameters here. // show Main form object, and hide the login form view mw.Show(); this.Hide(); } else if (counter == 3 && gameOverCounter < 2) { //messagebox appears MessageBoxResult result = MessageBox.Show("Login was not successful.", "Failed", MessageBoxButton.OKCancel, MessageBoxImage.Stop); counter = 0; gameOverCounter++; //if user clicks cancel if (result == MessageBoxResult.Cancel) { Application.Current.Shutdown(); } else //if user clicks ok { clearFields(); } } else if(gameOverCounter == 2) { // Lock the account and close the application //messagebox appears MessageBoxResult result = MessageBox.Show("Login was not successful. The account with username " + txtUserName.Text + ", as been locked. Please contact your administrator for more information.", "Failed", MessageBoxButton.OK, MessageBoxImage.Stop); counter = 0; gameOverCounter = 0; // TODO: username lock Application.Current.Shutdown(); } }
public MainTab(MainWindow mainWindow) { InitializeComponent(); this.mainWindow = mainWindow; locationTextBlock.Text = this.Title; }
public ProfileTab(MainWindow mainWindow) { InitializeComponent(); this.mainWindow = mainWindow; #region // User settings for resize var userPrefs = new UserPreferences(); this.Height = userPrefs.WindowHeight; this.Width = userPrefs.WindowWidth; this.Top = userPrefs.WindowTop; this.Left = userPrefs.WindowLeft; this.WindowState = userPrefs.WindowState; #endregion populateLanguages(); this.SubtitleLanguage.ItemsSource = myList; //this.SubtitleLanguage.SelectedIndex = 80; this.language.ItemsSource = myList; //this.language.SelectedIndex = 80; // initialize data tree tree.Add(tmBasic); tree.Add(tmSec); tree.Add(tmS); dataTree.ItemsSource = tree; //initialize audio tree aTBasic.Mode = "Other"; audioT.Add(aTBasic); AC3Basic.Mode = "AC3"; audioT.Add(AC3Basic); }