public List<IToolVM> CreateTools(IGameBoardVM gameBoardVM) { var penTool = new PenToolVM(gameBoardVM); var pencilTool = new PencilToolVM(gameBoardVM); var pencilAllTool = new PencilAllToolVM(gameBoardVM); var tools = new List<IToolVM> { penTool, pencilTool, pencilAllTool }; return tools; }
public GameVM(IGameBoardVM gameBoardVM, IEnumerable<IToolVM> tools) { GameBoard = gameBoardVM; Tools = new ReadOnlyCollection<IToolVM>(tools.ToList()); foreach (var toolVM in Tools.OfType<ISelectableToolVM>()) { toolVM.IsSelected += ToolIsSelected; } }
public GameBoard(IGameBoardVM vm, IGameDataClient dataClient) { InitializeComponent(); // Set important dependand properties DataContext = vm; ViewModel = vm; DataClient = dataClient; // Debug-mode - enables to draw a level IsDebug = true; // Draw elements Init(); }
public PencilToolVM(IGameBoardVM gameBoardVM) : base(gameBoardVM) { Image = @"..\Images\Pencil.png"; }
public void Initialize() { _gameBoard = new Mock<IGameBoard>(); _cells = new List<ICellVM>(); _changeableCellMock1 = new Mock<IChangeableCellVM>(); _changeableCellMock1.Setup(p => p.Index).Returns(0); _changeableCellMock1.Setup(p => p.GetRowIndex()).Returns(0); _changeableCellMock1.Setup(p => p.GetColumnIndex()).Returns(0); _changeableCellMock1.Setup(p => p.GetBoxIndex()).Returns(0); _changeableCellMock1.Setup(p => p.PencilMarks).Returns(new ObservableCollection<int> { 1, 2, 3, 4, 5, 6, 7, 8 }); _changeableCellMock2 = new Mock<IChangeableCellVM>(); _changeableCellMock2.Setup(p => p.Index).Returns(1); _changeableCellMock2.Setup(p => p.GetColumnIndex()).Returns(1); _changeableCellMock2.Setup(p => p.GetBoxIndex()).Returns(0); _changeableCellMock2.Setup(p => p.PencilMarks).Returns(new ObservableCollection<int> { 1, 2, 3, 4, 5, 6, 7, 8 }); _cells.Add(_changeableCellMock1.Object); _cells.Add(_changeableCellMock2.Object); _gameBoardVM = new GameBoardVM(_gameBoard.Object, _cells); }
public PencilAllToolVM(IGameBoardVM gameBoardVM) { _gameBoardVM = gameBoardVM; Image = @"..\Images\PencilAll.png"; }
protected SelectableToolVM(IGameBoardVM gameBoardVM) { GameBoardVM = gameBoardVM; }