protected override void UpdateTrigger() { var eventTrigger = EventTrigger; if (eventTrigger == null) { return; } MatchEventsFromTriggerIfNecessary(); RemovePendingEventsFromTrigger(); foreach (var kvp in targetValueMap) { var characteristic = kvp.Key; var triggerValue = kvp.Value; var newEvent = new HMCharacteristicEvent(characteristic, triggerValue); SaveTriggerGroup.Enter(); eventTrigger.AddEvent(newEvent, error => { if (error != null) { Errors.Add(error); } SaveTriggerGroup.Leave(); }); } SavePredicate(); }
// Removes an event from the map table if it's a new event and queues it for removal if it already existed in the event trigger. public void RemoveEvent (HMCharacteristicEvent e) { // Remove the characteristic from the target value map. targetValueMap.Remove (e.Characteristic); // If the given event is in the event array, queue it for removal. var eventTrigger = EventTrigger; if (eventTrigger != null && eventTrigger.CharacteristicEvents ().Contains (e)) removalCharacteristicEvents.Add (e); }
// Removes an event from the map table if it's a new event and queues it for removal if it already existed in the event trigger. public void RemoveEvent(HMCharacteristicEvent e) { // Remove the characteristic from the target value map. targetValueMap.Remove(e.Characteristic); // If the given event is in the event array, queue it for removal. var eventTrigger = EventTrigger; if (eventTrigger != null && eventTrigger.CharacteristicEvents().Contains(e)) { removalCharacteristicEvents.Add(e); } }
protected override void UpdateTrigger () { var eventTrigger = EventTrigger; if (eventTrigger == null) return; MatchEventsFromTriggerIfNecessary (); RemovePendingEventsFromTrigger (); foreach (var kvp in targetValueMap) { var characteristic = kvp.Key; var triggerValue = kvp.Value; var newEvent = new HMCharacteristicEvent (characteristic, triggerValue); SaveTriggerGroup.Enter (); eventTrigger.AddEvent (newEvent, error => { if (error != null) Errors.Add (error); SaveTriggerGroup.Leave (); }); } SavePredicate (); }