public void LoadCityList(Context context) { try { using (var stream = new StreamReader (context.OpenFileInput("city.json"))) { var json = stream.ReadToEnd(); var parsed = JsonConvert.DeserializeObject<List<CityViewModel>>(json); CityList = parsed; } } catch (Java.IO.FileNotFoundException) { Console.WriteLine("Could not load saved cities out of JSON file."); } }
public AndroidAccountStore (Context context) { this.context = context; ks = KeyStore.GetInstance (KeyStore.DefaultType); prot = new KeyStore.PasswordProtection (Password); try { lock (fileLock) { using (var s = context.OpenFileInput (FileName)) { ks.Load (s, Password); } } } catch (FileNotFoundException) { //ks.Load (null, Password); LoadEmptyKeyStore (Password); } }