示例#1
0
        public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
        {
            if (!used.Contains(BranchId))
            {
                used.Add(BranchId);
                if (_actionList != null)
                {
                    ClassPointer list = designer.ActionEventCollection;
                    if (list != null)
                    {
                        for (int k = 0; k < _actionList.Count; k++)
                        {
                            TaskID tid = new TaskID(_actionList[k].ActionId, list.ClassId);
                            _actionList[k].Action = GetActionInstance(_actionList[k].ActionId);                            // list.GetAction(tid);

                            if (_actionList[k].Action == null)
                            {
                                _actionList[k].Action = designer.DesignerHolder.GetAction(tid);
                                if (_actionList[k].Action == null)
                                {
                                    DesignUtil.WriteToOutputWindowAndLog("Action data for {0} not found for [{1}] calling {2}.LoadToDesigner. You may delete it from the method and re-create it.", _actionList[k].ActionId, this.Name, this.GetType().Name);
                                }
                            }
                        }
                    }
                }
                return(designer.LoadAction(this));
            }
            return(false);
        }
示例#2
0
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (!used.Contains(this.BranchId))
     {
         used.Add(BranchId);
         if (_decisionTable != null)
         {
             ClassPointer list = designer.ActionEventCollection;
             if (list != null)
             {
                 for (int i = 0; i < _decisionTable.ConditionCount; i++)
                 {
                     if (_decisionTable[i].Actions != null)
                     {
                         for (int k = 0; k < _decisionTable[i].Actions.Count; k++)
                         {
                             _decisionTable[i].Actions[k].Action = this.ActionsHolder.GetActionInstance(_decisionTable[i].Actions[k].ActionId);
                             if (_decisionTable[i].Actions[k].Action == null)
                             {
                                 DesignUtil.WriteToOutputWindowAndLog("Action data for {0} not found [{1}] calling {1}.LoadToDesigner. You may delete it from the method and re-create it.", _decisionTable[i].Actions[k].ActionId, this.GetType().Name);
                             }
                         }
                     }
                 }
             }
         }
         return(designer.LoadAction(this));
     }
     return(false);
 }
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (!used.Contains(BranchId))
     {
         used.Add(BranchId);
         ActionSubMethod act = (ActionSubMethod)_actId.LoadActionInstance(this.ActionsHolder);
         if (act != null)
         {
             _actionData = act;
         }
         else
         {
             if (_actionData != null)
             {
                 _actId.SetAction(_actionData);
             }
         }
         if (_actionData == null)
         {
             _actionData = (ActionSubMethod)designer.DesignerHolder.GetAction(_actId);
         }
         if (_actionData == null)
         {
             DesignUtil.WriteToOutputWindowAndLog("Action data for {0} not found for [{1}] calling {2}.LoadToDesigner", ActionId, this.Name, this.GetType().Name);
         }
         return(designer.LoadAction(this));
     }
     return(false);
 }
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (!used.Contains(BranchId))
     {
         used.Add(BranchId);
         return(designer.LoadAction(this));
     }
     return(false);
 }
示例#5
0
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (base.LoadToDesigner(used, designer))
     {
         if (_jumpToActionBranch != null)
         {
             _jumpToActionBranch.LoadToDesigner(used, designer);
         }
         return(true);
     }
     return(false);
 }
示例#6
0
 /// <summary>
 /// create action components and make port links
 /// </summary>
 /// <param name="designer"></param>
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (!used.Contains(BranchId))
     {
         used.Add(BranchId);
         //this logic assumes _list is a single thread action string to be executed one by one
         if (_list != null && _list.Count > 0)
         {
             _list.LoadToDesignerAsSingleThread(designer);
         }
         return(true);
     }
     return(false);
 }
