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