/// <summary> /// Default constructor for wndMain /// </summary> public wndMain() { try { InitializeComponent(); Logic = new clsMainLogic(); sql = new clsMainSQL(); ItemLogic = new clsItemsLogic(); ds = new DataSet(); SelectedItems = new List <clsItem>(); SearchLogic = new clsSearchLogic(); // Populate cbItemList List <clsItem> item = ItemLogic.Items(); cbItemList.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = item }); cbItemList.DisplayMemberPath = "sItemDesc"; } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + " " + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// Constructor for main window /// </summary> public wndMain() { try { InitializeComponent(); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; windowItems = new wndItems(); windowSearch = new wndSearch(); mainLogic = new clsMainLogic(); GridMain.DataContext = mainLogic; ComboBoxItems.ItemsSource = mainLogic.Items; } catch (Exception ex) { HandleException(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Sets the ItemsSource and DisplayMemberPath for the ComboBoxes /// </summary> public void SetComboBoxes() { try { mainLogic = new clsMainLogic(); CreateItemSelectionComboBox.ItemsSource = mainLogic.emptyCards; EditItemSelectionComboBox.ItemsSource = mainLogic.emptyCards; InvoiceSelectionComboBox.ItemsSource = mainLogic.emptyInvoices; EditInvoiceListBox.ItemsSource = null; CreateItemSelectionComboBox.ItemsSource = mainLogic.cards; CreateItemSelectionComboBox.DisplayMemberPath = "CardName"; EditItemSelectionComboBox.ItemsSource = mainLogic.cards; EditItemSelectionComboBox.DisplayMemberPath = "CardName"; InvoiceSelectionComboBox.ItemsSource = mainLogic.invoices; InvoiceSelectionComboBox.DisplayMemberPath = "Id"; } catch (Exception ex) { ExceptionHandler(ex); throw; } }
/// <summary> /// This is the main window that will allow the user to create new invoices, /// add items, remove items, delete invoices, and navigate to other windows. /// </summary> public wndMain() { try { InitializeComponent(); // TODO: get styles integrated _logic = new clsMainLogic(); invoicesDataGrid.ItemsSource = _logic.InvoicesDataSet.Tables[0].DefaultView; invoicesDataGrid.SelectedIndex = 0; invoiceItemsDataGrid.ItemsSource = _logic.InvoiceItemsDataSet.Tables[0].DefaultView; invoiceItemsDataGrid.SelectedIndex = 0; itemsComboBox.ItemsSource = _logic.GetAllItems(); } catch (Exception ex) { MessageBox.Show("Unable to create main window. " + ex.ToString(), "Error - wndMain constructor", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }