Exemplo n.º 1
0
        public override LinkLineNodeOutPort CreateDuplicateOutPort()
        {
            EventPortOutExecuteMethod po = (EventPortOutExecuteMethod)base.CreateDuplicateOutPort();

            po.MethodId = this.MethodId;
            return(po);
        }
Exemplo n.º 2
0
 public static void SetDynamicEventHandlerLineColor(PortCollection pc)
 {
     foreach (LinkLineNodePort p in pc)
     {
         LinkLineNodeInPort ip = p as LinkLineNodeInPort;
         if (ip != null)
         {
             ComponentIconEventhandle ieh = ip.PortOwner as ComponentIconEventhandle;
             if (ieh != null)
             {
                 EventHandlerMethod ehm = ieh.Method as EventHandlerMethod;
                 if (ehm != null)
                 {
                     UInt32 actId = ehm.GetDynamicActionId();
                     if (actId != 0)
                     {
                         ip.SetLineColor(Color.Yellow);
                     }
                 }
             }
         }
         else
         {
             EventPortOutExecuteMethod op = p as EventPortOutExecuteMethod;
             if (op != null)
             {
                 EventHandlerMethod ehm = op.Method as EventHandlerMethod;
                 if (ehm != null)
                 {
                     UInt32 actId = ehm.GetDynamicActionId();
                     if (actId != 0)
                     {
                         op.SetLineColor(Color.Yellow);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        public static EventPortOut CreateOutPort(TaskID a, EventIcon owner)
        {
            EventPortOut        po  = null;
            CustomMethodPointer cmp = null;
            HandlerMethodID     hid = a as HandlerMethodID;

            if (hid != null)
            {
                EventPortOutExecuteMethod em = new EventPortOutExecuteMethod(owner);
                em.SetMethod(hid.HandlerMethod);
                po = em;
            }
            else
            {
                if (a.Action == null)
                {
                }
                else
                {
                    IEventMapSource eir  = owner as IEventMapSource;
                    ClassPointer    root = eir.RootPointer;
                    ClassPointer    cpre = root.GetExternalExecuterClass(a.Action);
                    if (a.Action.IsStatic && cpre != null)
                    {
                        EventPortOutClassTypeAction pct = new EventPortOutClassTypeAction(owner);
                        pct.SetOwnerClassPointer(cpre);
                        po = pct;
                    }
                    else if (a.Action.ActionMethod != null)
                    {
                        DataTypePointer dtp = a.Action.ActionMethod.Owner as DataTypePointer;
                        if (dtp != null)
                        {
                            EventPortOutTypeAction pot = new EventPortOutTypeAction(owner);
                            pot.SetOwnerType(dtp.BaseClassType);
                            po = pot;
                        }
                        else
                        {
                            cmp = a.Action.ActionMethod as CustomMethodPointer;
                            if (cmp != null && cmp.Holder.DefinitionClassId == a.ClassId)
                            {
                                EventPortOutExecuteMethod em = new EventPortOutExecuteMethod(owner);
                                MethodClass mc = cmp.MethodPointed as MethodClass;
                                if (mc != null)
                                {
                                    em.SetMethod(mc);
                                }
                                po = em;
                            }
                            else
                            {
                                po = null;
                                SetterPointer sp = a.Action.ActionMethod as SetterPointer;
                                if (sp != null)
                                {
                                    CustomPropertyPointer cpp = sp.SetProperty as CustomPropertyPointer;
                                    if (cpp != null)
                                    {
                                        EventPortOutSetProperty posp = new EventPortOutSetProperty(owner);
                                        posp.SetProperty(cpp.Property);
                                        posp.PropertyId = cpp.MemberId;
                                        po = posp;
                                    }
                                }
                                if (po == null)
                                {
                                    EventPortOutExecuter pe = new EventPortOutExecuter(owner);
                                    pe.ActionExecuterId = a.Action.ExecuterMemberId;
                                    po = pe;
                                }
                            }
                        }
                    }
                    else
                    {
                        ActionAttachEvent aae = a.Action as ActionAttachEvent;
                        if (aae != null)
                        {
                            EventPortOutExecuter pe = new EventPortOutExecuter(owner);
                            pe.ActionExecuterId = a.Action.ExecuterMemberId;
                            po = pe;
                        }
                    }
                }
            }
            if (po != null)
            {
                po.AddAction(a);
                ActiveDrawing ei = owner as ActiveDrawing;
                double        x, y;
                ComponentIconEvent.CreateRandomPoint(ei.Width + ComponentIconEvent.PortSize, out x, out y);
                po.Location = new Point((int)(ei.Center.X + x), (int)(ei.Center.Y + y));
                po.SetLoaded();
                po.SaveLocation();
            }
            return(po);
        }