private void OnDeleteExecute() { WCFGameLibraryServiceClient proxy = new WCFGameLibraryServiceClient(); proxy.Delete(_selectedGame); MessageBox.Show("Game deleted.", "Delete"); LoadAsync(); }
private void addNew_btn_Click(object sender, RoutedEventArgs e) { Game game = new Game { Title = title_textbox.Text, Description = description_textbox.Text }; WCFGameLibraryServiceClient proxy = new WCFGameLibraryServiceClient(); proxy.Add(game); _viewModel.LoadAsync(); addNew_btn.Visibility = Visibility.Hidden; save_btn.Visibility = Visibility.Visible; new_btn.IsEnabled = true; title_textbox.Text = ""; description_textbox.Text = ""; MessageBox.Show("Game added.", "New game"); }
public async void LoadAsync() { WCFGameLibraryServiceClient proxy = new WCFGameLibraryServiceClient(); try { var allGames = await proxy.GetAllGamesAsync(); Games.Clear(); foreach (var game in allGames) { Games.Add(game); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { proxy.Close(); } }
public async void SaveGameAsync() { WCFGameLibraryServiceClient proxy = new WCFGameLibraryServiceClient(); await proxy.SaveAsync(_selectedGame); }