public HistoricalUsageStatsViewModel() { _isCumulativeChartCategoryActive = this.ObservableForProperty(vm => vm.ChartCategory, skipInitial: false) .Select(prop => prop.Value == ChartCategory.Cumulative) .ToProperty(this, vm => vm.IsCumulativeChartCategoryActive); _isDistributedChartCategoryActive = this.ObservableForProperty(vm => vm.ChartCategory, skipInitial: false) .Select(prop => prop.Value == ChartCategory.Distributed) .ToProperty(this, vm => vm.IsDistributedChartCategoryActive); _chartTypes = this.ObservableForProperty(vm => vm.ChartCategory, skipInitial: false) .Select(prop => prop.Value == ChartCategory.Cumulative ? new ObservableCollection <string>(ChartTypeViewModelSource.GetCumulativeChartViewModels().Select(x => x.Description)) : new ObservableCollection <string>(ChartTypeViewModelSource.GetDistributedChartViewModels().Select(x => x.Description))) .ToProperty(this, vm => vm.ChartTypes); _chartUpdateBinding = this.WhenAnyValue(x => x.SelectedChartType, x => x.SourceDataFile, x => x.ChartCategory, x => x.MovingAveragePeriod, x => x.SelectedAggregationType) .Subscribe(_ => RefreshChartCommand?.Execute(null)); }
private void Service_OnChange(bool isChange) { RefreshChartCommand.Execute(null); }