protected virtual void OnloginDone(LoginChanged e) { // Create a copy of the event to work with EventHandler<LoginChanged> eh = LoginDone; /* If there are no subscribers, eh will be null so we need to check * to avoid a NullReferenceException. */ if (eh != null) eh(this, e); }
private void frMain_LoginDone(object sender, LoginChanged e) { tileUserName.Text = e.UserName; tileCountryFlag.TileImage = (Image) Utils.GetImageByName(e.Country.ToString()); tileCountryFlag.Refresh(); metroTile6.Text = "Logout"; metroTile6.Refresh(); }
private void btnLogin_Click(object sender, EventArgs e) { bool flag = true; Messages oErrMsg = Messages.Instance; if (txtUserID.Text.Trim() == "") { MessageBox.Show("Enter User Name"); txtUserID.Focus(); flag=false; } if (txtPwd.Text.Trim() == "") { MessageBox.Show("Enter Password"); txtPwd.Focus(); flag = false; } if (cboCountry.Text.Trim() == "") { MessageBox.Show("Select Country"); cboCountry.Focus(); flag = false; } if (flag) { oErrMsg = Utils.ValidateLogin(txtUserID.Text, txtPwd.Text, cboCountry.SelectedValue.ToString()); if (oErrMsg.IsError) { MessageBox.Show(oErrMsg.Message); } else { LoginChanged oLoginChanged = new LoginChanged(); oLoginChanged.Country = cboCountry.SelectedValue.ToString(); oLoginChanged.UserName = txtUserID.Text; OnloginDone(oLoginChanged); this.DialogResult = DialogResult.OK; this.Close(); } } }
private void frMain_LoginDone(object sender, LoginChanged e) { _ParentForm.tileUserName.Text = e.UserName; _ParentForm.tileCountryFlag.TileImage = (Image)Utils.GetImageByName(e.Country.ToString()); _ParentForm.Refresh(); }