示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
 public GeneralView(GameView parent, string name)
 {
     Parent = parent;
     Name = name;
 }