//This function is used to insert Key,Value pair information in the Isolated Storage memory
 #region InsertDetailInMemory
 public static void InsertDetailInMemory(string key, object value)
 {
     try
     {
         appSettings = IsolatedStorageSettings.ApplicationSettings;
         if (!appSettings.Contains(key))
             appSettings.Add(key, value);
         else
             appSettings[key] = value;
         appSettings.Save();
     }
     catch (Exception) { }
 }
Пример #2
0
        public bool IsFirstTimeOpeningApplication()
        {
            bool returnValue = true;

            IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

            if (appSettings.Count() > 0)
            {
                returnValue = false;
            }

            return(returnValue);
        }
Пример #3
0
        public MapPage()
        {
            InitializeComponent();
            _appSettings   = IsolatedStorageSettings.ApplicationSettings;
            jd             = new PhoneNumberChooserTask();
            jd.Completed  += jd_Completed;
            AMapConfig.Key = "4797d3e49bcc69a8bf4c77a949a56769";
            AGeoCoordinateWatcher amapGeoCoordinateWatcher = new AGeoCoordinateWatcher();

            amapGeoCoordinateWatcher.PositionChanged += amapGeoCoordinateWatcher_PositionChanged;
            amapGeoCoordinateWatcher.StatusChanged   += amapGeoCoordinateWatcher_StatusChanged;
            amapGeoCoordinateWatcher.Start();
        }
Пример #4
0
 public Map()
 {
     InitializeComponent();
     try
     {
         // Get the settings for this application.
         isolatedStorage = IsolatedStorageSettings.ApplicationSettings;
     }
     catch (Exception err)
     {
         Debug.WriteLine("Exception while using IsolatedStorageSettings: " + err.ToString());
     }
 }
Пример #5
0
        private void HistoryList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            HistoryData SelectedItem = (HistoryData)HistoryList.SelectedItem;//get listbox item data

            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("DebugMode") && settings["DebugMode"].ToString() == "true")
            {
                MessageBox.Show("Your selected Tag's id is:" + SelectedItem.Tag_id.ToString());
            }

            NavigationService.Navigate(new Uri("/DataBeacon.xaml?t=" + SelectedItem.Tag_id.ToString(), UriKind.Relative));
        }
Пример #6
0
        public static void UpdateOrAdd(IsolatedStorageSettings obj, string key, object value)
        {
            if (obj.Contains(key))
            {
                obj[key] = value;
            }
            else
            {
                obj.Add(key, value);
            }

            obj.Save();
        }
        public void SaveValue(string key, object settingsValue)
        {
            IsolatedStorageSettings localSettings = IsolatedStorageSettings.ApplicationSettings;

            if (!localSettings.Contains(key))
            {
                localSettings.Add(key, settingsValue);
            }
            else
            {
                localSettings[key] = settingsValue;
            }
        }
Пример #8
0
        public static ObservableCollection <City> GetCities()
        {
            ObservableCollection <City> cities   = new ObservableCollection <City>();
            IsolatedStorageSettings     settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("cities"))
            {
                Dictionary <int, City> citiesDict = ((Dictionary <int, City>)settings["cities"]);
                cities = new ObservableCollection <City>(citiesDict.Values);
            }

            return(cities);
        }
Пример #9
0
        public static void Initialize()
        {
            UserSettings = IsolatedStorageSettings.ApplicationSettings;

            if (UserSettings.Count == 0)
            {
                SetDefaultValues();
            }
            else
            {
                LoadValues();
            }
        }
Пример #10
0
 public static bool SetValue(this IsolatedStorageSettings settings, string key, object value)
 {
     if (settings.Contains(key))
     {
         settings[key] = value;
         return(false);
     }
     else
     {
         settings.Add(key, value);
         return(true);
     }
 }
Пример #11
0
        private static object ReadSetting(string name, object def)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains(name.ToLower()))
            {
                return(settings[name.ToLower()]);
            }
            else
            {
                return(def);
            }
        }
Пример #12
0
        /// <summary>
        /// Persist the badge of the app icon so that `getBadge` is able to return
        /// the badge number back to the client.
        /// </summary>
        private void SaveBadge(int badge)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains(KEY))
            {
                settings[KEY] = badge;
            }
            else
            {
                settings.Add(KEY, badge);
            }
        }
