private void button2_Click_1(object sender, EventArgs e) { this.button2.Hide(); this.button3.Hide(); this.label2.Show(); DoLogin dl = new DoLogin(login); IAsyncResult IR = dl.BeginInvoke(new AsyncCallback(asyncCallback), null); manu.WaitOne(); if (!flag) { MessageBox.Show("数据库未连接成功,请检查配置"); ExitFlag = true; } this.Close(); this.Dispose(); }
public override void Bind() { base.Bind(); this.InitGame = new Signal <InitGameCommand>(this); this.DoLogin = new Signal <DoLoginCommand>(this); this.DoLogout = new Signal <DoLogoutCommand>(this); this.DoEnterRoom = new Signal <DoEnterRoomCommand>(this); this.DoQuitRoom = new Signal <DoQuitRoomCommand>(this); this.DoDisconnect = new Signal <DoDisconnectCommand>(this); _CanvasRootProperty = new P <CanvasRootViewModel>(this, "CanvasRoot"); _UIFlowStatusProperty = new UIFlowSM(this, "UIFlowStatus"); DoLogin.Subscribe(_ => UIFlowStatusProperty.Login.OnNext(true)); DoLogout.Subscribe(_ => UIFlowStatusProperty.Logout.OnNext(true)); DoEnterRoom.Subscribe(_ => UIFlowStatusProperty.EnterRoom.OnNext(true)); DoQuitRoom.Subscribe(_ => UIFlowStatusProperty.QuitRoom.OnNext(true)); DoDisconnect.Subscribe(_ => UIFlowStatusProperty.Disconnect.OnNext(true)); }
/// <summary> /// Raises the OpenNewBookingRooms event /// </summary> protected void OnLogin(LoginEventArgs args) { DoLogin?.Invoke(this, args); }
public void Handle(DoLogin message) => Login();
private async void btn_Login_Click(object sender, EventArgs e) { try { Core.Helper.CampsController controller = new Core.Helper.CampsController(); bool response = controller.Login(txtUsr, txtPsw); if (response) { return; } DoLogin login = new DoLogin(); DoPermissions DoPermissions = new DoPermissions(); try { loginStatus = await login.PasswordCheck(txtUsr.Text, txtPsw.Text, StdConfig.MYSQLCONNECTION); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (loginStatus == Config.Cfg.LoginStatus.LoggedIn) { btn_Login.Enabled = false; txtUsr.Enabled = false; txtPsw.Enabled = false; btn_Login.Text = "Logged"; System.Windows.Forms.MessageBox.Show("Account " + txtUsr.Text + " successfully logged in!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); //Check User Permissions try { permissions = await DoPermissions.PermissionsCheck(txtUsr.Text, StdConfig.MYSQLCONNECTION); this.Text = "CloudNoty - ID: " + Config.Cfg.UID.ToString() + " - Permissions: " + permissions.ToString(); Cfg.LoggedIn = true; Core.Forms.landingForm lForm = new Core.Forms.landingForm(); this.Hide(); saveLocalConfig(); lForm.Show(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (loginStatus == Config.Cfg.LoginStatus.WrongPassword) { System.Windows.Forms.MessageBox.Show("The password does not match for the account " + txtUsr.Text + "." + Environment.NewLine + "Contact an administrator for more informations!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (loginStatus == Config.Cfg.LoginStatus.InvalidAccount) { System.Windows.Forms.MessageBox.Show("Account " + txtUsr.Text + " does not exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } }