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