本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageSettings.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageSettings.Save方法的具体用法?C# IsolatedStorageSettings.Save怎么用?C# IsolatedStorageSettings.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.IsolatedStorage.IsolatedStorageSettings
的用法示例。
在下文中一共展示了IsolatedStorageSettings.Save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例2: StorageSetting
//constructor gets settings
public StorageSetting()
{
settings = IsolatedStorageSettings.ApplicationSettings;
if (!settings.Contains(RouteMode))
{
settings.Add(RouteMode, RouteModeDefault);
settings.Save();
}
}
示例3: MainPage
// コンストラクター
public MainPage()
{
InitializeComponent();
// ListBox コントロールのデータ コンテキストをサンプル データに設定します
DataContext = App.ViewModel;
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
store = IsolatedStorageSettings.ApplicationSettings;
#if DEBUG
store.Clear();
store.Save();
#endif
}
示例4: SaveCity
private void SaveCity(string city)
{
m_appSettings = IsolatedStorageSettings.ApplicationSettings;
if (m_appSettings.Contains("city"))
{
m_appSettings["city"] = city;
}
else
{
m_appSettings.Add("city", city);
}
m_appSettings.Save();
WebService.City = city;
}
示例5: AppSettings
public AppSettings(IsolatedStorageSettings settings)
{
if (settings == null)
throw new ArgumentNullException("settings");
_settings = settings;
_globalPass = new GlobalPassHandler(this);
if (!_settings.Contains(KEY_INSTANCE_ID))
{
_instanceId = Guid.NewGuid().ToString("N");
_settings[KEY_INSTANCE_ID] = _instanceId;
_settings.Save();
}
else
_instanceId = (string)_settings[KEY_INSTANCE_ID];
}
示例6: loadSettings
private void loadSettings()
{
settings = IsolatedStorageSettings.ApplicationSettings;
if (!settings.Contains("cm"))
{
cm = true;
settings.Add("cm", "1");
settings.Save();
}
else
{
string cmSetting = IsolatedStorageSettings.ApplicationSettings["cm"] as string;
if (cmSetting.Contains("1"))
{
cm = true;
}
else
{
cm = false;
}
}
if (settings.Contains("login"))
{
btnLogout.IsEnabled = true;
}
}
示例7: SaveOrUpdateSetting
/// <summary>
/// Private helper method for performing saves on settings
/// </summary>
/// <param name="store">The IsolatedStorageSettings store to use (either "site" or "application")</param>
/// <param name="key">The key of the object to save</param>
/// <param name="value">The value to be saved in storage</param>
private static void SaveOrUpdateSetting(IsolatedStorageSettings store, string key, object value)
{
if (store.Contains(key))
{
store[key] = value;
}
//Otheriwse, add this new key and its value to the store
else
{
store.Add(key, value);
}
store.Save();
}
示例8: 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 ();
}