Пример #13
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.isoData             = IsolatedStorageSettings.ApplicationSettings;
            progMain.Visibility      = System.Windows.Visibility.Visible;
            progMain.IsIndeterminate = true;
            progMain.IsEnabled       = true;
            bool foundEvent = NavigationContext.QueryString.TryGetValue("EventId", out EventId);

            if (foundEvent)
            {
                LoadIsolatedStorage();
            }
        }
Пример #14
0
        private void updateUI()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings["clock24"].ToString() == "true")
            {
                hour.Text = DateTime.Now.ToString("H:mm");
            }
            else
            {
                hour.Text = DateTime.Now.ToString("h:mm");
            }
        }
        private void LoadSettings()
        {
            _isolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings;

            if (_isolatedStorageSettings.Contains(_merchantServerUrlKey))
            {
                MerchantServerUrl.Text = (string)_isolatedStorageSettings[_merchantServerUrlKey];
            }
            else
            {
                _isolatedStorageSettings.Add(_merchantServerUrlKey, "");
            }
        }
Пример #16
0
        private string LoadServerAddress()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (!settings.Contains("lastServerAddress"))
            {
                return(null);
            }
            else
            {
                return(settings["lastServerAddress"] as string);
            }
        }
Пример #17
0
        public static TT Read <TT>(string name, TT defaultValue)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            TT value;

            if (settings == null || !settings.TryGetValue <TT>(name, out value))
            {
                return(defaultValue);
            }

            return(value);
        }
Пример #18
0
        public static void SalvarPerfilPhoneSettings(Perfil perfil)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            settings[CHAVE_ID]    = perfil.Id;
            settings[CHAVE_NOME]  = perfil.Nome;
            settings[CHAVE_EMAIL] = perfil.Email;
            //settings[CHAVE_DATA] = perfil.DataNascimento;
            settings[CHAVE_SENHA]  = perfil.Senha;
            settings[CHAVE_CIDADE] = perfil.Cidade;
            settings[CHAVE_ESTADO] = perfil.Estado;
            settings.Save();
        }
Пример #19
0
        public void SaveStateToIsolatedStorage()
        {
            IsolatedStorageSettings iss = IsolatedStorageSettings.ApplicationSettings;

            if (!iss.Contains("Settings"))
            {
                iss.Add("Settings", Settings);
            }
            else
            {
                iss["Settings"] = Settings;
            }
        }
Пример #20
0
        public void SetData()
        {
            Mutex mutex = new Mutex(false, "ScheduledAgentData");

            mutex.WaitOne();
            IsolatedStorageSettings setting = IsolatedStorageSettings.ApplicationSettings;

            if (!setting.Contains("ScheduledAgentData"))
            {
                setting.Add("ScheduledAgentData", "Foreground data");
            }
            mutex.ReleaseMutex();
        }
Пример #21
0
        public static void SetPageOpened(ExamplePage page, bool isOpened = true)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains(page.ToString()))
            {
                settings[page.ToString()] = isOpened;
            }
            else
            {
                settings.Add(page.ToString(), isOpened);
            }
        }
Пример #22
0
        public void RefreshSettings()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains(App.UseLocationServiceKey))
            {
                this.useLocationService = (bool)settings[App.UseLocationServiceKey];
            }
            else
            {
                this.useLocationService = true;
            }
        }
Пример #23
0
        public static object Load(string key)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (!settings.Contains(key))
            {
                throw new Exception("The destination savedata does not exist");
            }
            else
            {
                return(settings[key]);
            }
        }
Пример #24
0
        public int GetPageCount()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("pageCount"))
            {
                return(int.Parse(settings["pageCount"].ToString()));
            }
            else
            {
                return(3);
            }
        }
Пример #25
0
        public bool LoadSettings(string key, ref string value)
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
            string val;
            bool   ret = settings.TryGetValue <string>(key, out val);

            if (ret)
            {
                value = val;
            }

            return(ret);
        }
Пример #26
0
        public static void RemoveSetting(string key)
        {
            try
            {
                IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

                appSettings.Remove(key);
                appSettings.Save();
            }
            catch (Exception ex)
            {
            }
        }
