Пример #1
0
 private void button_Ok_Click(object sender, RoutedEventArgs e)
 {
     if (_ui_logic.CheckAmountFormValid(textBoxCalculate.Text) == false)
     {
         MessageBox.Show("The number is incorrect. (It should be greater that 0.) \nTry to press <Count> button.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         if (ComboBox_Choose.SelectedItem == null)
         {
             MessageBox.Show("You should choose a bill from a combobox.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             if (listBox_Category.SelectedItem == null)
             {
                 MessageBox.Show("You should choose a category.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             else
             {
                 _repo.AddHistoryItem(Convert.ToDecimal(textBoxCalculate.Text), ComboBox_Choose.SelectedItem as String, (listBox_Category.SelectedItem as Category).Id);
                 textBoxCalculate.Clear();
                 ComboBox_Choose.SelectedItem  = null;
                 listBox_Category.SelectedItem = null;
                 NavigationService.Navigate(new History());
                 HistoryInitialised1?.Invoke();
             }
         }
     }
 }