private void CitiesLoadedFromFile(PersistableFile<List<City>> file, Exception error) { if (file != null) ShowData(file.Data); else LoadCitiesFromInternet(); }
private void CitiesLoadedFromInternet(List<City> result) { if (result == null || result.Count == 0) MessageBox.Show(Utils.GetMessage(Error.NoServerAvailable)); else { result = result.Where(x => x.CountryCode == "1").ToList(); var file = new PersistableFile<List<City>>() { FileName = Constants.CitiesStateFileName, Data = result }; file.Save(delegate(Exception ex) { #if DEBUG if (ex != null) MessageBox.Show(Utils.GetMessage(Error.CitiesFileNotSaved) + " : " + ex.Message); #endif }); PhoneApplicationService.Current.State[Constants.CitiesState] = file.Data; ShowData(file.Data); } }
private void SaveStateAndSettings() { SettingsManager.SaveSettings(); if (AppState.Current == null) return; var file = new PersistableFile<AppState>() { FileName = Constants.AppStateFileName, Data = AppState.Current }; file.Save(); }