protected override void OnGetActionNames(StringCollection sc, List <UInt32> usedBranches) { base.OnGetActionNames(sc, usedBranches); if (_actId != null) { HandlerMethodID hid = _actId as HandlerMethodID; if (hid != null) { if (hid.HandlerMethod != null) { hid.HandlerMethod.GetActionNames(sc); } } else { if (_actId.Action != null) { if (!string.IsNullOrEmpty(_actId.Action.ActionName)) { if (!sc.Contains(_actId.Action.ActionName)) { sc.Add(_actId.Action.ActionName); } } } } } }
public override bool CanActionBeLinked(TaskID act) { HandlerMethodID hid = act as HandlerMethodID; if (hid != null) { return(hid.ActionId == this.MethodId); } if (act.Action != null) { DataTypePointer dtp = act.Action.ActionMethod.Owner as DataTypePointer; if (dtp != null) { return(false); } ClassPointer cpr = this.RootPointer.GetExternalExecuterClass(act.Action); if (cpr != null) { return(false); } CustomMethodPointer cmp = act.Action.ActionMethod as CustomMethodPointer; if (cmp != null) { if (cmp.MemberId == MethodId) { return(true); } } } return(false); }
public override bool OnDeserialize(ClassPointer root, ILimnorDesigner designer) { List <EventAction> handlers = root.EventHandlers; if (handlers != null && handlers.Count > 0) { foreach (EventAction ea in handlers) { if (ea.TaskIDList != null && ea.TaskIDList.Count > 0) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hid = tid as HandlerMethodID; if (hid != null) { if (MethodId == hid.ActionId) { Init(designer, root); Method = hid.HandlerMethod; return(true); } } } } } } return(false); }
public override bool LoadToDesigner(List <uint> usedBranches, MethodDiagramViewer designer) { if (usedBranches.Contains(this.BranchId)) { return(false); } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { } } } } return(designer.LoadAction(this)); }
public override void LoadActionData(ClassPointer pointer, List <uint> usedBranches) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.LoadActionInstances(); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { } } } } }
public EventHandlerMethod GetHandlerMethod() { loadEventAction(); if (_eventAction != null) { HandlerMethodID hmid; EventHandlerMethod ehm = null; if (_eventAction.TaskIDList.Count > 0) { hmid = _eventAction.TaskIDList[0] as HandlerMethodID; if (hmid != null) { ehm = hmid.HandlerMethod; } } if (ehm == null) { hmid = new HandlerMethodID(); ehm = new EventHandlerMethod(_eventAction.RootPointer); hmid.HandlerMethod = ehm; _eventAction.TaskIDList.Clear(); _eventAction.TaskIDList.Add(hmid); } return(ehm); } return(null); }
public override void FindItemByType <T>(List <T> results) { EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { AB_SingleAction.ActionFindItemByType <T>(a, results); } } } } }
public override void SetActions(Dictionary <uint, IAction> actions, List <uint> usedBranches) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.LoadActionInstances(); } } else { IAction a; if (actions.TryGetValue(tid.ActionId, out a)) { if (a != null) { tid.SetAction(a); } } } } } }
protected override void OnGetActionNames(StringCollection sc, List <uint> usedBranches) { EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.GetActionNames(sc); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { string s = a.ActionName; if (!string.IsNullOrEmpty(s)) { if (!sc.Contains(s)) { sc.Add(s); } } } } } } }
public override void FindMethodByType <T>(List <T> results) { EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { object v = hmid.HandlerMethod; if (v is T) { results.Add((T)v); } } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { object v = a.ActionMethod; if (v is T) { results.Add((T)v); } } } } } }
public override void FindActionsByOwnerType <T>(List <IActionMethodPointer> results, List <UInt32> usedBranches, List <UInt32> usedMethods) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.FindActionsByOwnerType <T>(results, usedMethods); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { MethodClass.CollectActionsByOwnerType <T>(a, results, usedMethods); } } } } }
public override bool AllBranchesEndWithMethodReturnStatement() { EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod.IsMethodReturn) { return(true); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { if (a.IsMethodReturn) { return(true); } } } } } return(false); }
public override void CollectSourceValues(uint taskid, List <uint> usedBranches, MethodClass mc) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.CollectSourceValues(taskid); mc.AddUploads(hmid.HandlerMethod.UploadProperties); mc.AddDownloads(hmid.HandlerMethod.DownloadProperties); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { mc.AddUploads(a.GetClientProperties(taskid)); mc.AddDownloads(a.GetServerProperties(taskid)); } } } } }
public override bool UseClientServerValues(List <uint> usedBranches, bool client) { if (usedBranches.Contains(this.BranchId)) { return(false); } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { if (client) { if (hmid.HandlerMethod.UseClientValues()) { return(true); } } else { if (hmid.HandlerMethod.UseServerValues()) { return(true); } } } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { IList <ISourceValuePointer> l; if (client) { l = a.GetClientProperties(0); } else { l = a.GetServerProperties(0); } if (l != null && l.Count > 0) { return(true); } } } } } return(false); }
public override bool IsActionExecuter(TaskID tid, ClassPointer root) { HandlerMethodID hid = tid as HandlerMethodID; if (hid != null) { return(hid.ActionId == this.MethodId); } return(false); }
public override void GetActions(List <IAction> actions, List <uint> usedBranches) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { List <IAction> acts = hmid.HandlerMethod.GetActions(); if (acts != null && acts.Count > 0) { for (int i = 0; i < acts.Count; i++) { if (!containsAction(actions, acts[i].ActionId)) { actions.Add(acts[i]); } } } } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { if (!containsAction(actions, a.ActionId)) { actions.Add(a); } } } } } }
public override void GetCustomMethods(List <uint> usedBranches, List <MethodClass> list) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { if (!containsCustMethod(list, hmid.HandlerMethod.MethodID)) { list.Add(hmid.HandlerMethod); } } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { MethodClass mc = a.ActionMethod.MethodPointed as MethodClass; if (mc != null) { if (!containsCustMethod(list, mc.MethodID)) { list.Add(mc); } } } } } } }
public override IAction GetActionById(uint actId, List <uint> usedBranches) { if (usedBranches.Contains(this.BranchId)) { return(null); } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { IAction act = hmid.HandlerMethod.GetActionById(actId); if (act != null) { return(act); } } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { if (a.ActionId == actId) { return(a); } } } } } return(null); }
public override void GetActionsUseLocalVariable(List <UInt32> usedBranches, UInt32 varId, Dictionary <UInt32, IAction> actions) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.GetActionsUseLocalVariable(varId, actions); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { if (!actions.ContainsKey(a.ActionId)) { if (ClassPointer.IsRelatedAction(varId, a.CurrentXmlData)) { actions.Add(a.ActionId, a); } } } } } } }
private void mi_removeAction(object sender, EventArgs e) { MenuItem mi = sender as MenuItem; if (mi != null) { ClassPointer root = _panes.Loader.GetRootId(); IAction act = mi.Tag as IAction; if (act != null) { root.AskDeleteAction(act, this.FindForm()); } else { TaskID tid = mi.Tag as TaskID; if (tid != null) { HandlerMethodID hid = tid as HandlerMethodID; if (hid != null) { root.AskDeleteMethod(hid.HandlerMethod, this.FindForm()); } else { if (tid.Action == null) { tid.LoadActionInstance(root); } if (tid.Action != null) { root.AskDeleteAction(tid.Action, this.FindForm()); } } } } } }
public override bool CanActionBeLinked(TaskID act) { HandlerMethodID hid = act as HandlerMethodID; if (hid == null) { if (act.Action == null) { act.LoadActionInstance(this.RootPointer); } if (act.Action != null) { ClassPointer cmp = this.RootPointer.GetExternalExecuterClass(act.Action); if (cmp != null) { if (_classId == act.Action.ExecuterClassId) { return(true); } } } } return(false); }
public override void ReplaceAction(List <uint> usedBranches, uint oldId, IAction newAct) { if (usedBranches.Contains(this.BranchId)) { return; } usedBranches.Add(this.BranchId); EventAction ea = AssignedActions; if (ea != null) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { if (hmid.HandlerMethod != null) { hmid.HandlerMethod.ReplaceAction(oldId, newAct); } } else { IAction a = tid.GetPublicAction(this.OwnerMethod.RootPointer); if (a != null) { if (oldId == a.ActionId) { tid.SetAction(newAct); tid.ActionId = newAct.ActionId; } } } } } }
public void OnEventIconSelection(EventIcon ei) { listBoxActions.Items.Clear(); ClassPointer root = _panes.Loader.GetRootId(); List <EventAction> eas = root.EventHandlers; if (eas != null) { foreach (EventAction ea in eas) { if (ei.Event.IsSameObjectRef(ea.Event)) { if (ea.TaskIDList != null) { foreach (TaskID tid in ea.TaskIDList) { if (tid.Action == null) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { } else { //it is a public action tid.SetAction(root.GetActionInstance(tid.ActionId)); } } listBoxActions.Items.Add(tid); } } break; } } } }
public override bool CanActionBeLinked(TaskID act) { HandlerMethodID hid = act as HandlerMethodID; if (hid == null) { if (act.Action == null) { act.LoadActionInstance(this.RootPointer); } if (act.Action != null) { DataTypePointer cmp = act.Action.ActionMethod.Owner as DataTypePointer; if (cmp != null) { if (cmp.BaseClassType.Equals(_type)) { return(true); } } } } return(false); }
public IList <ISourceValuePointer> GetServerVariables(ClassPointer root) { Dictionary <UInt32, IAction> actions = root.GetActions(); SourceValuePointerList svs = new SourceValuePointerList(); foreach (TaskID tid in Sect0) //check client action return values { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod; if (wceh != null) { hmid.HandlerMethod.SetActions(actions); List <IAction> acts = hmid.HandlerMethod.GetActions(); foreach (IAction act in acts) { if (act.ReturnReceiver != null) { ISourceValuePointer sv = act.ReturnReceiver as ISourceValuePointer; if (sv != null && sv.IsWebServerValue() && !sv.IsWebClientValue()) { svs.AddUnique(sv); } } } } } else { IAction a = tid.GetPublicAction(root); if (a != null) { if (a.ReturnReceiver != null) { ISourceValuePointer sv = a.ReturnReceiver as ISourceValuePointer; if (sv != null && sv.IsWebServerValue() && !sv.IsWebClientValue()) { svs.AddUnique(sv); } } } } } foreach (TaskID tid in Sect1) //check server action parameters { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod; if (wceh != null) { hmid.HandlerMethod.SetActions(actions); hmid.HandlerMethod.CollectSourceValues(tid.TaskId); // svs.AddUnique(hmid.HandlerMethod.DownloadProperties); // List <MethodClass> ml = new List <MethodClass>(); hmid.HandlerMethod.GetCustomMethods(ml); foreach (MethodClass m in ml) { m.CollectSourceValues(tid.TaskId); svs.AddUnique(m.DownloadProperties); } } } else { IAction a = tid.GetPublicAction(root); if (a != null && a.ActionMethod != null && a.ActionMethod.Owner != null) { IFormSubmitter fs = a.ActionMethod.Owner.ObjectInstance as IFormSubmitter; if (fs != null && fs.IsSubmissionMethod(a.ActionMethod.MethodName)) { continue; } svs.AddUnique(a.GetServerProperties(tid.TaskId)); ISourceValuePointer p = a.ReturnReceiver as ISourceValuePointer; if (p != null) { if (p.IsWebServerValue()) { svs.AddUnique(p); } } } } } //collect download (server) variables from client actions foreach (TaskID tid in Sect2) { HandlerMethodID hmid = tid as HandlerMethodID; if (hmid != null) { WebClientEventHandlerMethod wceh = hmid.HandlerMethod as WebClientEventHandlerMethod; if (wceh != null) { hmid.HandlerMethod.SetActions(actions); hmid.HandlerMethod.CollectSourceValues(tid.TaskId); // svs.AddUnique(hmid.HandlerMethod.DownloadProperties); // List <MethodClass> ml = new List <MethodClass>(); hmid.HandlerMethod.GetCustomMethods(ml); foreach (MethodClass m in ml) { m.CollectSourceValues(tid.TaskId); svs.AddUnique(m.DownloadProperties); } } } else { IAction a = tid.GetPublicAction(root); if (a != null) { svs.AddUnique(a.GetServerProperties(tid.TaskId)); } } } return(svs); }
/// <summary> /// this control is already added to Parent.Controls. /// 1. remove invalid inports /// 2. add missed EventPortIn /// </summary> /// <param name="viewer"></param> public override void Initialize(EventPathData eventData) { ClassPointer root = this.ClassPointer.RootPointer; List <EventAction> ehs = root.EventHandlers; if (ehs != null && ehs.Count > 0) { if (DestinationPorts == null) { DestinationPorts = new List <EventPortIn>(); } else { //remove invalid inport List <EventPortIn> invalidInports = new List <EventPortIn>(); foreach (EventPortIn pi in DestinationPorts) { bool bFound = false; foreach (EventAction ea in ehs) { if (pi.Event.IsSameObjectRef(ea.Event)) { if (pi.Event.IsSameObjectRef(ea.Event)) { if (ea.TaskIDList != null && ea.TaskIDList.Count > 0) { foreach (TaskID tid in ea.TaskIDList) { if (tid.IsEmbedded) { HandlerMethodID hid = tid as HandlerMethodID; if (hid != null) { if (hid.ActionId == this.MethodId) { bFound = true; break; } } } else { IAction a = root.GetActionInstance(tid.ActionId); //only public actions in map if (a != null) { CustomMethodPointer cmp = a.ActionMethod as CustomMethodPointer; if (cmp != null) { if (cmp.MemberId == this.MethodId) { bFound = true; break; } } } } } } } if (bFound) { break; } } } if (!bFound) { invalidInports.Add(pi); } } if (invalidInports.Count > 0) { foreach (EventPortIn pi in invalidInports) { DestinationPorts.Remove(pi); } } } //add missed EventPortIn foreach (EventAction ea in ehs) { if (ea.TaskIDList != null && ea.TaskIDList.Count > 0) { foreach (TaskID tid in ea.TaskIDList) { HandlerMethodID hid = tid as HandlerMethodID; if (hid != null) { if (hid.ActionId == this.MethodId) { bool bFound = false; foreach (EventPortIn pi in DestinationPorts) { if (pi.Event.IsSameObjectRef(ea.Event)) { bFound = true; break; } } if (!bFound) { EventPortIn pi = new EventPortIn(this); pi.Event = ea.Event; double x, y; ComponentIconEvent.CreateRandomPoint(Width + ComponentIconEvent.PortSize, out x, out y); pi.Location = new Point((int)(Center.X + x), (int)(Center.Y + y)); pi.SetLoaded(); pi.SaveLocation(); DestinationPorts.Add(pi); } } } else { //it is a root scope action IAction a = root.GetActionInstance(tid.ActionId); if (a == null) { MathNode.LogError(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Action [{0}] not found", tid)); } else { CustomMethodPointer cmp = a.ActionMethod as CustomMethodPointer; if (cmp != null) { if (cmp.MemberId == this.MethodId) { bool bFound = false; foreach (EventPortIn pi in DestinationPorts) { if (pi.Event.IsSameObjectRef(ea.Event)) { bFound = true; break; } } if (!bFound) { EventPortIn pi = new EventPortIn(this); pi.Event = ea.Event; double x, y; ComponentIconEvent.CreateRandomPoint(Width + ComponentIconEvent.PortSize, out x, out y); pi.Location = new Point((int)(Center.X + x), (int)(Center.Y + y)); pi.SetLoaded(); pi.SaveLocation(); DestinationPorts.Add(pi); } } } } } } } } } }
public WebClientEventHandlerMethod(HandlerMethodID taskId) : base(taskId) { }
public WebClientEventHandlerMethodDownloadActions(HandlerMethodID taskId) : base(taskId) { }
public WebClientEventHandlerMethodServerActions(HandlerMethodID taskId) : base(taskId) { }
public EventHandlerMethod(HandlerMethodID taskId) : base(DesignUtil.LoadComponentClass(XmlObjectReader.CurrentProject, taskId.DataXmlNode.OwnerDocument.DocumentElement)) { }