private void button1_Click(object sender, EventArgs e) { var uName = textBox1.Text; var pass = textBox2.Text; if (service.Login(uName, pass)) { OnAccessGranted?.Invoke(this, new EventArgs()); } warningLabel.Text = "Wrong credentials entered."; }