Ejemplo n.º 1
0
        public NameBiddingViewModel(INameAccessor nameAccessor, ITwitchClient twitchClient,
                                    IDataStore <CharacterNameBid> dataStore, IDialogService dialogService, ILogger <NameBiddingViewModel> logger,
                                    ILogger <CharacterNameBidding> charNameBiddingLogger)
        {
            DomainEvents.Register <RemovingName>(HandleNameRemoval);
            DomainEvents.Register <NameVoteReceived>(HandleNameVote);
            DomainEvents.Register <TopNameChanged>(HandleTopNameChange);
            DomainEvents.Register <RefreshEvent>(HandleNameRefresh);

            _nameAccessor          = nameAccessor;
            _twitchClient          = twitchClient;
            _dataStore             = dataStore;
            _dialogService         = dialogService;
            _logger                = logger;
            _charNameBiddingLogger = charNameBiddingLogger;

            ResetDataCommand = new SimpleCommand(x =>
            {
                if (_dialogService.ConfirmDialog("Are you sure you want to reset all name bids?"))
                {
                    Reset();
                }
            });

            foreach (CharNames charName in CharNames.Core)
            {
                CharacterNameBiddings.Add(new CharacterNameBidding(charName, _charNameBiddingLogger));
            }
        }
 public SettingsViewModel(ISettingsStore settingsStore, IDialogService dialogService)
 {
     _settingsStore      = settingsStore;
     _dialogService      = dialogService;
     SaveSettingsCommand = new SimpleCommand(x =>
     {
         if (_dialogService.ConfirmDialog("Saving will overwrite your previously saved settings. OK?"))
         {
             _settingsStore.SaveSettings();
         }
     });
     LoadSettingsCommand = new SimpleCommand(x =>
     {
         if (_dialogService.ConfirmDialog("Loading will replace your current settings. OK?"))
         {
             _settingsStore.LoadSettings();
         }
     });
 }
 public void ConfirmNavigationRequest(NavigationContext navigationContext, Action <Boolean> continuationCallback)
 {
     if (this.Product == null || !this.Product.IsDirty)
     {
         continuationCallback(true);
     }
     else
     {
         var result = _dialogService.ConfirmDialog("Unsaved Data", "Are you sure you want to navigate away, the form has unsaved data.");
         continuationCallback(result == DialogResult.Yes);
     }
 }