예제 #1
0
        // logic for the edit button
        private void Edit_Button(object sender, RoutedEventArgs e)
        {
            // Sets a global variable to the index of the selected row
            Global.SetIndex(inventoryList[(InventoryItem)InventoryListing.SelectedItem]);
            // Creates an instance of the edit item window
            Window editItemWindow = new EditItem();

            // Makes the instance visible
            editItemWindow.Show();
            // Closes the current instance of the main window
            this.Close();
        }
예제 #2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            // gets search box contents
            string searchBoxContents = SearchBox.Text;
            // gets the item index of the searched for item
            int wantedItemIndex = Global.InventoryListSearch(searchBoxContents);

            // if there isn't a match, open an invalid entry window
            if (wantedItemIndex == -1)
            {
                Window invalidEntry = new InvalidEntry();
                invalidEntry.Show();
            }
            // open the edit item window
            else
            {
                // Creates an instance of the edit item window
                Window editItemWindow = new EditItem();
                // Makes the instance visible
                editItemWindow.Show();
                // Closes the current instance of the main window
                this.Close();
            }
        }