当前位置: 首页>>代码示例>>C#>>正文


C# IsolatedStorageSettings.Clear方法代码示例

本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageSettings.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageSettings.Clear方法的具体用法?C# IsolatedStorageSettings.Clear怎么用?C# IsolatedStorageSettings.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.IsolatedStorage.IsolatedStorageSettings的用法示例。


在下文中一共展示了IsolatedStorageSettings.Clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainPage

        // コンストラクター
        public MainPage()
        {
            InitializeComponent();

            // ListBox コントロールのデータ コンテキストをサンプル データに設定します
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            store = IsolatedStorageSettings.ApplicationSettings;
#if DEBUG
            store.Clear();
            store.Save();
#endif
        }
开发者ID:numa08,项目名称:FollowMeAppForWinPhone,代码行数:14,代码来源:MainPage.xaml.cs

示例2: AppSettings

        private AppSettings()
        {
            if ( DesignerProperties.IsInDesignTool )
            {
                return; // doesn't work in Cider :(
            }

            settings = IsolatedStorageSettings.ApplicationSettings;
            #if DEBUG
            settings.Clear();
            #endif

            if ( !settings.Contains( IsFirstRunKey ) )
            {
                IsFirstRun = true;
            }

            if ( !settings.Contains( SpeedUnitKey ) )
            {
                SpeedUnit = CultureInfo.CurrentCulture.Name == "en-US" ? SpeedUnit.Miles : SpeedUnit.Kilometers;
            }

            if ( !settings.Contains( MapStatusKey ) )
            {
                MapStatus = MapStatus.On;
            }

            if ( !settings.Contains( IsSpeedAlertEnabledKey ) )
            {
                IsSpeedAlertEnabled = false;
            }

            if ( !settings.Contains( SpeedLimitKey ) )
            {
                SpeedLimit = SpeedUnit == SpeedUnit.Miles ? 65 : 100;
            }

            if ( !settings.Contains( AllowLocationAccessKey ) )
            {
                AllowLocationAccess = true;
            }
        }
开发者ID:ariesguy22,项目名称:SpeedoPlus,代码行数:42,代码来源:AppSettings.cs

示例3: Format

		public void Format (IsolatedStorageSettings settings, IsolatedStorageFile isf)
		{
			settings.Clear ();
			settings.Add ("a", 1);
			settings.Save ();

			Dictionary<string, object> dict = null;
			using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("__LocalSettings", FileMode.Open, isf)) {
				using (StreamReader sr = new StreamReader (fs)) {
					DataContractSerializer reader = new DataContractSerializer (typeof (Dictionary<string, object>));
					dict = (Dictionary<string, object>) reader.ReadObject (fs);
				}
			}

			Assert.AreEqual (1, dict.Count, "settings.Count");
			Assert.AreEqual (1, dict ["a"], "settings.a");
			dict ["b"] = 2;

			using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("__LocalSettings", FileMode.Create, isf)) {
				using (StreamReader sr = new StreamReader (fs)) {
					DataContractSerializer writer = new DataContractSerializer (dict.GetType ());
					writer.WriteObject (fs, dict);
				}
			}

			// saved but not re-loaded
			Assert.AreEqual (1, settings.Count, "Count");
			settings.Clear ();
		}
开发者ID:dfr0,项目名称:moon,代码行数:29,代码来源:IsolatedStorageSettingsTest.cs

示例4: CheckAll

		private void CheckAll (IsolatedStorageSettings settings)
		{
			settings.Clear ();
			try {
				CheckSettings (settings);
				CheckICollection (settings);
				CheckICollectionKeyPairValue (settings);
				CheckIDictionary (settings);
				CheckIDictionaryStringObject (settings);
			}
			finally {
				settings.Clear ();
			}
		}
开发者ID:dfr0,项目名称:moon,代码行数:14,代码来源:IsolatedStorageSettingsTest.cs

示例5: 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.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。