private void datePicker1_CalendarOpened(object sender, RoutedEventArgs e) { CashInfo ci = DataContext as CashInfo; if (ci != null) { ci.InvalidDateOrSession = false; } }
private void comboBoxSession_SelectionChanged(object sender, SelectionChangedEventArgs e) { CashInfo ci = DataContext as CashInfo; if (ci != null) { if (ci.Date != null) { ci.ShowInstructions = ci.InvalidDateOrSession = false; LoadButton.IsEnabled = true; } } }
/// <summary> /// Handle the click event for the Load Button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Load_Click(object sender, RoutedEventArgs e) { // When quarterly data is load, we show the Quit and Save buttons ExitButton.Visibility = Visibility.Hidden; LoadButton.Visibility = Visibility.Hidden; QuitButton.Visibility = Visibility.Visible; SaveButton.Visibility = Visibility.Visible; // disable the save button till something changes. SaveButton.IsEnabled = false; m_loadedCashInfo = (CashInfo)DataContext; // fill the local working copy from the database if (LoadCashInfo != null) { LoadCashInfo(this, new CashReportLoadEventArgs(m_loadedCashInfo.Date, m_loadedCashInfo.SessionNumber, m_loadedCashInfo)); } // hook the propertyChanged event so that we can enable the Save button. m_loadedCashInfo.PropertyChanged += LoadedCashInfoPropertyChanged; comboBoxSession.IsEnabled = false; datePicker1.IsEnabled = false; }
/// <summary> /// Handle the closing of the DatePicker. The LoadSessionNumber event called to get the /// list of sessions for the specified date and loaded into the combobox. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void datePicker1_CalendarClosed(object sender, RoutedEventArgs e) { DatePicker picker = sender as DatePicker; if (picker != null) { DateTime?dt = picker.SelectedDate; if (dt != null) { if (LoadSessionNumbers != null) { LoadSessionNumbers(this, new CashReportSessionEventArgs(dt)); CashInfo ci = DataContext as CashInfo; if (ci != null) { ci.SessionNumber = 0; comboBoxSession.IsEnabled = true; LoadButton.IsEnabled = true; ci.ShowInstructions = false; } } } } }
public CashReportLoadEventArgs(DateTime?sessionDate, int sessionNumber, CashInfo info) { SessionDate = sessionDate; SessionNumber = sessionNumber; Info = info; }
public CashReportSaveEventArgs(CashInfo infomation) { Info = infomation; }
/// <summary> /// Set DataContext on the view to our data class /// </summary> /// <param name="sender">this class</param> /// <param name="e">event args</param> private void UserControl_Loaded(object sender, RoutedEventArgs e) { DataContext = new CashInfo(); LoadButton.IsEnabled = false; }