예제 #1
0
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            EditWindow editWindow = new EditWindow();

            if (editWindow.ShowDialog() == (Nullable <bool>)true)
            {
                database.AddCocktailToDatabase(editWindow.GetCocktail());
                ReloadData();
            }
        }
예제 #2
0
 private void buttonEdit_Click(object sender, RoutedEventArgs e)
 {
     if (listCocktails.SelectedItems.Count != 0)
     {
         EditWindow editWindow = new EditWindow(
             ((Cocktail)((ListBoxItem)listCocktails.Items[listCocktails.SelectedIndex]).Tag));
         if (editWindow.ShowDialog() == (Nullable <bool>)true)
         {
             database.UpdateCocktailToDatabase(editWindow.GetCocktail());
             ReloadData();
         }
     }
 }