public AccountMapsViewModel(ICacheService cacherService, IAccountStatsService accountStatsService)
        {
            _accountStatsService = accountStatsService;
            _cacheService        = cacherService;

            if (IsInDesignMode)
            {
                Application.Current.Dispatcher.Invoke(async() =>
                {
                    await LoadDatas();
                });
            }
        }
		public SettingsViewModel(
			IDialogService dialogService, ICacheService chacheService, IDemosService demosService,
			ISteamService steamService, IAccountStatsService accountStatsService)
		{
			_dialogService = dialogService;
			_cacheService = chacheService;
			_demosService = demosService;
			_steamService = steamService;
			_accountStatsService = accountStatsService;

			Themes = new List<ComboboxSelector>
			{
				new ComboboxSelector("Dark", Properties.Resources.Dark),
				new ComboboxSelector("Light", Properties.Resources.Light)
			};

			if (IsInDesignMode)
			{
				_dateStatsTo = DateTime.Today.AddDays(30);
				_selectedTheme = new ComboboxSelector("Dark", Properties.Resources.Dark);
			}
			else
			{
				SelectedTheme = Themes.First(t => t.Id == Settings.Default.Theme);
			}

			Languages = new List<ComboboxSelector>();
			foreach (Language language in AppSettings.LANGUAGES.Where(l => l.IsEnabled))
			{
				ComboboxSelector newLanguage = new ComboboxSelector(language.Key, language.Name);
				if (language.Key == Settings.Default.Language) SelectedLanguage = newLanguage;
				Languages.Add(newLanguage);
			}

			Application.Current.Dispatcher.Invoke(async () =>
			{
				List<Account> accounts = await _cacheService.GetAccountListAsync();
				Accounts = new ObservableCollection<Account>(accounts);
				StatusList = new List<DemoStatus>(AppSettings.DefaultStatus);
				SelectedStatsAccount = Accounts.FirstOrDefault(a => a.SteamId == Settings.Default.SelectedStatsAccountSteamID.ToString());
				DownloadFolderPath = Settings.Default.DownloadFolder;
				IgnoreLaterBan = Settings.Default.IgnoreLaterBan;
				CacheSize = await _cacheService.GetCacheSizeAsync();
				_cacheService.Filter.From = Settings.Default.DateStatsFrom;
				_cacheService.Filter.To = Settings.Default.DateStatsTo;
				_cacheService.Filter.Folder = Settings.Default.LimitStatsFolder ? Settings.Default.LastFolder : null;
			});

			Messenger.Default.Register<SettingsFlyoutOpenedMessage>(this, HandleSettingsFlyoutOpenedMessage);
		}
Esempio n. 3
0
        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);
                });
            }
        }