//This is the OK button on the form. //When you clicked it, this window will hide, create a new Kisokos instance, and show it. private void okButton_Click(object sender, EventArgs e) { this.Hide(); Kisokos kisokos = new Kisokos(); kisokos.Show(); }
//This is the Login button //Initialize a MyServiceClient, with this instance I can use the servers method's. //Create a new PopUpForm, maybe I will use this later. //From the UsernameField I read the value, and save this in the Username field. //Same with the PasswordField. //I call the Login method from server side, and save the returned value in a boolean field. //If this boolean is false I show a popUpForm and clear the UsernameField and PasswordField. //Else the login is successfully, hide this window, initialize a new Kisokos instance and show it. private void loginButton_Click(object sender, EventArgs e) { MyServiceClient client = new MyServiceClient(); PopUpForm popUpForm = new PopUpForm(); Username = UsernameField.Text; string Password = PasswordField.Text; bool Login = client.Login(Username, Password); if (Login == false) { popUpForm.Show(); UsernameField.Text = ""; PasswordField.Text = ""; } else { this.Hide(); Kisokos kisokos = new Kisokos(); kisokos.Show(); } }