Exemplo n.º 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);
 }
Exemplo n.º 2
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");
 }
Exemplo n.º 3
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());
                    }
                }
            }
        }