private void mSubmitButton_Click(object sender, WindowLibrary.Controls.EventArgs e)
        {
            ScreenManager.MainWindow.DisableClientControl("Account Login");

            string username = mUsername.Text.MysqlEscape();
            string password = mPassword.Text.MysqlEscape();

            if (username.Length < 4 || password.Length < 4)
            {
                InfoDialog msg = new InfoDialog(WindowManager, "Login fehlgeschlagen", "Dein Name und Passwort\nmüssen mindestens 4 Zeichen lang sein!", "Icon.Warning");
                msg.Init();
                msg.IconVisible       = false;
                msg.BtnOK.ModalResult = EModalResult.None;                 // any other close the root
                msg.Closing          += new WindowClosingEventHandler(msg_Closed);

                ScreenManager.MainWindow.Add(msg);
                return;
            }

            DataTable result = Game.MySql.Query("SELECT u.*, g.level, g.name AS groupName FROM `user` AS u LEFT JOIN `groups` AS g ON g.id = u.groupID WHERE u.username = '******' AND u.password = '******'", username, password);

            if (result.Rows.Count == 0)
            {
                InfoDialog msg = new InfoDialog(WindowManager, "Login fehlgeschlagen", "User nicht gefunden!\nBitte überprüfe deinen Username und Passwort\nnoch einmal und versuche es erneut.", "Icon.Error");
                msg.Init();
                msg.IconVisible       = false;
                msg.BtnOK.ModalResult = EModalResult.None;                 // any other close the root
                msg.Closing          += new WindowClosingEventHandler(msg_Closed);

                ScreenManager.MainWindow.Add(msg);
                return;
            }

            ScreenManager.MainWindow.EnableClientControl("Account Login");

            Game.Player = new InsaneRO.Cards.Client.Classes.GamePlayer(result.Rows[0]);
            // switch to control center
            ScreenManager.AddScreen(new ScreenControlCenter(Game));
            ExitScreen();
        }
Exemple #2
0
		private void mSubmitButton_Click(object sender, WindowLibrary.Controls.EventArgs e) {
			ScreenManager.MainWindow.DisableClientControl("Account Login");

			string username = mUsername.Text.MysqlEscape();
			string password = mPassword.Text.MysqlEscape();
			if (username.Length < 4 || password.Length < 4) {
				InfoDialog msg = new InfoDialog(WindowManager, "Login fehlgeschlagen", "Dein Name und Passwort\nmüssen mindestens 4 Zeichen lang sein!", "Icon.Warning");
				msg.Init();
				msg.IconVisible = false;
				msg.BtnOK.ModalResult = EModalResult.None; // any other close the root
				msg.Closing += new WindowClosingEventHandler(msg_Closed);

				ScreenManager.MainWindow.Add(msg);
				return;
			}

			DataTable result = Game.MySql.Query("SELECT u.*, g.level, g.name AS groupName FROM `user` AS u LEFT JOIN `groups` AS g ON g.id = u.groupID WHERE u.username = '******' AND u.password = '******'", username, password);
			if (result.Rows.Count == 0) {
				InfoDialog msg = new InfoDialog(WindowManager, "Login fehlgeschlagen", "User nicht gefunden!\nBitte überprüfe deinen Username und Passwort\nnoch einmal und versuche es erneut.", "Icon.Error");
				msg.Init();
				msg.IconVisible = false;
				msg.BtnOK.ModalResult = EModalResult.None; // any other close the root
				msg.Closing += new WindowClosingEventHandler(msg_Closed);

				ScreenManager.MainWindow.Add(msg);
				return;
			}

			ScreenManager.MainWindow.EnableClientControl("Account Login");

			Game.Player = new InsaneRO.Cards.Client.Classes.GamePlayer(result.Rows[0]);
			// switch to control center
			ScreenManager.AddScreen(new ScreenControlCenter(Game));
			ExitScreen();
		}