當前位置: 首頁>>代碼示例>>C#>>正文


C# IsolatedStorageSettings.Remove方法代碼示例

本文整理匯總了C#中System.IO.IsolatedStorage.IsolatedStorageSettings.Remove方法的典型用法代碼示例。如果您正苦於以下問題:C# IsolatedStorageSettings.Remove方法的具體用法?C# IsolatedStorageSettings.Remove怎麽用?C# IsolatedStorageSettings.Remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.IsolatedStorage.IsolatedStorageSettings的用法示例。


在下文中一共展示了IsolatedStorageSettings.Remove方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DeleteSetting

 /// <summary>
 /// Private helper method for performing deletes on a setting
 /// </summary>
 /// <param name="store">The IsolatedStorageSettings store to use (either "site" or "application")</param>
 /// <param name="key">The key of the object to delete</param>
 private static void DeleteSetting(IsolatedStorageSettings store, string key)
 {
     if(store.Contains(key))
     {
         store.Remove(key);
         store.Save();
     }
 }
開發者ID:Aaronontheweb,項目名稱:isolatedstorage-extensions,代碼行數:13,代碼來源:IsolatedStorageHelper.Settings.cs

示例2: IsoStorageHelper

        public IsoStorageHelper()
        {
            settings = IsolatedStorageSettings.ApplicationSettings;

            //check if an unhandled exception occured last time
            if (getUnhandledException())//if yes
            {
                //show custom message box asking if user wants to submit feedback on it
                //TODO - ask user if they want to submit feedback on the issue
                //if yes, compose email with exception details
                //if no, close the app
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    CustomMessageBox messageBox = new CustomMessageBox()
                    {
                        Caption = "Uh-oh!  There was an error!",
                        Message = "Would you like to submit the error information to the developer? \n It would help speed up the process of fixing the issue!",
                        LeftButtonContent = "Yes",
                        RightButtonContent = "Nope",
                    };
                    messageBox.Dismissed += (s1, e1) =>
                    {
                        switch (e1.Result)
                        {
                            case CustomMessageBoxResult.LeftButton:
                                {
                                    //compose email
                                    new Feedback.FeedbackEmail(savedExceptionData);
                                    break;
                                }
                            case CustomMessageBoxResult.RightButton:
                                {
                                    break;
                                }
                            case CustomMessageBoxResult.None:
                                {
                                    break;
                                }
                            default:
                                {
                                    break;
                                }
                        }
                    };

                    messageBox.Show();
                });

                settings.Remove(Constants.IsolatedStorage.ISO_EXCEPTION);//clear the exception
            }
        }
開發者ID:Frannsoft,項目名稱:dnd35encyclopedia,代碼行數:51,代碼來源:IsoStorageHelper.cs

示例3: PodcastEpisodesDownloadManager

        private PodcastEpisodesDownloadManager()
        {
            createEpisodeDownloadDir();

            m_applicationSettings = IsolatedStorageSettings.ApplicationSettings;

            if (BackgroundTransferService.Requests.Count() == 0)
            {
                m_applicationSettings.Remove(App.LSKEY_PODCAST_EPISODE_DOWNLOADING_ID);
                m_currentBackgroundTransfer = null;
            }

            processOngoingTransfer();
            processStoredQueuedTransfers();
        }
開發者ID:kypeli,項目名稱:Podcatcher,代碼行數:15,代碼來源:PodcastEpisodesDownloadManager.cs

示例4: Delete

 public bool Delete(string key)
 {
     try
     {
         settings = IsolatedStorageSettings.ApplicationSettings;
         if ((string)settings[key] != null)
         {
             settings.Remove(key);
             return true;
         }
         else return false;
     }
     catch(KeyNotFoundException ex)
     {
         return false;
     }
 }
開發者ID:NatuLearn,項目名稱:NumbersGame,代碼行數:17,代碼來源:SettingsService.cs

