Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        private void SaveStateAndSettings()
        {
            SettingsManager.SaveSettings();

            if (AppState.Current == null)
                return;

            var file = new PersistableFile<AppState>()
            {
                FileName = Constants.AppStateFileName,
                Data = AppState.Current
            };

            file.Save();
        }