Beispiel #1
0
        public void Execute(object parameter)
        {
            object[]        parameters = (object[])parameter;
            PuzzleScreen    screen     = (PuzzleScreen)parameters[0];
            SquareViewModel square     = (SquareViewModel)parameters[1];
            Vector2D        start      = screen.PicrossViewModel.start;

            if (start == null)
            {
                screen.PicrossViewModel.start = square.Square.Position;
            }
            else
            {
                int smallest;
                int biggest;
                if (start.X == square.Square.Position.X)
                {
                    if (square.Square.Position.Y < start.Y)
                    {
                        smallest = square.Square.Position.Y;
                        biggest  = start.Y;
                    }
                    else
                    {
                        smallest = start.Y;
                        biggest  = square.Square.Position.Y;
                    }
                    while (smallest <= biggest)
                    {
                        screen.PicrossViewModel.Grid[new Vector2D(start.X, smallest)].Square.Contents.Value = Square.FILLED;
                        smallest++;
                    }
                }
                else if (start.Y == square.Square.Position.Y)
                {
                    if (square.Square.Position.X < start.X)
                    {
                        smallest = square.Square.Position.X;
                        biggest  = start.X;
                    }
                    else
                    {
                        smallest = start.X;
                        biggest  = square.Square.Position.X;
                    }
                    while (smallest <= biggest)
                    {
                        screen.PicrossViewModel.Grid[new Vector2D(smallest, start.Y)].Square.Contents.Value = Square.FILLED;
                        smallest++;
                    }
                }
                screen.PicrossViewModel.start = null;
            }
        }
Beispiel #2
0
        public void Execute(object parameter)
        {
            PuzzleScreen     screen = (PuzzleScreen)parameter;
            PicrossViewModel vm     = screen.PicrossViewModel;

            vm.IsSolved.Value = this.puzzle.IsSolved.Value;
            if (this.puzzle.IsSolved.Value)
            {
                vm.Chronometer.Pause();
            }
        }
Beispiel #3
0
 public GoToSelectionCommand(PuzzleScreen screen)
 {
     this.screen = screen;
 }