/// <summary> /// Updates the event the condition is triggered by /// </summary> public void UpdateEvent(DataModelPath?path) { if (_disposed) { throw new ObjectDisposedException("DataModelConditionEvent"); } if (path != null && !path.IsValid) { throw new ArtemisCoreException("Cannot update event to an invalid path"); } EventPath?.Dispose(); EventPath = path != null ? new DataModelPath(path) : null; SubscribeToEventPath(); CreateValueChangedEventIfNeeded(); // Remove the old root group that was tied to the old data model ClearChildren(); if (EventPath != null) { EventArgumentType = GetEventArgumentType(); // Create a new root group AddChild(new DataModelConditionGroup(this)); } else { EventArgumentType = null; } LastTrigger = GetDataModelEvent()?.LastTrigger ?? DateTime.Now; }
private void EventPathOnPathInvalidated(object?sender, EventArgs e) { if (_reinitializing) { return; } _reinitializing = true; EventPath?.Dispose(); Initialize(); _reinitializing = false; }
/// <inheritdoc /> protected override void Dispose(bool disposing) { _disposed = true; EventPath?.Dispose(); foreach (DataModelConditionPart child in Children) { child.Dispose(); } base.Dispose(disposing); }