コード例 #1
0
 private void itemBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (MainMenu.ChosenIsCommon())
     {
         try
         {
             _chosencommon = itemBox.SelectedItem as CommonRecipes;
             foreach (var item in MainMenu.CommonList())
             {
                 if (_chosencommon == item)
                 {
                     _indexofitemA = MainMenu.CommonList().IndexOf(item);
                 }
             }
             if (LoginPage.IsLogged())
             {
                 _chosencommon = itemBox.SelectedItem as CommonRecipes;
                 foreach (var item in MainMenu.UsersList())
                 {
                     if (_chosencommon == item)
                     {
                         _indexofitemU = MainMenu.UsersList().IndexOf(item);
                     }
                 }
             }
             RecipeWindow rw = new RecipeWindow();
             rw.Show();
         }
         catch { }
     }
     else
     {
         try
         {
             _chosengame = itemBox.SelectedItem as GameRecipes;
             foreach (var item in MainMenu.GameList())
             {
                 if (_chosengame == item)
                 {
                     _indexofitemA = MainMenu.GameList().IndexOf(item);
                 }
             }
             RecipeWindow rw = new RecipeWindow();
             rw.Show();
         }
         catch { }
     }
 }
コード例 #2
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (CheckBoxes())
     {
         GameRecipes _recipe = new GameRecipes(_game, _itemname, _ingredients, _link);
         MainMenu.GameList().Add(_recipe);
         Save(MainMenu.GameList());
         ClearAll();
         FillComboBox();
         _game = _itemname = _ingredients = _link = null;
         // Pages.MainMenu.LoadData(); не работает, приходится использовать кнопку "Refresh" с точно таким же методом.
     }
     else
     {
         MessageBox.Show("Not all fields are filled in.");
     }
 }