Example #1
0
        public MainPageViewModel(INavigationService navigationService, IExchangeRatesStore ratesStore, ISettingsService settingsService)
            : base(navigationService)
        {
            Title = "Exchange rates application";

            _navigationService = navigationService;

            _ratesStore = ratesStore;

            SettingsService = settingsService;
            SettingsService.BaseCurrencyChanged += async(sender, e) => await RefreshRatesAsync();

            SettingsService.SymbolsListChanged += async(sender, e) => await RefreshRatesAsync();

            ShowSettingsCommand = new DelegateCommand(ShowSettings, () => !IsBusy)
                                  .ObservesProperty(() => IsBusy);

            ShowChartCommand = new DelegateCommand <ExchangeRateItem>(ShowChart, (t) => !IsBusy && t != null)
                               .ObservesProperty(() => IsBusy);

            ShowCachedDataCommand = new DelegateCommand(ShowCachedData, () => !IsBusy)
                                    .ObservesProperty(() => IsBusy);

            DecrementChartDateCommand = new DelegateCommand <ExchangeRateItem>(DecrementChartDate, CanDecrementDate)
                                        .ObservesProperty(() => IsBusy);

            IncrementChartDateCommand = new DelegateCommand <ExchangeRateItem>(IncrementChartDate, CanIncrementChartDate)
                                        .ObservesProperty(() => IsBusy);
        }
Example #2
0
        public DataManagerPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService, IExchangeRatesStore exchangeRatesStore, ICachedDataItemAdapter itemAdapter, IFilesManagerService filesManager, ISettingsService settingsService)
            : base(navigationService)
        {
            Title = "Cached data manager";

            _navigationService  = navigationService;
            _pageDialogService  = pageDialogService;
            _exchangeRatesStore = exchangeRatesStore;
            _itemAdapter        = itemAdapter;
            _filesManager       = filesManager;
            _settingsService    = settingsService;

            SwitchToggledCommand  = new DelegateCommand <object>(SwitchToggled);
            RemoveSelectedCommand = new DelegateCommand(RemoveSelected, CanRemoveSelected);
        }