//Logout Button private void LockBtn_Click(object sender, EventArgs e) {//Hiding all Ui elements UserLabel.Hide(); UserBtn.Hide(); DetectBtn.Hide(); TrainBtn.Hide(); LockBtn.Hide(); ExitBtn.Hide(); mark2.Hide(); LoginPanel.Show(); LoginPanel.Dock = DockStyle.Fill; LoginPanel.BringToFront(); NameBox.Text = ""; PassBox.Text = ""; }
//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"; } } } }