private async Task LoadData() { IsBusy = true; NotificationMessage = Properties.Resources.NotificationLoading; List <Demo> demos = await _cacheService.GetFilteredDemoListAsync(); Datas = await _accountStatsService.GetRankDateChartDataAsync(demos, SelectedScale.Id); Messenger.Default.Register <SettingsFlyoutClosed>(this, HandleSettingsFlyoutClosedMessage); IsBusy = false; }
public AccountRankViewModel(IAccountStatsService accountStatsService, ICacheService cacheService) { _accountStatsService = accountStatsService; _cacheService = cacheService; ScaleList = new List <ComboboxSelector> { new ComboboxSelector("none", Properties.Resources.None), new ComboboxSelector("day", Properties.Resources.Day), new ComboboxSelector("month", Properties.Resources.Month) }; SelectedScale = ScaleList[0]; if (IsInDesignMode) { DispatcherHelper.Initialize(); NotificationMessage = Properties.Resources.NotificationLoading; IsBusy = true; Application.Current.Dispatcher.Invoke(async() => { Datas = await _accountStatsService.GetRankDateChartDataAsync(new List <Demo>(), SelectedScale.Id); }); } }