示例#1
0
        private void Delete_button(object sender, RoutedEventArgs e)
        {
            // removes the selected row from the inventory window given the global
            inventoryList.RemoveAt(itemIndex);

            using (SQLiteConnection conn = new SQLiteConnection(App.databasePath))
            {
                conn.CreateTable <Inventory>();

                Inventory m = (from p in conn.Table <Inventory>()
                               where p.Product == EditItemNameBox.Text
                               select p).FirstOrDefault();
                if (m != null)
                {
                    conn.Delete(m);
                }
            }

            // Creates a new instance of the main window
            Window mainWindow = new MainWindow();

            // Shows the new instance of the main window
            mainWindow.Show();
            // Closes the edit item window
            this.Close();
        }
示例#2
0
        private void Delete_button(object sender, RoutedEventArgs e)
        {
            inventoryList.RemoveAt(itemIndex);
            Window mainWindow = new MainWindow();

            mainWindow.Show();
            this.Close();
        }