/// <summary> /// Constructor for Main Window /// </summary> public MainWindow() { try { InitializeComponent(); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; ml = new clsMainLogic(); //Populate Items ComboBox cmbInvoiceItem.ItemsSource = ml.getItems().Select(a => a.ItemDesc); //Populate DataGrid with Invoices List <clsInvoice> invoice = ml.GetAllInvoices(); dgInvoices.ItemsSource = invoice; } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Click on this button and it will navigate you to the Edit Items Window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void itemItems_Click(object sender, RoutedEventArgs e) { try { itemsWindow = new wndItems(); this.Hide(); itemsWindow.ShowDialog(); //Update all dropdowns to reflect any changes (dropdown.itemsSource =) this.Show(); cmbInvoiceItem.ClearValue(ItemsControl.ItemsSourceProperty); cmbInvoiceItem.ItemsSource = ml.getItems().Select(a => a.ItemDesc); } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }