Пример #1
0
        internal void ActivateInputPort(int portIndex, object value = null)
        {
            if (portIndex < 0 || portIndex >= this.Inputs.Count)
            {
                throw new ArgumentOutOfRangeException("portIndex");
            }
            FlowNodePort port = this.Inputs[portIndex];

            if (value == null && port.Type != NodePortType.Void)
            {
                throw new FlowGraphException("Cannot activate a node that requires a value without one.");
            }
            FlowNodePortActivationEventArgs eventArgs = new FlowNodePortActivationEventArgs
            {
                Name        = port.Name,
                DisplayName = port.DisplayName,
                Description = port.Description,
                Type        = port.Type,
                IsOutput    = false,
                Value       = value
            };

            this.OnActivated(eventArgs);
            this.Inputs[portIndex].Activate(value);
            this.OnPostActivated(eventArgs);
        }
Пример #2
0
 /// <summary>
 /// Raises event <see cref="PostActivated"/>.
 /// </summary>
 /// <param name="e">Details about the event.</param>
 protected virtual void OnPostActivated(FlowNodePortActivationEventArgs e)
 {
     if (this.PostActivated != null)
     {
         this.PostActivated(this, e);
     }
 }
Пример #3
0
        private void ActivateOutput <T>(int portIndex, T value, Action <IntPtr, int, T> activator)
        {
            FlowNodePort port = this.Outputs[portIndex];
            FlowNodePortActivationEventArgs eventArgs = new FlowNodePortActivationEventArgs
            {
                Name        = port.Name,
                DisplayName = port.DisplayName,
                Description = port.Description,
                Type        = port.Type,
                IsOutput    = true,
                Value       = value
            };

            this.OnActivated(eventArgs);
            activator(this.Handle, portIndex, value);
            this.OnPostActivated(eventArgs);
        }
Пример #4
0
        internal static void ActivateOutput(FlowGraphNode node, int portIndex)
        {
            FlowNodePort port = node.Outputs[portIndex];
            FlowNodePortActivationEventArgs eventArgs = new FlowNodePortActivationEventArgs
            {
                Name        = port.Name,
                DisplayName = port.DisplayName,
                Description = port.Description,
                Type        = port.Type,
                IsOutput    = true,
                Value       = null
            };

            node.OnActivated(eventArgs);
            Native.FlowNodeInterop.ActivateOutput(node.Handle, portIndex);
            node.OnPostActivated(eventArgs);
        }
Пример #5
0
 /// <summary>
 /// Raises event <see cref="PostActivated"/>.
 /// </summary>
 /// <param name="e">Details about the event.</param>
 protected virtual void OnPostActivated(FlowNodePortActivationEventArgs e)
 {
     if (this.PostActivated != null) this.PostActivated(this, e);
 }