示例#1
0
 private void ButtonAddService_Click(object sender, EventArgs e)
 {
     if (cbxEmployee.SelectedIndex != -1 && cbxVideoWall.SelectedIndex != -1 &&
         cbxFailureType.SelectedIndex != -1)
     {
         try
         {
             _controller.AddService(this);
             Close();
         }
         catch (Exception ex) when(ex is DateTimeRuleException || ex is InvalidValueException)
         {
             MessageBox.Show(ex.Message, @"Error", MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show(@"Video wall, employee and failure type must be selected.", @"Error",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }