Return to Snippet

Revision: 67046
at August 3, 2014 20:10 by vhdm


Initial Code
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";
            }
        }

Initial URL

                                

Initial Description
for save settings in windows phone

Initial Title
Window Phone Save Settings

Initial Tags
phone, windows

Initial Language
C#