Example #1
0
 /// <summary>
 /// icon selected by mouse, called from EventPath
 /// </summary>
 /// <param name="ci"></param>
 public void OnComponentIconSelection(ComponentIcon ci)
 {
     if (!_loading)
     {
         listBoxActions.Items.Clear();
         ClassPointer       root = _panes.Loader.GetRootId();
         List <EventAction> eas  = root.EventHandlers;
         if (eas != null)
         {
             ComponentIconEventhandle h = ci as ComponentIconEventhandle;
             if (h != null)
             {
                 foreach (EventAction ea in eas)
                 {
                     if (ea.TaskIDList != null)
                     {
                         bool b = false;
                         foreach (TaskID tid in ea.TaskIDList)
                         {
                             HandlerMethodID hid = tid as HandlerMethodID;
                             if (hid != null)
                             {
                                 if (hid.ActionId == h.MethodId)
                                 {
                                     listBoxActions.Items.Add(tid);
                                     b = true;
                                     break;
                                 }
                             }
                         }
                         if (b)
                         {
                             break;
                         }
                     }
                 }
             }
             else
             {
                 Dictionary <UInt32, IAction> acts = root.GetActions();
                 if (acts != null)
                 {
                     ComponentIconMethod cim = ci as ComponentIconMethod;
                     if (cim != null)
                     {
                         foreach (IAction a in acts.Values)
                         {
                             if (a != null && a.IsPublic)
                             {
                                 CustomMethodPointer cmp = a.ActionMethod as CustomMethodPointer;
                                 if (cmp != null)
                                 {
                                     if (cmp.MemberId == cim.MethodId)
                                     {
                                         listBoxActions.Items.Add(a);
                                     }
                                 }
                             }
                         }
                     }
                     else
                     {
                         ComponentIconProperty cip = ci as ComponentIconProperty;
                         if (cip != null)
                         {
                             foreach (IAction a in acts.Values)
                             {
                                 if (a != null && a.IsPublic)
                                 {
                                     if (cip.Property.IsActionOwner(a))
                                     {
                                         listBoxActions.Items.Add(a);
                                     }
                                 }
                             }
                         }
                         else
                         {
                             ComponentIconClass cic = ci as ComponentIconClass;
                             if (cic != null)
                             {
                                 foreach (IAction a in acts.Values)
                                 {
                                     if (a != null && a.IsPublic)
                                     {
                                         if (cic.IsActionExecuter(a, root))
                                         {
                                             listBoxActions.Items.Add(a);
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 ComponentIconClassType cict = ci as ComponentIconClassType;
                                 if (cict != null)
                                 {
                                     foreach (IAction a in acts.Values)
                                     {
                                         if (a != null && a.IsPublic)
                                         {
                                             if (cict.IsActionExecuter(a, root))
                                             {
                                                 listBoxActions.Items.Add(a);
                                             }
                                         }
                                     }
                                 }
                                 else
                                 {
                                     ComponentIconEvent cie = ci as ComponentIconEvent;
                                     if (cie != null && cie.IsForComponent)
                                     {
                                         foreach (IAction a in acts.Values)
                                         {
                                             if (a != null && a.IsPublic)
                                             {
                                                 if (cie.IsActionExecuter(a, root))
                                                 {
                                                     listBoxActions.Items.Add(a);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
 public override bool IsActionExecuter(ComponentIconEvent obj)
 {
     if (obj.IsForComponent)
     {
         if (Actions.Count > 0)
         {
             foreach (TaskID tid in Actions)
             {
                 if (obj.IsActionExecuter(tid, tid.Action.Class))
                 {
                     return(true);
                 }
             }
         }
         return(false);
     }
     else
     {
         ComponentIconFireEvent cife = obj as ComponentIconFireEvent;
         if (cife != null)
         {
             if (Actions.Count > 0)
             {
                 foreach (TaskID tid in Actions)
                 {
                     if (!tid.IsEmbedded)
                     {
                         if (tid.Action == null)
                         {
                             tid.LoadActionInstance(this.RootPointer);
                         }
                         if (tid.Action != null)
                         {
                             FireEventMethod fe = tid.Action.ActionMethod as FireEventMethod;
                             if (fe != null)
                             {
                                 if (fe.EventId == cife.EventId && fe.MemberId == cife.FirerId)
                                 {
                                     return(true);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         else
         {
             ComponentIconClass cic = obj as ComponentIconClass;
             if (cic != null)
             {
                 if (Actions.Count > 0)
                 {
                     foreach (TaskID tid in Actions)
                     {
                         if (tid.Action == null)
                         {
                             tid.LoadActionInstance(this.RootPointer);
                         }
                         if (tid.Action != null)
                         {
                             ClassPointer cp = this.RootPointer.GetExternalExecuterClass(tid.Action);
                             if (cp != null)
                             {
                                 if (cp.ClassId == cic.ClassId)
                                 {
                                     return(true);
                                 }
                             }
                         }
                     }
                 }
             }
             else
             {
                 ComponentIconClassType cict = obj as ComponentIconClassType;
                 if (cict != null)
                 {
                     if (Actions.Count > 0)
                     {
                         foreach (TaskID tid in Actions)
                         {
                             if (tid.Action == null)
                             {
                                 tid.LoadActionInstance(this.RootPointer);
                             }
                             if (tid.Action != null)
                             {
                                 ActionAttachEvent aae = tid.Action as ActionAttachEvent;
                                 if (aae != null)
                                 {
                                     if (aae.Class.BaseClassType.Equals(cict.ClassType))
                                     {
                                         return(true);
                                     }
                                 }
                                 else if (tid.Action.ActionMethod != null)
                                 {
                                     DataTypePointer dtp = tid.Action.ActionMethod.Owner as DataTypePointer;
                                     if (dtp != null && dtp.BaseClassType != null)
                                     {
                                         if (dtp.BaseClassType.Equals(cict.ClassType))
                                         {
                                             return(true);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }