public void CheckNewItemsDisabledByDefault() { bool shouldSave = false; if (string.IsNullOrEmpty(LastMaxId)) { if (DisabledItems.Count == 0) { foreach (string id in DisabledByDefault.Split(',')) { DisabledItems.Add(id); } } shouldSave = true; } else if (string.Compare(LastMaxId, MaxId, StringComparison.Ordinal) < 0) { foreach (string id in DisabledByDefault .Split(',') .Where(f => string.Compare(LastMaxId, f, StringComparison.Ordinal) < 0)) { DisabledItems.Add(id); } shouldSave = true; } if (shouldSave) { LastMaxId = MaxId; SaveSettingsToStorage(); } }
public void CheckNewItemsDisabledByDefault(IEnumerable <string> itemsDisabledByDefault) { bool shouldSave = false; if (string.IsNullOrEmpty(LastMaxId)) { if (DisabledItems.Count == 0) { foreach (string id in itemsDisabledByDefault) { DisabledItems.Add(id); } } shouldSave = true; } else if (string.CompareOrdinal(LastMaxId, MaxId) < 0) { foreach (string id in itemsDisabledByDefault) { if (string.CompareOrdinal(LastMaxId, id) < 0) { DisabledItems.Add(id); } } shouldSave = true; } if (shouldSave) { LastMaxId = MaxId; SaveSettingsToStorage(); } }
protected void SetIsEnabled(string id, bool isEnabled) { if (isEnabled) { DisabledItems.Remove(id); } else { DisabledItems.Add(id); } }