public CommandResultViewModel(string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("name"); } Name = name; Score = 0; #region Commands initialize AddScoreCommand = new AddScoreCommand(this); SubstractScoreCommand = new SubstractScoreCommand(this); AddScorePopupCommand = new RelayCommand <int>( delegate(int scr) { Messenger.Default.Send( new PopupActivateMessage(new PopupActivateArgs(AddScoreCommand, scr))); }); SubstractScorePopupCommand = new RelayCommand <int>( delegate(int scr) { Messenger.Default.Send( new PopupActivateMessage(new PopupActivateArgs(SubstractScoreCommand, scr))); }); #endregion }
private void AddScore(object obj) { AddScore(obj as Label); canAddScore = false; AddScoreCommand.CanExecute(new Object()); canNextTurn = true; NextTurnCommand.CanExecute(new Object()); }
private void AddScore(Label _lbl) { if (currentPlayer.PlayerId == selectedPlayer.PlayerId && String.IsNullOrEmpty(_lbl.Content.ToString())) { _lbl.Content = scoreController.CalculateScore(_lbl.Name); canAddScore = false; AddScoreCommand.CanExecute(new Object()); } }
private void NextTurn(object obj) { canRollDice = NextTurn(); canAddScore = false; AddScoreCommand.CanExecute(new Object()); ResetDiceRectangle(); canNextTurn = false; NextTurnCommand.CanExecute(new Object()); }
private void AddCheatScore(Label _lbl) { if (currentPlayer.PlayerId == selectedPlayer.PlayerId) { _lbl.Content = scoreController.CalculateScore(_lbl.Name, true); } canAddScore = false; AddScoreCommand.CanExecute(new Object()); }
private void RollDices(object obj) { canRollDice = RollDices(); canAddScore = true; AddScoreCommand.CanExecute(new Object()); }