public ViewModel(Tally tally, IVoteCounter voteCounter, ICache <string> cache, CheckForNewRelease newRelease, IAgnostic agnostic, IGlobalOptions globalOptions, ILogger <ViewModel> logger) { // Save our dependencies in readonly fields. this.tally = tally; this.voteCounter = voteCounter; this.PageCache = cache; this.globalOptions = globalOptions; this.checkForNewRelease = newRelease; this.agnostic = agnostic; this.logger = logger; tally.PropertyChanged += Tally_PropertyChanged; voteCounter.PropertyChanged += VoteCounter_PropertyChanged; // Set up binding commands. AddQuestCommand = new RelayCommand(this, nameof(AddQuestCommand), DoAddQuest, CanAddQuest); RemoveQuestCommand = new RelayCommand(this, nameof(RemoveQuestCommand), DoRemoveQuest, CanRemoveQuest); RunTallyCommand = new AsyncRelayCommand(this, nameof(RunTallyCommand), DoRunTallyAsync, CanRunTally); CancelTallyCommand = new RelayCommand(this, nameof(CancelTallyCommand), DoCancelTally, CanCancelTally); ClearTallyCacheCommand = new RelayCommand(this, nameof(ClearTallyCacheCommand), DoClearTallyCache, CanClearTallyCache); AddLinkedQuestCommand = new RelayCommand(this, nameof(AddLinkedQuestCommand), AddLinkedQuest, CanAddLinkedQuest); RemoveLinkedQuestCommand = new RelayCommand(this, nameof(RemoveLinkedQuestCommand), RemoveLinkedQuest, CanRemoveLinkedQuest); SetupWatches(); }
/// <summary> /// Create a new CheckForNewRelease object, and bind an event listener to it. /// </summary> private void BuildCheckForNewRelease() { checkForNewRelease = new CheckForNewRelease(); checkForNewRelease.PropertyChanged += CheckForNewRelease_PropertyChanged; }