bool IUserPreferencesHandler.DeletePreference(int locationId, string key, PreferenceTypes pref) { bool result; if (result = _preferences.RemoveIfContains(locationId, key, pref)) { IncrLocalChanges(); } return(result); }
public bool RemoveIfContains(int locationId, string key, PreferenceTypes pref) { Dictionary <PreferenceTypes, List <string> > subPrefs = null; List <string> subscribedKeys = null; if (!RawDataType.TryGetValue(locationId, out subPrefs)) { return(false); } else if (!subPrefs.TryGetValue(pref, out subscribedKeys)) { return(false); } return(subscribedKeys.Remove(key)); }
bool IUserPreferencesHandler.SetPreference(int locationId, string key, PreferenceTypes pref) { foreach (PreferenceTypes prefType in Enum.GetValues(typeof(PreferenceTypes))) { if (prefType == pref) { continue; } _preferences.RemoveIfContains(locationId, key, prefType); } bool result; if (result = _preferences.Add(locationId, key, pref)) { IncrLocalChanges(); } return(result); }
public List <string> GetSubscribedKeysOrInit(int locationId, PreferenceTypes pref) { Dictionary <PreferenceTypes, List <string> > subPrefs = null; List <string> subscribedKeys = null; if (!RawDataType.TryGetValue(locationId, out subPrefs)) { subPrefs = new Dictionary <PreferenceTypes, List <string> >(); subscribedKeys = new List <string>(); subPrefs[pref] = subscribedKeys; RawDataType[locationId] = subPrefs; } else if (!subPrefs.TryGetValue(pref, out subscribedKeys)) { subscribedKeys = new List <string>(); subPrefs[pref] = subscribedKeys; } return(subscribedKeys); }
IEnumerable <string> IUserPreferencesHandler.GetKeys(int locationId, PreferenceTypes pref) { return(_preferences.GetSubscribedKeysOrInit(locationId, pref).AsEnumerable()); }
public bool Add(int locationId, string key, PreferenceTypes pref) { GetSubscribedKeysOrInit(locationId, pref).Add(key); return(true); }
public bool DeletePreference(int locationId, string key, PreferenceTypes pref) { return(_userPrefsHandler.DeletePreference(locationId, key, pref)); }
public ResetPreferencesEventArgs(PreferenceTypes type) { Type = type; }