예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
 protected void SetIsEnabled(string id, bool isEnabled)
 {
     if (isEnabled)
     {
         DisabledItems.Remove(id);
     }
     else
     {
         DisabledItems.Add(id);
     }
 }