public MainViewModel(IGameField gameField, IGameScoreManager gameScore, INewViewFactory newViewFactory) { this.gameField = gameField; this.gameScore = gameScore; this.newViewFactory = newViewFactory; moveBarRight = new DelegateCommand(MoveRight, () => !gameField.IsNotMove && !gameField.IsWinGame); moveBarLeft = new DelegateCommand(MoveLeft, () => !gameField.IsNotMove && !gameField.IsWinGame); moveBarUp = new DelegateCommand(MoveUp, () => !gameField.IsNotMove && !gameField.IsWinGame); moveBarDown = new DelegateCommand(MoveDown, () => !gameField.IsNotMove && !gameField.IsWinGame); startGame = new DelegateCommand(InitialGame); gameScore.ScoreChanged += GameScore_ScoreChanged; gameScore.HighScoreChanged += GameScore_HighScoreChanged; gameField.FieldChanged += GameField_FieldChanged; gameField.NotMove += GameField_NotMove; gameField.WinGame += GameField_WinGame; }
public virtual IViewModel BuildMainViewModel(IGameField gameField, IGameScoreManager gameScoreManager, INewViewFactory newViewFactory) => new MainViewModel(gameField, gameScoreManager, newViewFactory);