public void NewGame() {
     //Let class library create a new game
     _sudoku.NewGame();
     //Iterate over all existing locations
     var locations = new List<Location>();
     for (int i = 0; i < 81; i++) {
         var p = new Position();
         p.X = Convert.ToInt16(((i / 9) + 1));
         p.Y = Convert.ToInt16(((i % 9) + 1));
         _sudoku.GetValue(p);
         //Lock default values
         p.IsEditable = p.Value == 0;
         locations.Add(new Location(_sudoku, p));
     }
     Locations = new ObservableCollection<Location>(locations);
     //Make notification of changed locations
     RaisePropertyChanged("Locations");
 }
Пример #2
0
 public Location(SudokuGame game, Position position)
 {
     _game = game;
     _position = position;
 }