Beispiel #1
0
 public override bool Execute(PuzzleViewModel target)
 {
     if (grid.Solve())
     {
         return(true);
     }
     target.ShowInfoMessage("No Solution Found.");
     return(false);
 }
Beispiel #2
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     puzzle = new PuzzleViewModel();
     puzzle.MessageOwner   = this;
     puzzle.StateChanged  += OnStateChanged;
     puzzle.SourceChanged += OnSourceChanged;
     puzzleView.SetSource(puzzle);
     UpdateState();
 }
Beispiel #3
0
 internal void SetSource(PuzzleViewModel value)
 {
     if (source == value)
     {
         return;
     }
     UnsubscribeFromSource();
     source = value;
     SubscribeToSource();
     Invalidate();
 }
Beispiel #4
0
 public override bool CanExecute(PuzzleViewModel target) => emptyCells.Count > 0;
Beispiel #5
0
 public override bool Execute(PuzzleViewModel context)
 {
     cell.Value = newValue; return(true);
 }
Beispiel #6
0
 public override bool CanExecute(PuzzleViewModel target) => oldValue != newValue && (!target.IsReady || !target.IsCellFixed(cell));
Beispiel #7
0
 public abstract bool Execute(PuzzleViewModel target);