private void приемникToolStripMenuItem_Click(object sender, EventArgs e) { var receiverForm = new ReceiverForm(); if (receiverForm.ShowDialog() == DialogResult.OK) { Properties.Settings.Default.PortName = receiverForm.PortName; Program.mainForm.SerialPortMain.Close(); Program.mainForm.SerialPortMain.PortName = receiverForm.PortName; Program.mainForm.SerialPortMain.Open(); } }
private void LoginButton_Click(object sender, EventArgs e) { //кнопка входа - авторизирует пользователя string[] userData; if (cn.CheckLogin(LoginTextBox.Text, PasswordTextBox.Text, out userData)) { ExceptionLabel.Visible = false; LoginTextBox.Text = ""; PasswordTextBox.Text = ""; this.Hide(); if (userData[3] == "r")//роль приемщика { ReceiverForm receiverForm = new ReceiverForm(userData[0], userData[1], userData[2]); receiverForm.Show(); } else if (userData[3] == "m")//роль мастера { MasterForm masterForm = new MasterForm(userData[0], userData[1], userData[2]); masterForm.Show(); } else if (userData[3] == "a")//роль админа { ReceiverForm receiverForm = new ReceiverForm(userData[0], userData[1], userData[2]); receiverForm.Show(); MasterForm masterForm = new MasterForm(userData[0], userData[1], userData[2]); masterForm.Show(); } else { } } else { ExceptionLabel.Visible = true; } }