private void NewCommandBinding_Executed(object sender, RoutedEventArgs e) { // if we have a game open already, ask to save it first if (gv != null && gv.HasChanged && !CheckSaveGame()) return; // create a new game gv = new GameView(Properties.Settings.Default.Player, Properties.Settings.Default.Password); this.DataContext = gv; tabPages.ItemsSource = gv.PageViews; // enable the save as game menu item that is initially disabled EnableSaveAsCommand(); }
private void OpenFile(string filePath) { GameView gvOld = gv; try { gv = new GameView(Properties.Settings.Default.Player, Properties.Settings.Default.Password, filePath); } catch (System.Exception) { MessageBox.Show("There was an error reading the selected file. Please make sure you selected a valid StormPlanner game file."); gv = gvOld; return; } this.DataContext = gv; tabPages.ItemsSource = gv.PageViews; // enable save and save as game menu items that are initially disabled EnableSaveAsCommand(); }
public GeneralView(GameView parent, string name) { Parent = parent; Name = name; }