public async Task InitializeAsync(GridView imagesGridView, IOManagerParams managerParams = IOManagerParams.SpotLight) { _managerParams = managerParams; _count = _hTTPService.GetCount(); _maxPagesCount = (int)Math.Floor((decimal)_count / 14); _lastPage = _maxPagesCount; if (Source == null || Source?.Count == 0) { Source = await UpdateSourceAsync(_maxPagesCount); } _imagesGridView = imagesGridView; UpdateButtons(); var _configsService = ServiceLocator.Current.GetInstance <IConfigsService>(); var configs = _configsService.GetConfigs(); if (configs.AlertShown != 5) { var dialogService = ServiceLocator.Current.GetInstance <IDialogService>(); await dialogService.ShowDailyWallpaperAlertAsync("Did you know?", "You can turn on daily wallpaper changing from settings"); configs.AlertShown++; _configsService.SaveConfigs(configs); } IsLoaded = true; }
public async Task InitializeAsync(int page, IOManagerParams @params) { ImageDTOList = new List <ImageDTO>(); _iOManagerParams = @params; _iOManager.Initialize(_iOManagerParams); bool success = await GetAllDataFromServerAsync(page); if (success) { Source = await GetGalleryDataAsync(page); } }
public void Initialize(IOManagerParams @params = IOManagerParams.SpotLight) { if (!isinitialized) { var appdata = ApplicationData.Current.LocalFolder; if (@params == IOManagerParams.SpotLight) { _downloadedfolder = "DownloadedFolder"; _templateFolder = "Templates"; } else if (@params == IOManagerParams.Bing) { _downloadedfolder = "BingDownloaded"; _templateFolder = "BingTemplates"; } else { _downloadedfolder = "LocalDownloaded"; _templateFolder = "LocalTemplates"; } SettingsPath = Path.Combine(appdata.Path, "Configs.json"); DownloadPath = Path.Combine(appdata.Path, _downloadedfolder); TemplatePath = Path.Combine(appdata.Path, _templateFolder); DailyWallpaperFolderPath = Path.Combine(appdata.Path, "DailyWallpaperFolderPath"); if (!Directory.Exists(DownloadPath)) { Directory.CreateDirectory(DownloadPath); } if (!Directory.Exists(TemplatePath)) { Directory.CreateDirectory(TemplatePath); } if (!Directory.Exists(DailyWallpaperFolderPath)) { Directory.CreateDirectory(DailyWallpaperFolderPath); } if (!File.Exists(SettingsPath)) { var file = File.Create(SettingsPath); file.Dispose(); } isinitialized = true; } }