private void OnFileDownloaded(object sender, DownloadEventArgs e) { if (e.FileSaved) { Log.Debug("Download", "File have been downloaded with success"); _NbFileDownloaded++; if (_NbFileDownloaded == 2) { SharedPreferenceManager.SaveString(ApplicationContext, Constants.DATE_DOWNLAOD, DateTime.Now.ToString()); SharedPreferenceManager.SaveString(ApplicationContext, Constants.SHARED_DATABASE_PATH, System.IO.Path.Combine(_DownloadDirectoryPath, Constants.DATABASE_FILE_NAME)); if (Controller.Permission.CheckPermission.PermissionGranted(ApplicationContext, Manifest.Permission.ReadExternalStorage)) { DataManager.GetInstance(ConfigInstance.GetInstance().IsDev, SharedPreferenceManager.GetString(ApplicationContext, Constants.SHARED_DATABASE_PATH, "")); string pathZipFile = System.IO.Path.Combine(_DownloadDirectoryPath, Constants.IMG_FILE_NAME); ZipManager.Unzip(pathZipFile, _ImgDirectoryPath); } else { Toast.MakeText(ApplicationContext, "Permission non accordée pour la lecture du fichier, aller dans les paramètres de l'application pour modifier cette valeur.", ToastLength.Long).Show(); } //delete temporary file after get values File.Delete(System.IO.Path.Combine(_DownloadDirectoryPath, Constants.IMG_FILE_NAME)); HideProgressBar(); StartActivity(typeof(HomeActivity)); Finish(); } } else { Log.Error("Download", "Error while saving the file"); } }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string refreshMode = spinner.GetItemAtPosition(e.Position).ToString(); SharedPreferenceManager.SaveString(this.Activity, Constants.REFRESH_MODE_PREFERENCES, refreshMode); string toast = string.Format("Le mode de rafraîchissement est {0}", refreshMode); Toast.MakeText(this.Activity, toast, ToastLength.Long).Show(); }