Пример #1
0
 private string CustomValue(string name)
 {
     if (Value("FontSize") != "0")
     {
         return(ChooseValue(name));
     }
     else
     {
         try
         {
             if (IsolatedStorageSettings.ApplicationSettings.Contains(name))
             {
                 SettingEntity settingUnit = (SettingEntity)IsolatedStorageSettings.ApplicationSettings[name];
                 return(settingUnit.Custom);
             }
             else
             {
                 return(string.Empty);
             }
         }
         catch (IsolatedStorageException)
         {
             return(string.Empty);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Loads all setting needed on SettingPage with information about type of settings and values which can be selected (in choice setting like Language or Font Size)
        /// </summary>
        /// <returns>List of settings</returns>
        public ObservableCollection <SettingEntity> Load()
        {
            ObservableCollection <SettingEntity> list = new ObservableCollection <SettingEntity>();
            IsolatedStorageSettings allsettings       = IsolatedStorageSettings.ApplicationSettings;

            foreach (var savedSetting in IsolatedStorageSettings.ApplicationSettings)
            {
                if (!savedSetting.Key.Contains("_"))
                {
                    SettingUnit = (SettingEntity)allsettings[savedSetting.Key];
                    SettingEntity stgUnit = new SettingEntity()
                    {
                        Key = SettingUnit.Key, Value = SettingUnit.Value, Type = SettingUnit.Type, RealCapabilities = SettingUnit.RealCapabilities
                    };
                    switch (savedSetting.Key)
                    {
                    case "GPS":
                        stgUnit.Display = Languages.AppResources.settings_GPS;
                        break;

                    case "AutoCheckNewSurvey":
                        stgUnit.Display = Languages.AppResources.settings_AutoCheckNewSurvey;
                        break;

                    case "Language":
                        stgUnit.Capabilities = new List <string> {
                            Languages.AppResources.settings_PhoneLanguage, "Polski", "English", "Español"
                        };
                        stgUnit.Display = Languages.AppResources.settings_Language;
                        break;

                    case "FontSize":
                        stgUnit.Capabilities = new List <string> {
                            Languages.AppResources.settings_Custom, Languages.AppResources.settings_Small, Languages.AppResources.settings_Medium, Languages.AppResources.settings_Large
                        };
                        stgUnit.Display = Languages.AppResources.settings_FontSize;
                        stgUnit.Custom  = SettingUnit.Custom;
                        break;

                    case "PhotoResolution":
                        stgUnit.Capabilities = SettingUnit.Capabilities;
                        stgUnit.Display      = Languages.AppResources.settings_PhotoResolution;
                        break;

                    case "Theme":
                        stgUnit.Capabilities = new List <string> {
                            Languages.AppResources.settings_NDG, Languages.AppResources.settings_OtherTheme, Languages.AppResources.settings_HighContrast
                        };
                        stgUnit.Display = Languages.AppResources.settings_Theme;
                        break;
                    }
                    list.Add(stgUnit);
                }
            }

            return(list);
        }
        private OperationsOnSettings()
        {
            SettingUnit = new SettingEntity();
            Message = new DialogBox();

            try
            {
                if (!IsolatedStorageSettings.ApplicationSettings.Contains("_isSetSettings"))
                {
                    DefaultSettings();
                }
            }
            catch (IsolatedStorageException)
            {
                Message.Show(Languages.AppResources.settings_IsolatedStorageFailed);
            }
        }
Пример #4
0
        private OperationsOnSettings()
        {
            SettingUnit = new SettingEntity();
            Message     = new DialogBox();

            try
            {
                if (!IsolatedStorageSettings.ApplicationSettings.Contains("_isSetSettings"))
                {
                    DefaultSettings();
                }
            }
            catch (IsolatedStorageException)
            {
                Message.Show(Languages.AppResources.settings_IsolatedStorageFailed);
            }
        }
Пример #5
0
 private string ChooseValue(string name)
 {
     try
     {
         if (IsolatedStorageSettings.ApplicationSettings.Contains(name))
         {
             SettingEntity settingUnit = (SettingEntity)IsolatedStorageSettings.ApplicationSettings[name];
             return(settingUnit.RealCapabilities[Convert.ToInt32(settingUnit.Value)]);
         }
         else
         {
             return(string.Empty);
         }
     }
     catch (IsolatedStorageException)
     {
         return(string.Empty);
     }
 }
        /// <summary>
        /// Loads all setting needed on SettingPage with information about type of settings and values which can be selected (in choice setting like Language or Font Size)
        /// </summary>
        /// <returns>List of settings</returns>
        public ObservableCollection<SettingEntity> Load()
        {
            ObservableCollection<SettingEntity> list = new ObservableCollection<SettingEntity>();
            IsolatedStorageSettings allsettings = IsolatedStorageSettings.ApplicationSettings;

            foreach (var savedSetting in IsolatedStorageSettings.ApplicationSettings)
            {
                if (!savedSetting.Key.Contains("_"))
                {
                    SettingUnit = (SettingEntity)allsettings[savedSetting.Key];
                    SettingEntity stgUnit = new SettingEntity() { Key = SettingUnit.Key, Value = SettingUnit.Value, Type = SettingUnit.Type, RealCapabilities = SettingUnit.RealCapabilities };
                    switch (savedSetting.Key)
                    {
                        case "GPS":
                            stgUnit.Display = Languages.AppResources.settings_GPS;
                            break;
                        case "AutoCheckNewSurvey":
                            stgUnit.Display = Languages.AppResources.settings_AutoCheckNewSurvey;
                            break;
                        case "Language":
                            stgUnit.Capabilities = new List<string> { Languages.AppResources.settings_PhoneLanguage, "Polski", "English", "Español" };
                            stgUnit.Display = Languages.AppResources.settings_Language;
                            break;
                        case "FontSize":
                            stgUnit.Capabilities = new List<string> { Languages.AppResources.settings_Custom, Languages.AppResources.settings_Small, Languages.AppResources.settings_Medium, Languages.AppResources.settings_Large };
                            stgUnit.Display = Languages.AppResources.settings_FontSize;
                            stgUnit.Custom = SettingUnit.Custom;
                            break;
                        case "PhotoResolution":
                            stgUnit.Capabilities = SettingUnit.Capabilities;
                            stgUnit.Display = Languages.AppResources.settings_PhotoResolution;
                            break;
                        case "Theme":
                            stgUnit.Capabilities = new List<string> { Languages.AppResources.settings_NDG, Languages.AppResources.settings_OtherTheme, Languages.AppResources.settings_HighContrast };
                            stgUnit.Display = Languages.AppResources.settings_Theme;
                            break;
                    }
                    list.Add(stgUnit);
                }
            }

            return list;
        }