Exemple #1
0
 public override bool Equals(object other)
 {
     if (typeof(INodeDataBoolean).IsAssignableFrom(other.GetType()))
     {
         INodeDataBoolean objTmp = (INodeDataBoolean)other;
         return(objTmp.GetBool() == this.GetBool());
     }
     return(false);
 }
Exemple #2
0
        public ForkNode() : base(ForkNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecuteIn  = new ExecutionConnectorViewModel();
            conExecuteOut = new ExecutionConnectorViewModel();
            conIn         = new ConnectorViewModel("Set", typeof(NodeDataBoolean));

            this.InputExecutionConnectors.Add(conExecuteIn);
            this.OutputExecutionConnectors.Add(conExecuteOut);
            this.InputConnectors.Add(conIn);

            // State Values
            Value = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #3
0
        public ForkNode()
            : base(ForkNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecuteIn = new ExecutionConnectorViewModel();
            conExecuteOut = new ExecutionConnectorViewModel();
            conIn = new ConnectorViewModel("Set", typeof(NodeDataBoolean));

            this.InputExecutionConnectors.Add(conExecuteIn);
            this.OutputExecutionConnectors.Add(conExecuteOut);
            this.InputConnectors.Add(conIn);

            // State Values
            Value = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #4
0
        public override void Execute(object context)
        {
            if (conIn.IsConnected)
            {
                object newContext = new object(); // new exuction node, new execution context
                Value = conIn.AttachedConnections.Select(connection =>
                {
                    try
                    {
                        object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                        if (typeof(INodeDataBoolean).IsAssignableFrom(tmp.GetType()))
                        {
                            return((INodeDataBoolean)tmp);
                        }
                        return(null);
                    }
                    catch
                    {
                        return(null);
                    }
                }).Where(val => val != null).FirstOrDefault();
            }
            else
            {
                Value = null;
            }
            OnPropertyChanged("Note");

            if (Value != null && Value.GetBool())
            {
                foreach (ExecutionConnectionViewModel con in this.AttachedExecutionConnections)
                {
                    if (con.SourceConnector != null &&
                        con.SourceConnector.ParentNode == this &&
                        con.DestConnector != null &&
                        con.DestConnector.ParentNode != null)
                    {
                        con.DestConnector.ParentNode.Execute(new object());
                    }
                }
            }
        }
Exemple #5
0
 public int CompareTo(object obj)
 {
     if (typeof(INodeDataBoolean).IsAssignableFrom(obj.GetType()))
     {
         INodeDataBoolean objTmp = (INodeDataBoolean)obj;
         if (objTmp.GetBool() == this.GetBool())
         {
             return(0);
         }
         if (objTmp.GetBool())
         {
             return(-1);
         }
         if (this.GetBool())
         {
             return(1);
         }
     }
     throw new ArgumentException("Could not compare values");
 }
Exemple #6
0
        public override void Execute(object context)
        {
            if (conIn.IsConnected)
            {
                object newContext = new object(); // new exuction node, new execution context
                Value = conIn.AttachedConnections.Select(connection =>
                {
                    try
                    {
                        object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                        if (typeof(INodeDataBoolean).IsAssignableFrom(tmp.GetType())) return (INodeDataBoolean)tmp;
                        return null;
                    }
                    catch
                    {
                        return null;
                    }
                }).Where(val => val != null).FirstOrDefault();
            }
            else
            {
                Value = null;
            }
            OnPropertyChanged("Note");

            if(Value != null && Value.GetBool())
            foreach (ExecutionConnectionViewModel con in this.AttachedExecutionConnections)
            {
                if (con.SourceConnector != null &&
                    con.SourceConnector.ParentNode == this &&
                    con.DestConnector != null &&
                    con.DestConnector.ParentNode != null)
                {
                    con.DestConnector.ParentNode.Execute(new object());
                }
            }
        }