private void AcceptButton_Click(object sender, RoutedEventArgs e) { try { Data = new ProductTarget(NameInput.Text.Trim()); DialogResult = true; Close(); } catch (Exception ex) { WarningBox.Show(ex.Message); } }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { try { int?index = null; if (TargetInput.SelectedIndex != -1) { index = TargetList.ElementAt(TargetInput.SelectedIndex).ID; } Data = new Product(NameInput.Text.Trim(), DescriptionInput.Text.Trim(), index); DialogResult = true; Close(); } catch (Exception ex) { WarningBox.Show(ex.Message); } }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { try { int?index = null; if (TaskInput.SelectedIndex != -1) { index = TaskList.ElementAt(TaskInput.SelectedIndex).ID; } if (TypeInput.SelectedIndex == -1) { throw new ArgumentException("You must select employee type."); } Data = new Employee(FNameInput.Text.Trim(), LNameInput.Text.Trim(), CityInput.Text.Trim(), (EmployeeType)TypeInput.SelectedItem, index); DialogResult = true; Close(); } catch (Exception ex) { WarningBox.Show(ex.Message); } }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { try { int?index = null; if (ProductInput.SelectedIndex != -1) { index = ProductList.ElementAt(ProductInput.SelectedIndex).ID; } if (DeadlineInput.SelectedDate == null) { throw new ArgumentException("You must specify a deadline."); } Data = new CompanyTask(NameInput.Text.Trim(), DescriptionInput.Text.Trim(), (DateTime)DeadlineInput.SelectedDate, index, (bool)FinishedInput.IsChecked); DialogResult = true; Close(); } catch (Exception ex) { WarningBox.Show(ex.Message); } }