Ejemplo n.º 1
0
 public override bool Execute(PuzzleViewModel target)
 {
     if (grid.Solve())
     {
         return(true);
     }
     target.ShowInfoMessage("No Solution Found.");
     return(false);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 internal void SetSource(PuzzleViewModel value)
 {
     if (source == value)
     {
         return;
     }
     UnsubscribeFromSource();
     source = value;
     SubscribeToSource();
     Invalidate();
 }
Ejemplo n.º 4
0
 public override bool CanExecute(PuzzleViewModel target) => emptyCells.Count > 0;
Ejemplo n.º 5
0
 public override bool Execute(PuzzleViewModel context)
 {
     cell.Value = newValue; return(true);
 }
Ejemplo n.º 6
0
 public override bool CanExecute(PuzzleViewModel target) => oldValue != newValue && (!target.IsReady || !target.IsCellFixed(cell));
Ejemplo n.º 7
0
 public abstract bool Execute(PuzzleViewModel target);