示例#7
0
 /// <summary>
 /// create action components and make port links
 /// </summary>
 /// <param name="designer"></param>
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (designer.LoadAction(this))
     {
         if (_ifActions != null)
         {
             if (_ifActions.LoadToDesigner(used, designer))
             {
                 //make port link
                 if (this.OutPortList[0].LinkedInPort == null)
                 {
                     LinkLineNode end = this.OutPortList[0].End;
                     ActionPortIn pi  = _ifActions.GetInPort(this.OutPortList[0].LinkedPortID, this.OutPortList[0].LinkedPortInstanceID);
                     if (pi == null)
                     {
                         throw new MathException("Out port {0} is linked to [{1},{2}] of Branch {3}; but [{1},{2}] is not among the in-ports of the branch", this.OutPortList[0].PortID, this.OutPortList[0].LinkedPortID, this.OutPortList[0].LinkedPortInstanceID, _ifActions.BranchId);
                     }
                     LinkLineNode start = pi.Start;
                     end.SetNext(start);
                     start.SetPrevious(end);
                 }
             }
         }
         if (_elseActions != null)
         {
             if (_elseActions.LoadToDesigner(used, designer))
             {
                 //make port link
                 if (this.OutPortList[1].LinkedInPort == null)
                 {
                     LinkLineNode end = this.OutPortList[1].End;
                     ActionPortIn pi  = _elseActions.GetInPort(this.OutPortList[1].LinkedPortID, this.OutPortList[1].LinkedPortInstanceID);
                     if (pi == null)
                     {
                         throw new MathException("Out port {0} is linked to [{1},{2}] of Branch {3}; but [{1},{2}] is not among the in-ports of the branch", this.OutPortList[1].PortID, this.OutPortList[1].LinkedPortID, this.OutPortList[1].LinkedPortInstanceID, _elseActions.BranchId);
                     }
                     LinkLineNode start = pi.Start;
                     end.SetNext(start);
                     start.SetPrevious(end);
                 }
             }
         }
         return(true);
     }
     return(false);
 }
示例#8
0
        public void LoadToDesignerAsSingleThread(MethodDiagramViewer designer)
        {
            if (this.Count == 0)
            {
                return;
            }
            List <UInt32> used = new List <uint>();

            for (int i = 0; i < this.Count; i++)
            {
                this[i].MakePortLinkForSingleThread(used, this);
            }
            used.Clear();
            for (int i = 0; i < this.Count; i++)
            {
                this[i].LoadToDesigner(used, designer);
            }
        }
示例#9
0
 public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
 {
     if (context != null && context.Instance != null)
     {
         MethodDiagramViewer mdv = context.Instance as MethodDiagramViewer;
         if (mdv != null)
         {
             WebClientEventHandlerMethod wcehm = mdv.Method as WebClientEventHandlerMethod;
             if (wcehm != null)
             {
                 if (string.CompareOrdinal("ReturnType", context.PropertyDescriptor.Name) == 0)
                 {
                     return(UITypeEditorEditStyle.None);
                 }
             }
         }
         DataTypePointer dp = context.Instance as DataTypePointer;
         if (dp != null)
         {
             if (dp.ReadOnly)
             {
                 return(UITypeEditorEditStyle.None);
             }
             ParameterClass pc = dp as ParameterClass;
             if (pc != null)
             {
                 ConstructorClass cc = pc.Method as ConstructorClass;
                 if (cc != null)
                 {
                     ClassPointer cp = cc.Owner as ClassPointer;
                     if (cp != null)
                     {
                         if (typeof(Attribute).IsAssignableFrom(cp.BaseClassType))
                         {
                             return(UITypeEditorEditStyle.DropDown);
                         }
                     }
                 }
             }
         }
     }
     return(UITypeEditorEditStyle.Modal);
 }
 /// <summary>
 /// create action component
 /// </summary>
 /// <param name="designer"></param>
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     if (_actionData == null)
     {
         ClassPointer root = designer.ActionEventCollection;
         if (root != null && _actId != null)
         {
             _actionData = _actId.LoadActionInstance(this.ActionsHolder);
         }
         if (_actionData == null && _actId != null)
         {
             _actionData = designer.DesignerHolder.GetAction(_actId);
         }
         if (_actionData == null)
         {
             DesignUtil.WriteToOutputWindowAndLog("Action data for {0} not found for [{1}] calling {2}.LoadToDesigner. You may delete the action from the method and re-create it.", ActionId, this.Name, this.GetType().Name);
         }
     }
     return(designer.LoadAction(this));
 }
