//Submit Button private async void SigninBtn_Click(object sender, EventArgs e) { //Check if Id and password are not empty if (NameBox.Text != "" && PassBox.Text != "") { //If Login Case if (SigninBtn.ButtonText == "Login") { //DOLOGIN : by Sending user and pw to reader Class of data base SignInResult resutl = LoginSys.SignIn(NameBox.Text, PassBox.Text); if (resutl.LoggedIn) { //If Login Operation Successfull , Show the Ui LoginPanel.Dock = DockStyle.None; LoginPanel.Hide(); LoginPanel.SendToBack(); UserLabel.Show(); UserBtn.Show(); DetectBtn.Show(); TrainBtn.Show(); LockBtn.Show(); ExitBtn.Show(); mark2.Show(); UserLabel.Text = resutl.UserData.Name.ToUpperInvariant(); DetectionPanel.Show(); } else { label3.Text = resutl.Reason; } } else { //If Registration Senario : Sending User and pw to Writer Class bool suResult = await LoginSys.SignUp(NameBox.Text, PassBox.Text, "", 0); if (suResult) { label3.Text = "Registration Done Sucessfully"; } } } }
//shows the main menu void showMenu() { ClassicBtn.Invoke(new Action(() => ClassicBtn.Show())); ExitBtn.Invoke(new Action(() => ExitBtn.Show())); HelpBtn.Invoke(new Action(() => HelpBtn.Show())); multiplayerBtn.Invoke(new Action(() => multiplayerBtn.Show())); TimeBtn.Invoke(new Action(() => TimeBtn.Show())); menuBack.Invoke(new Action(() => menuBack.Show())); HomeTLbl.Invoke(new Action(() => HomeTLbl.Show())); boardHomeBtn.Invoke(new Action(() => boardHomeBtn.Hide())); CountdownLbl.Invoke(new Action(() => CountdownLbl.Hide())); TitleLbl.Invoke(new Action(() => TitleLbl.Hide())); if (gameMode == 2) { P1ScoreLbl.Invoke(new Action(() => P1ScoreLbl.Hide())); P2ScoreLbl.Invoke(new Action(() => P2ScoreLbl.Hide())); turnLbl.Invoke(new Action(() => turnLbl.Hide())); } }