Example #1
0
 public Options()
 {
     if (_gameOptions == null)
       {
     if (File.Exists("GameOptions.xml"))
     {
       using (var stream = File.OpenRead("GameOptions.xml"))
       {
     var serializer = new XmlSerializer(typeof(GameOptions));
     _gameOptions = serializer.Deserialize(stream) as GameOptions;
       }
     }
     else
       _gameOptions = new GameOptions();
       }
       DataContext = _gameOptions;
       InitializeComponent();
 }
Example #2
0
 public StartGame()
 {
     if (_gameOptions == null)
       {
     if (File.Exists("GameOptions.xml"))
     {
       using (var stream = File.OpenRead("GameOptions.xml"))
       {
     var serializer = new XmlSerializer(typeof(GameOptions));
     _gameOptions = serializer.Deserialize(stream) as GameOptions;
       }
     }
     else
       _gameOptions = new GameOptions();
       }
       DataContext = _gameOptions;
       InitializeComponent();
       if (_gameOptions.PlayAgainstComputer)
     playerNamesListBox.SelectionMode = SelectionMode.Single;
       else
     playerNamesListBox.SelectionMode = SelectionMode.Extended;
 }
Example #3
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     _gameOptions = null;
       this.Close();
 }
Example #4
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     // Clear the game settings and close the window.
     _gameOptions = null;
     Close();
 }
Example #5
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     _gameOptions = null;
     Close();
 }
Example #6
0
 public Options()
 {
     _gameOptions = GameOptions.Create();
     DataContext  = _gameOptions;
     InitializeComponent();
 }
 public GameViewModel()
 {
     _players     = new List <Player>();
     _gameOptions = GameOptions.Create();
 }
 void StartGame_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     _gameOptions = DataContext as GameOptions;
     ChangeListBoxOptions();
 }