Пример #27
0
        void LoadSettings()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("elapsedTimeFormat"))
            {
                ElapsedTimeFormat = (ElapsedTimeFormat)settings["elapsedTimeFormat"];
            }
            else
            {
                ElapsedTimeFormat = ElapsedTimeFormat.HourMinuteSecond;
            }
        }
Пример #28
0
        public void clearAllCookies(string parameters)
        {
            IsolatedStorageSettings     userSettings = IsolatedStorageSettings.ApplicationSettings;
            Dictionary <string, Cookie> tempDict     = (Dictionary <string, Cookie>)userSettings[COOKIEJAR];

            tempDict.Clear();
            userSettings[COOKIEJAR] = tempDict;

            lock (_sync)
            {
                IsolatedStorageSettings.ApplicationSettings.Save();
            }
        }
Пример #29
0
        // Save API Keys
        internal static void SaveAPIKey(string network, string apikey)
        {
            // Save keys in isolated storage

            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            switch (network)
            {
            case "Bitcoin":
                if (!settings.Contains("Bitcoin"))
                {
                    settings.Add("Bitcoin", apikey);
                    settings.Save();
                }
                else
                {
                    settings.Remove("Bitcoin");
                    settings.Add("Bitcoin", apikey);
                    settings.Save();
                }
                break;

            case "Litecoin":
                if (!settings.Contains("Litecoin"))
                {
                    settings.Add("Litecoin", apikey);
                    settings.Save();
                }
                else
                {
                    settings.Remove("Litecoin");
                    settings.Add("Litecoin", apikey);
                    settings.Save();
                }
                break;

            case "Dogecoin":
                if (!settings.Contains("Dogecoin"))
                {
                    settings.Add("Dogecoin", apikey);
                    settings.Save();
                }
                else
                {
                    settings.Remove("Dogecoin");
                    settings.Add("Dogecoin", apikey);
                    settings.Save();
                }
                break;
            }
        }
Пример #30
0
        void OnLoaded(object sender, RoutedEventArgs args)
        {
            ThemeManager.ToDarkTheme();

            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (!settings.Contains("forecastCity") || !settings.Contains("forecastTown"))
            {
                this.NavigationService.Navigate(new Uri("/View/SelectCityPage.xaml", UriKind.Relative));
                return;
            }
            else
            {
                CityTown forecastCity = (CityTown)settings["forecastCity"];
                CityTown forecastTown = (CityTown)settings["forecastTown"];

                mForecastCityViewModel.ForecastCity = forecastTown;
                mMainPageViewModel.ForecastTown     = forecastTown;
                mMainPageViewModel.ForecastCity     = forecastCity;

                Navigation.ForecastCity = forecastTown;
                SetForecastViewModel();
            }

            GetCWBWeekdayForecast();
            Get72HrForecast();

            //TemptureItem.Width = TemptureItem.ActualWidth * 2;
            //PoPItem.Width = PoPItem.ActualWidth * 2;

            //if (NetworkInterface.GetIsNetworkAvailable())
            //{
            //    try
            //    {
            //        WebClient downloader = new WebClient();
            //        Uri rssUri = new Uri(XML_FOLDER + XML_WEEKDAY, UriKind.Absolute);
            //        downloader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnDownloaded);
            //        downloader.DownloadStringAsync(rssUri);
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("無法下載最新的天氣資訊!請檢查網路連線。");
            //        loadWeatherData();
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("無法下載最新的天氣資訊!請檢查網路連線。");
            //    loadWeatherData();
            //}
        }
        public IsolatedStorageSettingsControl(
            )
        {
            InitializeComponent();

            _settings = new IsolatedStorageSettings();

            enumEditControl =
                new EnumEditControl<IsolatedStorageScope>
                    (
                    _settings.IsolationScope
                    );

            enumEditControl.Top = useIsolatedStorageCheckBox.Bottom + 10;
            enumEditControl.Width = ClientRectangle.Width;
            enumEditControl.Height = ClientRectangle.Height - enumEditControl.Top;
            enumEditControl.Anchor = ((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right;

            Controls.Add(enumEditControl);
        }