示例#11
0
        public void LoadToDesigner(MethodDiagramViewer designer)
        {
            foreach (ActionBranch ab in this)
            {
                ab.IsNotForDesigner = false;
            }
            foreach (ActionBranch ab in this)
            {
                ab.OnBeforeLoadIntoDesigner(this);
            }
            List <UInt32> used = new List <uint>();

            foreach (ActionBranch ab in this)
            {
                if (!ab.IsNotForDesigner)
                {
                    ab.LoadToDesigner(used, designer);
                }
            }
        }
 public override bool LoadToDesigner(List <UInt32> used, MethodDiagramViewer designer)
 {
     return(designer.LoadAction(this));
 }
示例#13
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             DataTypePointer  typeScope = null;
             ITypeScopeHolder th        = context.Instance as ITypeScopeHolder;
             if (th != null)
             {
                 typeScope = th.GetTypeScope(context.PropertyDescriptor.Name);
             }
             if (typeScope == null)
             {
                 foreach (Attribute a in context.PropertyDescriptor.Attributes)
                 {
                     TypeScopeAttribute ts = a as TypeScopeAttribute;
                     if (ts != null && ts.Scope != null)
                     {
                         if (ts.Scope.IsGenericParameter)
                         {
                             Type[] ctps = ts.Scope.GetGenericParameterConstraints();
                             if (ctps != null && ctps.Length > 0)
                             {
                                 typeScope = new DataTypePointer(new TypePointer(ctps[0]));
                                 break;
                             }
                         }
                         else
                         {
                             typeScope = new DataTypePointer(new TypePointer(ts.Scope));
                             break;
                         }
                     }
                 }
             }
             MethodClass        scopeMethod = null;
             IScopeMethodHolder mh          = context.Instance as IScopeMethodHolder;
             if (mh != null)
             {
                 scopeMethod = mh.GetScopeMethod();
             }
             IWithProject mc = context.Instance as IWithProject;
             if (mc == null)
             {
                 ComponentInterfaceWrapper ciw = context.Instance as ComponentInterfaceWrapper;
                 if (ciw != null)
                 {
                     mc = ciw.Value as IWithProject;
                 }
             }
             if (mc == null)
             {
                 MathNode.Log(TraceLogClass.GetForm(provider), new DesignerException("{0} does not implement IWithProject", context.Instance.GetType()));
             }
             else
             {
                 if (mc.Project == null)
                 {
                     MathNode.Log(TraceLogClass.GetForm(provider), new DesignerException("Project not set for {0} [{1}]", mc, mc.GetType()));
                 }
                 else
                 {
                     MethodDiagramViewer mdv = mc as MethodDiagramViewer;
                     if (mdv != null)
                     {
                         WebClientEventHandlerMethod wcehm = mdv.Method as WebClientEventHandlerMethod;
                         if (wcehm != null)
                         {
                             if (string.CompareOrdinal("ReturnType", context.PropertyDescriptor.Name) == 0)
                             {
                                 return(value);
                             }
                         }
                     }
                     bool            isMethodReturn = false;
                     IObjectPointer  op             = value as IObjectPointer;
                     DataTypePointer val            = new DataTypePointer();
                     if (op != null)
                     {
                         val.SetDataType(op);
                     }
                     for (int i = 0; i < context.PropertyDescriptor.Attributes.Count; i++)
                     {
                         MethodReturnAttribute mra = context.PropertyDescriptor.Attributes[i] as MethodReturnAttribute;
                         if (mra != null)
                         {
                             isMethodReturn = true;
                             break;
                         }
                     }
                     //
                     bool                   bUseDropDown = false;
                     EnumWebRunAt           runAt        = EnumWebRunAt.Inherit;
                     PropertyClassWebClient pcwc         = context.Instance as PropertyClassWebClient;
                     if (pcwc != null)
                     {
                         bUseDropDown = true;
                         runAt        = EnumWebRunAt.Client;
                     }
                     else
                     {
                         PropertyClassWebServer pcws = context.Instance as PropertyClassWebServer;
                         if (pcws != null)
                         {
                             bUseDropDown = true;
                             runAt        = EnumWebRunAt.Server;
                         }
                     }
                     if (!bUseDropDown)
                     {
                         ParameterClass pc = context.Instance as ParameterClass;
                         if (pc != null)
                         {
                             ConstructorClass cc = pc.Method as ConstructorClass;
                             if (cc != null)
                             {
                                 ClassPointer cp = cc.Owner as ClassPointer;
                                 if (cp != null)
                                 {
                                     if (typeof(Attribute).IsAssignableFrom(cp.BaseClassType))
                                     {
                                         //use drop down
                                         bUseDropDown = true;
                                     }
                                 }
                             }
                         }
                     }
                     //
                     if (bUseDropDown)
                     {
                         TypeSelector drp = TypeSelector.GetAttributeParameterDialogue(service, runAt, val.BaseClassType);
                         service.DropDownControl(drp);
                         if (drp.SelectedType != null)
                         {
                             val.SetDataType(drp.SelectedType);
                             bool bIsForLocalType = false;
                             if (string.Compare(context.PropertyDescriptor.Name, ActionAssignInstance.Instance_Type, StringComparison.Ordinal) == 0)
                             {
                                 PropertiesWrapper pw = context.Instance as PropertiesWrapper;
                                 if (pw != null)
                                 {
                                     AB_SingleAction sa = pw.Owner as AB_SingleAction;
                                     if (sa != null)
                                     {
                                         ActionAssignInstance aa = sa.ActionData as ActionAssignInstance;
                                         if (aa != null)
                                         {
                                             bIsForLocalType = true;
                                             aa.SetParameterValue(ConstObjectPointer.VALUE_Type, drp.SelectedType);
                                         }
                                     }
                                 }
                             }
                             if (bIsForLocalType)
                             {
                             }
                             else
                             {
                                 value = val;
                             }
                         }
                     }
                     else
                     {
                         Type        typeAttr = null;
                         MethodClass mc0      = scopeMethod;
                         if (mc0 == null)
                         {
                             mc0 = mc as MethodClass;
                         }
                         if (mc0 == null)
                         {
                             MethodDiagramViewer mcv = mc as MethodDiagramViewer;
                             if (mcv != null)
                             {
                                 mc0 = mcv.Method;
                             }
                         }
                         if (mc0 != null)
                         {
                             if (mc.Project.ProjectType == EnumProjectType.WebAppPhp)
                             {
                                 if (mc0.WebUsage == EnumMethodWebUsage.Server)
                                 {
                                     typeAttr = typeof(PhpTypeAttribute);
                                 }
                                 else
                                 {
                                     typeAttr = typeof(JsTypeAttribute);
                                 }
                             }
                             else if (mc.Project.ProjectType == EnumProjectType.WebAppAspx)
                             {
                                 if (mc0.WebUsage == EnumMethodWebUsage.Client)
                                 {
                                     typeAttr = typeof(JsTypeAttribute);
                                 }
                             }
                         }
                         FrmObjectExplorer dlg = DesignUtil.GetDataTypeSelectionDialogue(mc.Project, scopeMethod, val, isMethodReturn, typeScope, typeAttr);
                         if (service.ShowDialog(dlg) == DialogResult.OK)
                         {
                             val.SetDataType(dlg.SelectedDataType);
                             bool bIsForLocalType = false;
                             if (string.Compare(context.PropertyDescriptor.Name, ActionAssignInstance.Instance_Type, StringComparison.Ordinal) == 0)
                             {
                                 PropertiesWrapper pw = context.Instance as PropertiesWrapper;
                                 if (pw != null)
                                 {
                                     AB_SingleAction sa = pw.Owner as AB_SingleAction;
                                     if (sa != null)
                                     {
                                         ActionAssignInstance aa = sa.ActionData as ActionAssignInstance;
                                         if (aa != null)
                                         {
                                             bIsForLocalType = true;
                                             aa.SetParameterValue(ActionAssignInstance.Instance_Type, dlg.SelectedDataType);
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 ComponentIconLocal cil = context.Instance as ComponentIconLocal;
                                 bIsForLocalType = (cil != null);
                                 if (bIsForLocalType)
                                 {
                                     cil.LocalPointer.ClassType = dlg.SelectedDataType;
                                 }
                             }
                             if (bIsForLocalType)
                             {
                             }
                             else
                             {
                                 ExceptionHandlerList.PropertyDescriptorExceptionHandler pdeh = context.PropertyDescriptor as ExceptionHandlerList.PropertyDescriptorExceptionHandler;
                                 if (pdeh != null)
                                 {
                                     pdeh.Handler.ExceptionType = val;
                                 }
                                 else
                                 {
                                     value = val;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }