/// <summary> /// Handles the Item Inventory Menu item click. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemInventory_Click(object sender, RoutedEventArgs e) { try { wndItems wndItems = new wndItems(); wndItems.ShowDialog(); } catch (Exception ex) { //this is reflection HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } finally { //Code to be ran no matter what. Closing connnections to dbs/web } }
/// <summary> /// initializes all class level items /// </summary> public MainWindow() { try { InitializeComponent(); //Main window main logic class MainLogic = new clsMainLogic(); //all the selected items MyList = new List <clsLineItems>(); //new blank invoice MyInvoice = new clsInvoice(0, "", 0.00); //flag to switch between and edit save and an add save TypeOfSave = false; //Populates All items in the database to a combo box cbItems.ItemsSource = MainLogic.ListItems(); //populates all selected into a data grid dgAll_Items.ItemsSource = MyList; //updates the displays UpdateDisplays(); ItemsWindow = new wndItems(); //initializes the ItemsWindow //disables editing/deleting/saving until there is something to save EditInvoice.IsEnabled = false; DeleteInvoice.IsEnabled = false; SaveInvoice.IsEnabled = false; //disables all input DisableAllInput(); } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Loads up the main Window /// </summary> public wndMain() { try { InitializeComponent(); //allow application to close Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; //Instantiate Window Objects wndItemsForm = new wndItems(); wndSearchForm = new wndSearch(); oMainLogic = new clsMainLogic(); } catch (Exception ex) { HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Load the items window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemsHeader_Click(object sender, RoutedEventArgs e) { try { //Open items window var items = new wndItems(); items.ShowDialog(); //only reload if there is an invoice loaded and that invoice has a good value if (invoice != null && !string.IsNullOrWhiteSpace(invoice.sInvoiceNum)) { LoadInvoice(Convert.ToInt32(invoice.sInvoiceNum)); //if items were alraedy displayed for an invoice, reload so it's accurate } LoadItems(); } catch (Exception ex) { //This is the top level method so we want to handle the exception 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); } }
/// <summary> /// OnClick handler for the ItemList MenuItem /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event object</param> private void ItemListMenu_Click(object sender, RoutedEventArgs e) { try { //Show the item screen as a dialog wndItems wndItems = new wndItems(); wndItems.ShowDialog(); //After returning from the item screen refresh the items ML.RefreshItems(); if (ML.CurrentInvoice != null) { ML.RefreshSelectedInvoice(); TotalLbl.Content = ML.CurrentInvoice._Total; } } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Constructor for main window and application entry point. /// </summary> public MainWindow() { try { InitializeComponent(); mainLogic = new clsMainLogic(); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;//close the application when the main window is closed //Maybe delete this line. MainWndwInvoice = new clsInvoices(); dataGridList = new ObservableCollection <Item>(); itemsWindow = new wndItems(); SearchWindow = new wndSearch(); //this.Hide(); //temporary for austin's development //itemsWindow.Show(); //temporary for austin's development } catch (Exception ex) { //this is reflection HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
public MainWindow() { InitializeComponent(); items = new wndItems(); }