Ejemplo n.º 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();
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     _gameOptions = null;
       this.Close();
 }
Ejemplo n.º 4
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     // Clear the game settings and close the window.
     _gameOptions = null;
     Close();
 }
Ejemplo n.º 5
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     _gameOptions = null;
     Close();
 }
Ejemplo n.º 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();
 }