Beispiel #1
0
 void OnGenericSubscriptionChanged(ExtendedItemViewModel item, HashSet <string> itemKeys, bool newState)
 {
     if (newState)
     {
         itemFilter.Add(item);
         itemKeys.Add(item.Item.Id);
     }
     else
     {
         itemFilter.Remove(item);
         itemKeys.Remove(item.Item.Id);
     }
 }
Beispiel #2
0
 ExtendedItemViewModel FetchItemById(Core.Model.Filter.Item item, string id)
 {
     if (!allItemsStore.TryGetValue(id, out var itemVM))
     {
         var notificationState = notificationEngine.GetNotificationState(id);
         if (item != null)
         {
             itemVM = new ExtendedItemViewModel(item, notificationState);
         }
         else
         {
             itemVM = new ExtendedItemViewModel(id, notificationState);
         }
         allItemsStore[id] = itemVM;
     }
     return(itemVM);
 }
Beispiel #3
0
        public void OnSubscriptionChanged(ExtendedItemViewModel item, NotificationTarget target)
        {
            bool newState = item.NotificationState[target].NotificationEnabled;

            switch (target)
            {
            case NotificationTarget.Alert:
                OnGenericSubscriptionChanged(item, alertItemKeys, newState);
                break;

            case NotificationTarget.Invasion:
                OnGenericSubscriptionChanged(item, invasionItemKeys, newState);
                break;

            default:
                throw new NotImplementedException();
            }

            UpdateSettings(item.Item.Id, target, newState);
        }
Beispiel #4
0
 static bool EnabledFilter(ExtendedItemViewModel itemVM) => itemVM.Enabled;