public MainWindow()
        {
            InitializeComponent();

            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

            // New search object
            clsSL = new clsSearchLogic();

            // New Items object
            clsIL = new clsItemsLogic();

            // New Main object
            clsML = new clsMainLogic();

            // New search class object
            clsSearch = new clsSearch();

            // new item class object
            clsItem = new Item();

            // new search object
            CurrentSearch = new wndSearch();

            // new items object
            CurrentItems = new wndItems();

            // Removing blank space in main data grid
            MainDataGrid.CanUserAddRows = false;

            // Removing blank space in main invoice data grid
            mainInvDG.CanUserAddRows = false;
            mainInvDG.IsReadOnly     = true;

            // Locking the edit region until the user chooses to edit an invoice
            lockEditRegion();

            // create invoice pane enable
            createInvCV.IsEnabled = true;

            // create main window invoice object
            MainWindowInvoice = new clsSearch();

            // Populating the item lists in the drop downs
            popItemLists();

            // new invoice list object
            newInvoiceItems = new List <Item>();
        }
        /// <summary>
        /// Click event for file menu Search item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Search_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // new search window object
                wndSearch CurrentSearch = new wndSearch();

                CurrentSearch.ShowDialog();

                // check to see if the invoice number has been set
                if (CurrentSearch.clsSL.invNumSet)
                {
                    // collect invoice number
                    InvoiceNum = CurrentSearch.clsSL.getInvoiceNum();

                    // add invoice to invoice text box
                    InvoiceNumberLbl.Content = MainWindowInvoice.InvoiceNum;

                    // Populating the main invoice number on main
                    mainInvDG.ItemsSource = clsSL.getInvoice(InvoiceNum);

                    // Unlocking the edit region
                    lockEditRegion();

                    // enable edit invoice button
                    EditInvoiceBtn.IsEnabled = true;

                    // enable edit invoice button
                    DltInvoiceBtn.IsEnabled = true;

                    // Enable current invoice canvas
                    currentInvoiceCV.IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }