private void login_button_Click(object sender, EventArgs e) { { if (validate()) { checklogin login = new checklogin(); bool isSuccessful = login.CheckLoginCredential(username_txtbox.Text, password_txtbox.Text); if (isSuccessful) { alert.Text = ""; UserUtils.USERNAME = username_txtbox.Text; MessageBox.Show("Welcome to the system!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information); MainWindow newfrom = new MainWindow(); newfrom.Show(); this.Hide(); } else { alert.Text = "Wrong credentials"; } } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.m = ((Payroll.MainWindow)(target)); return; case 2: this.menu_btn_exit1 = ((System.Windows.Controls.MenuItem)(target)); return; case 3: this.Area = ((System.Windows.Controls.MenuItem)(target)); return; case 4: this.menu_btn_about = ((System.Windows.Controls.MenuItem)(target)); return; case 5: this.menu_btn_exit = ((System.Windows.Controls.MenuItem)(target)); return; case 6: this.login_Name = ((System.Windows.Controls.Label)(target)); return; case 7: this.btn_exit2 = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }