Exemple #1
0
 public MainWindow()
 {
     InitializeComponent();
     diceRollerVM           = new DiceRollerViewModel();
     diceRoller.DataContext = diceRollerVM;
     //scoreSheet.DataContext = new ScoreSheetViewModel(new ScoreSheet(),diceRollerVM);
 }
Exemple #2
0
 public RollCommand(DiceRollerViewModel drvm)
 {
     viewModel = drvm;
     // Call CanExecuteChanged whenever CanRoll changes
     viewModel.CanRoll.PropertyChanged += (sender, args) =>
     {
         if (CanExecuteChanged != null)
         {
             CanExecuteChanged(this, new EventArgs());
         }
     };
 }
Exemple #3
0
        public ScoreSheetViewModel(ScoreSheet scoreSheet, DiceRollerViewModel diceRollerViewModel)
        {
            this.diceRollerViewModel = diceRollerViewModel;
            this.scoreSheet          = scoreSheet;
            scoreLines = new List <ScoreLineViewModel>();
            List <ScoreLineViewModel> _scoreLines = new List <ScoreLineViewModel>();

            foreach (ScoreLine scoreLine in this.scoreSheet.ScoreLines)
            {
                _scoreLines.Add(new ScoreLineViewModel(scoreLine));
            }
            scoreLines = _scoreLines.AsReadOnly();
        }