/ Published in: C#
for save settings in windows phone
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private static string key(string type, string key = "", string value = "") { string ret = string.Empty; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; try { switch (type) { case "add": settings.Add(key, value); settings.Save(); return "success"; case "remove": if (settings.Contains(key)) { settings.Remove(key); settings.Save(); return "success"; } else return "error"; case "update": if (settings.Contains(key)) { settings[key] = value; settings.Save(); return "success"; } else return "error"; case "select": if (settings.Contains(key)) return settings[key] as string; return "error"; case "is_key": if (settings.Contains(key)) return "success"; else return "error"; default: return "error"; } } catch (Exception ex) { MessageBox.Show(ex.Message); return "error"; } }