示例#1
0
        /// <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;
        }
示例#2
0
        private void EventPathOnPathInvalidated(object?sender, EventArgs e)
        {
            if (_reinitializing)
            {
                return;
            }

            _reinitializing = true;
            EventPath?.Dispose();
            Initialize();
            _reinitializing = false;
        }
示例#3
0
        /// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            _disposed = true;

            EventPath?.Dispose();

            foreach (DataModelConditionPart child in Children)
            {
                child.Dispose();
            }

            base.Dispose(disposing);
        }