public async Task SimulateStartup() { DirectoryDefaultManager dirManager = new DirectoryDefaultManager(); _ImgDirectoryPath = dirManager.GetImageDirectory(); _DownloadDirectoryPath = dirManager.GetDownlaodDirectory(); if (!CheckIsDownload() || !File.Exists(Path.Combine(_DownloadDirectoryPath, Constants.DATABASE_FILE_NAME)) || !Directory.Exists(_ImgDirectoryPath)) { await ProgressBar.ProgressTo(0.1, SIZE_PROGRESS_LONG, Easing.Linear); //save temporary file _Downloader.OnFileDownloaded += OnFileDownloaded; // Use the configuration value _Downloader.DownloadFile(ConfigInstance.GetInstance().DatabaseUrl, _DownloadDirectoryPath, Constants.DATABASE_FILE_NAME); _Downloader.DownloadFile(ConfigInstance.GetInstance().ImageUrl, _DownloadDirectoryPath, Constants.IMG_FILE_NAME); await ProgressBar.ProgressTo(0.2, SIZE_PROGRESS_LONG, Easing.Linear); } else { Log.Warning("Download", "Database already save"); DataManager.GetInstance(ConfigInstance.GetInstance().IsDev, Preferences.Get(Constants.SHARED_DATABASE_PATH, "")); await ProgressBar.ProgressTo(0.99, SIZE_PROGRESS_SMALL, Easing.Linear); _App.ChangePage(new MainPage()); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ConfigurationManager.Initialize(new AndroidConfigurationStreamProviderFactory(() => this)); DirectoryDefaultManager dirManager = new DirectoryDefaultManager(); using (var cts = new CancellationTokenSource()) { // Create or get a cancellation token from somewhere var config = await ConfigurationManager.Instance.GetAsync(cts.Token); ConfigInstance.GetInstance(config); } _ImgDirectoryPath = dirManager.GetImageDirectory(); _DownloadDirectoryPath = dirManager.GetDownlaodDirectory(); ImageManager <Bitmap> .GetInstance(_ImgDirectoryPath, new AndroidCreateImage()); }