示例5: Application_Launching

        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            Settings = IsolatedStorageSettings.ApplicationSettings;
            PushHelper = new PushHelper();
            GtalkClient = new GoogleTalk();

            if (!Settings.Contains("chatlog")) {
                Settings["chatlog"] = new Dictionary<string, List<Message>>();
            }
            if (!Settings.Contains("unread")) {
                Settings["unread"] = new Dictionary<string, int>();
            }
            if (!Settings.Contains("recent")) {
                Settings["recent"] = new ObservableCollection<Contact>();
            }

            Roster = new Roster();
            GtalkHelper = new GoogleTalkHelper();
            Roster.Load();

            RecentContacts = Settings["recent"] as ObservableCollection<Contact>;

            PushHelper.RegisterPushNotifications();

            InitAnalytics();

            if (Settings.Contains("lastError")) {
                var result = MessageBox.Show(
                    AppResources.CrashReport_Message,
                    AppResources.CrashReport_Title,
                    MessageBoxButton.OKCancel
                );

                if(result == MessageBoxResult.OK) {
                    GtalkClient.CrashReport(Settings["lastError"] as string, success => Settings.Remove("lastError"), error => {});
                } else {
                    Settings.Remove("lastError");
                }
            }
        }
開發者ID:pviral,項目名稱:gtalkchat,代碼行數:42,代碼來源:App.xaml.cs

示例6: CheckSettings

		public void CheckSettings (IsolatedStorageSettings settings)
		{
			Assert.AreEqual (0, settings.Count, "Empty-Count");
			Assert.AreEqual (0, settings.Keys.Count, "Empty-Keys.Count");
			Assert.AreEqual (0, settings.Values.Count, "Empty-Values.Count");

			settings.Add ("key", "value");
			Assert.Throws (delegate { settings.Add (null, "x"); }, typeof (ArgumentNullException), "Add(null,x)");
			Assert.Throws (delegate { settings.Add ("key", "another string"); }, typeof (ArgumentException), "Add(twice)");

			Assert.AreEqual (1, settings.Count, "Count");
			Assert.AreEqual (1, settings.Keys.Count, "Keys.Count");
			Assert.AreEqual (1, settings.Values.Count, "Values.Count");
			Assert.AreEqual (1, (settings as ICollection).Count, "ICollection.Count");

			Assert.IsTrue (settings.Contains ("key"), "Contains-key");
			Assert.IsFalse (settings.Contains ("value"), "Contains-value");
			Assert.Throws (delegate { settings.Contains (null); }, typeof (ArgumentNullException), "Contains(null)");

			Assert.AreEqual ("value", settings ["key"], "this[key]");
			settings ["key"] = null;
			Assert.IsNull (settings ["key"], "this[key]-null");
			Assert.Throws (delegate { Console.WriteLine (settings ["unexisting"]); }, typeof (KeyNotFoundException), "this[unexisting]");
			Assert.Throws (delegate { settings [null] = null; }, typeof (ArgumentNullException), "this[null] set");

			settings.Remove ("key");
			Assert.AreEqual (0, settings.Count, "Remove/Count");
			Assert.IsFalse (settings.Remove ("unexisting"), "Remove(unexisting)");
			Assert.Throws (delegate { settings.Remove (null); }, typeof (ArgumentNullException), "Remove(null)");

			settings.Add ("key", "value");
			Assert.AreEqual (1, settings.Count, "Add2/Count");

			string s;
			Assert.IsTrue (settings.TryGetValue<string> ("key", out s), "TryGetValue(key)");
			Assert.AreEqual ("value", s, "out value");
			object o;
			Assert.IsTrue (settings.TryGetValue<object> ("key", out o), "TryGetValue(object)");
			Assert.AreEqual ("value", s, "out value/object");
			Assert.IsFalse (settings.TryGetValue<string> ("value", out s), "TryGetValue(value)");
			Assert.Throws (delegate { settings.TryGetValue<string> (null, out s); }, typeof (ArgumentNullException), "TryGetValue(null)");

			settings.Clear ();
			Assert.AreEqual (0, settings.Count, "Clear/Count");
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:45,代碼來源:IsolatedStorageSettingsTest.cs


注:本文中的System.IO.IsolatedStorage.IsolatedStorageSettings.Remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。