public void SetData(ILimnorDesignPane designer)
 {
     _designPane      = designer;
     _prj             = designer.Loader.Project;
     labelFolder.Text = _prj.ProjectFolder;
     labelIDE.Text    = Path.GetDirectoryName(Application.ExecutablePath);
 }
Esempio n. 2
0
        public bool Edit(XmlObjectWriter writer, IMethod context, Form caller, bool isNewAction)
        {
            LimnorProject        project = _class.Project;
            FormActionParameters dlgData = new FormActionParameters();

            if (_parameters == null)
            {
                _parameters = new ParameterValueCollection();
            }
            ActionMethod.ValidateParameterValues(_parameters);
            dlgData.SetScopeMethod(context);
            dlgData.LoadAction(this, _class.XmlData);
            DialogResult ret = dlgData.ShowDialog(caller);

            if (ret == DialogResult.OK)
            {
                _class.SaveAction(this, writer);
                ILimnorDesignPane pane = project.GetTypedData <ILimnorDesignPane>(_class.ClassId);
                if (pane != null)
                {
                    pane.OnActionChanged(_class.ClassId, this, isNewAction);
                    pane.OnNotifyChanges();
                }
                else
                {
                    DesignUtil.WriteToOutputWindowAndLog("Error editong ActionAssignInstance. ClassPointer [{0}] is not in design mode when creating an action. Please close the design pane and re-open it.", _class.ClassId);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        protected override IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane)
        {
            ActionBranchParameter        ab  = (ActionBranchParameter)ClassPointer;
            ActionBranchParameterPointer abp = new ActionBranchParameterPointer(ab, designPane.RootClass);

            abp.MethodId = MethodViewer.Method.MethodID;
            abp.BranchId = ActionBranch.BranchId;
            IClass op = data.Owner;

            data.ResetOwner(abp);
            try
            {
                IAction act = data.CreateMethodAction(designPane, abp, MethodViewer.Method, MethodViewer.ActionsHolder);
                if (act != null)
                {
                    act.ScopeMethod  = MethodViewer.Method;
                    act.ActionHolder = MethodViewer.ActionsHolder;
                }

                data.ResetOwner(op);
                return(act);
            }
            catch
            {
                throw;
            }
            finally
            {
                data.ResetOwner(op);
            }
        }
 public DesignObjects(UInt32 classId, ClassPointer rootPointer, ILimnorDesignPane pane, ObjectIDmap map)
 {
     _classId     = classId;
     _rootPointer = rootPointer;
     _pane        = pane;
     _map         = map;
 }
        public static DesignObjects RemoveDesignObjects(LimnorProject project, UInt32 classId)
        {
            ClassPointer rootPointer = null;

            if (project.HasTypedData <ClassPointer>(classId))
            {
                rootPointer = project.GetTypedData <ClassPointer>(classId);
            }
            ILimnorDesignPane pane = null;

            if (project.HasTypedData <ILimnorDesignPane>(classId))
            {
                pane = project.GetTypedData <ILimnorDesignPane>(classId);
            }
            ObjectIDmap map = null;

            if (project.HasTypedData <ObjectIDmap>(classId))
            {
                map = project.GetTypedData <ObjectIDmap>(classId);
            }
            DesignObjects obj = new DesignObjects(classId, rootPointer, pane, map);

            project.RemoveTypedData <ILimnorDesignPane>(classId);
            project.RemoveTypedData <ClassPointer>(classId);
            project.RemoveTypedData <ObjectIDmap>(classId);
            return(obj);
        }
Esempio n. 6
0
 private void buttonCopy_Click(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentCell != null && _dataTable != null)
     {
         if (dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < _dataTable.Rows.Count)
         {
             ILimnorDesignPane pane  = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId);
             ActionItem        ai    = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] as ActionItem;
             ActionItem        aiNew = ai.CreateNewCopy();
             ClassPointer      cp    = pane.RootClass;
             cp.SaveAction(aiNew.Action, pane.Loader.Writer);
             for (int i = 0; i < dataGridView1.Rows.Count; i++)
             {
                 dataGridView1.Rows[i].Selected = false;
             }
             _dataTable.Rows.Add(aiNew);
             dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
             propertyGrid1.SelectedObject = aiNew.Action;
             if (aiNew.Action != null)
             {
                 if (aiNew.Action.ParameterValues != null)
                 {
                     foreach (ParameterValue v in aiNew.Action.ParameterValues)
                     {
                         v.SetParameterValueChangeEvent(onActionChanged);
                     }
                 }
             }
         }
     }
 }
        public override ActionClass CreateSetPropertyAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            PropertyPointer pp = new PropertyPointer();

            pp.SetPropertyInfo(_val);
            pp.Owner = Owner;
            return(DesignUtil.CreateSetPropertyAction(pp, designPane, scopeMethod, actsHolder, designPane.PaneHolder.FindForm()));
        }
Esempio n. 8
0
 public void SetData(ILimnorDesignPane data)
 {
     _designPane = data;
     _folder     = _designPane.Loader.Project.ProjectFolder;
     _namespace  = _designPane.Loader.GetRootId().Namespace;
     if (string.IsNullOrEmpty(_namespace))
     {
         _namespace = _designPane.Loader.Namespace;
     }
 }
        public override IAction CreateMethodAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            IMethodPointer mi = DesignUtil.EditFrequentlyUsedMethodList(designPane.Loader.Project, designPane.RootXmlNode, _menuData, designPane, designPane.PaneHolder.FindForm());

            if (mi != null)
            {
                return(DesignUtil.OnCreateAction(holder, mi, scopeMethod, actsHolder, designPane.PaneHolder, designPane.RootXmlNode));
            }
            return(null);
        }
Esempio n. 10
0
        protected override IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane)
        {
            IAction act = data.CreateMethodAction(designPane, this.LocalPointer, MethodViewer.Method, MethodViewer.ActionsHolder);

            if (act != null)
            {
                act.ScopeMethod  = MethodViewer.Method;
                act.ActionHolder = MethodViewer.ActionsHolder;
            }
            return(act);
        }
        public void NotifyMethodChange(InterfaceElementMethod m)
        {
            ClassPointer cp = GetHolder();

            if (cp != null && _owner != null)
            {
                ILimnorDesignPane pane = cp.Project.GetTypedData <ILimnorDesignPane>(cp.ClassId);
                if (pane != null)
                {
                    _owner.NotifyMethodChange(pane.Loader, m);
                }
            }
        }
 private void miAssignEvent_Click(object sender, EventArgs e)
 {
     if (OnBeforeUseComponent())
     {
         EventPath ep = this.Parent as EventPath;
         if (ep != null)
         {
             ILimnorDesignPane dp   = ep.Panes.Loader.DesignPane;
             MenuItemDataEvent data = (MenuItemDataEvent)(((MenuItem)sender).Tag);
             data.ExecuteMenuCommand(ep.Project, this.ClassPointer, dp.RootXmlNode, ep.Panes, null, null);
         }
     }
 }
Esempio n. 13
0
 public void OnFinishEdit(UInt32 actionBranchId, ILimnorDesignerLoader loader)
 {
     try
     {
         ILimnorDesignPane dp = loader.DesignPane;
         if (dp == null)
         {
             throw new DesignerException("ILimnorDesignPane not found for class {0}", loader.GetRootId());
         }
         IEvent       ep = _event;
         EventAction  ea = null;                //event-actions mapping
         ClassPointer a  = loader.GetRootId();
         if (a != null)
         {
             List <EventAction> lst = a.EventHandlers;
             if (lst != null)
             {
                 foreach (EventAction e in lst)
                 {
                     if (e.GetAssignActionId() == actionBranchId && e.Event.IsSameObjectRef(ep))
                     {
                         ea = e;
                         break;
                     }
                 }
             }
         }
         if (ea == null)
         {
             ea       = new EventAction();
             ea.Event = ep;
             if (actionBranchId != 0)
             {
                 ea.SetAssignActionId(actionBranchId);
             }
         }
         _handlerOwner = ea;
         ea.AddAction(this);
         a.SaveEventHandler(ea);
         dp.OnNotifyChanges();
         dp.OnAssignAction(ea);
     }
     catch (Exception err)
     {
         MathNode.Log(TraceLogClass.MainForm, err);
     }
     finally
     {
         this.ExitEditor();
     }
 }
Esempio n. 14
0
 private void edit()
 {
     if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < _dataTable.Rows.Count)
     {
         ILimnorDesignPane pane    = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId);
         ActionItem        ai      = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] as ActionItem;
         List <IAction>    actList = DesignUtil.SelectAction(pane.Loader, ai.Action, null, false, _method, _method.CurrentActionsHolder, this.FindForm());
         if (actList != null && actList.Count > 0)
         {
             ai = new ActionItem(actList[0]);
             _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] = ai;
         }
     }
 }
 private void createNewAction(MenuItemDataMethod data)
 {
     if (OnBeforeUseComponent())
     {
         EventPath ep = this.Parent as EventPath;
         if (ep != null)
         {
             ILimnorDesignPane dp  = ep.Panes.Loader.DesignPane;
             IAction           act = data.CreateMethodAction(dp, this.ClassPointer, null, null);
             if (act != null)
             {
             }
         }
     }
 }
Esempio n. 16
0
        public void OnChanged()
        {
            if (_rootClass == null && _prj != null)
            {
                _rootClass = _prj.GetTypedData <ClassPointer>(_action.ClassId);
                _classId   = _action.ClassId;
            }
            _action.OnPropertyChanged("ActionMethod", null, _rootClass.XmlData, null);
            ILimnorDesignPane pane = _prj.GetTypedData <ILimnorDesignPane>(_classId);

            if (pane != null)
            {
                pane.Loader.NotifyChanges();
            }
        }
 private void miSetProperty_Click(object sender, EventArgs e)
 {
     if (OnBeforeUseComponent())
     {
         EventPath ep = this.Parent as EventPath;
         if (ep != null)
         {
             ILimnorDesignPane    dp   = ep.Panes.Loader.DesignPane;
             MenuItemDataProperty data = (MenuItemDataProperty)(((MenuItem)sender).Tag);
             ActionClass          act  = data.CreateSetPropertyAction(dp, ClassPointer, null, null);
             if (act != null)
             {
             }
         }
     }
 }
Esempio n. 18
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            ILimnorDesignPane pane = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId);

            if (pane != null)
            {
                List <IAction> actList = DesignUtil.SelectAction(pane.Loader, null, null, true, _method, _method.CurrentActionsHolder, this.FindForm());
                if (actList != null && actList.Count > 0)
                {
                    foreach (IAction act in actList)
                    {
                        _dataTable.Rows.Add(new ActionItem(act));
                    }
                }
            }
        }
Esempio n. 19
0
            public ComponentListControl(IWindowsFormsEditorService edSvc, IList <ComponentID> components, UInt32 selectedId, LimnorProject prj, bool isPageAddress, string pageAddr)
            {
                _srv = edSvc;
                ComponentID non = new ComponentID(prj, 0, "none", typeof(void), "");

                Items.Add(non);
                if (components != null)
                {
                    for (int i = 0; i < components.Count; i++)
                    {
                        if (typeof(WebPage).IsAssignableFrom(components[i].ComponentType))
                        {
                            ILimnorDesignPane pn = prj.GetTypedData <ILimnorDesignPane>(components[i].ComponentId);
                            if (pn != null)
                            {
                                IComponent ic = pn.RootClass.ObjectInstance as IComponent;
                                if (ic != null && ic.Site != null && ic.Site.DesignMode)
                                {
                                    if (!string.IsNullOrEmpty(ic.Site.Name))
                                    {
                                        components[i].Rename(ic.Site.Name);
                                    }
                                }
                            }
                            if (isPageAddress)
                            {
                                string pr = string.Format(CultureInfo.InvariantCulture, "{0}.html", components[i].ComponentName);
                                int    n  = Items.Add(pr);
                                if (string.Compare(pr, pageAddr, StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    SelectedIndex = n;
                                }
                            }
                            else
                            {
                                int n = Items.Add(components[i]);
                                if (components[i].ComponentId == selectedId)
                                {
                                    SelectedIndex = n;
                                }
                            }
                        }
                    }
                }
            }
Esempio n. 20
0
        private void createNewAction(MenuItemDataMethod data)
        {
            ILimnorDesignPane dp  = Designer.Project.GetTypedData <ILimnorDesignPane>(Designer.ObjectMap.ClassId);
            IAction           act = OnCreateAction(data, dp);

            if (act != null)
            {
                if (!(this.ClassPointer is LocalVariable))
                {
                    if (MethodEditContext.IsWebPage)
                    {
                        if (!MethodEditContext.CheckAction(act, this.FindForm()))
                        {
                            return;
                        }
                    }
                }
                MethodDiagramViewer mv = MethodViewer.GetCurrentViewer();
                act.ScopeMethod  = _methodClass;
                act.ActionHolder = MethodViewer.ActionsHolder;
                double x0, y0;
                ComponentIconEvent.CreateRandomPoint((double)((mv.Width - 20) / 2), out x0, out y0);
                if (x0 < 0)
                {
                    x0 = 10;
                }
                if (y0 < 0)
                {
                    y0 = 10;
                }
                ActionViewer av = MethodViewer.AddNewAction(act, new Point((mv.Width - 20) / 2 + (int)x0, (mv.Height - 20) / 2 + (int)y0));
                if (av.Parent == null)
                {
#if DEBUG
                    MessageBox.Show("Adding action viewer failed (1)");
#endif
                    mv.Controls.Add(av);
                }
                else
                {
                }
            }
        }
Esempio n. 21
0
        public bool Edit(XmlObjectWriter writer, IMethod context, Form caller, bool isNewAction)
        {
            IMathExpression mathExp = MathExp;

            if (mathExp != null)
            {
                ActionExecMath       a2       = (ActionExecMath)this.Clone();
                Rectangle            rc       = new Rectangle(0, 0, 100, 30);
                System.Drawing.Point curPoint = System.Windows.Forms.Cursor.Position;
                rc.X = curPoint.X;
                rc.Y = curPoint.Y;
                a2.MathExp.ScopeMethod = context;
                IMathEditor dlg = a2.MathExp.CreateEditor(rc);
                if (((Form)dlg).ShowDialog(caller) == DialogResult.OK)
                {
                    MathExpMethod mem = new MathExpMethod();
                    mem.Action         = this;
                    mem.MathExpression = dlg.MathExpression;
                    ActionMethod       = mem;
                    if (_class != null)
                    {
                        LimnorProject     project = _class.Project;
                        ILimnorDesignPane pane    = project.GetTypedData <ILimnorDesignPane>(_class.ClassId);
                        if (pane != null)
                        {
                            pane.OnActionChanged(_class.ClassId, this, isNewAction);
                            pane.OnNotifyChanges();
                        }
                        else
                        {
                            DesignUtil.WriteToOutputWindowAndLog("Error Editng ActionExecMath. ClassPointer [{0}] is not in design mode when creating an action. Please close the design pane and re-open it.", _class.ClassId);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
        public override IAction CreateMethodAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            ActionClass act = new ActionClass(designPane.RootClass);            //holder.Host);

            act.ActionMethod = _method.CreatePointer(holder);
            act.ActionName   = act.ActionMethod.DefaultActionName;
            act.ActionHolder = actsHolder;
            ClassPointer owner = holder.Host as ClassPointer;

            if (owner == null)
            {
                owner = Owner.Host as ClassPointer;
                if (owner == null)
                {
                    owner = _pointer;
                }
            }
            if (owner.CreateNewAction(act, designPane.Loader.Writer, scopeMethod, designPane.PaneHolder.FindForm()))
            {
                return(act);
            }
            return(null);
        }
        private void mi_delete(object sender, EventArgs e)
        {
            XmlNodeList nl = _root.XmlData.SelectNodes(string.Format(CultureInfo.InvariantCulture,
                                                                     "//{0}/{1}//*[@{2}='{3}']", XmlTags.XML_ACTIONS, XmlTags.XML_ACTION, XmlTags.XMLATT_ClassID, this.ClassPointer.ClassId));

            if (nl != null && nl.Count > 0)
            {
                MessageBox.Show(this.FindForm(), "Cannot delete this component. It is being used in actions", "Delete component", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                this.RemoveIcon();
                if (DataXmlNode != null)
                {
                    XmlNode np = DataXmlNode.ParentNode;
                    np.RemoveChild(DataXmlNode);
                }
                ILimnorDesignPane dp = _prj.GetTypedData <ILimnorDesignPane>(_root.ClassId);
                if (dp != null)
                {
                    dp.Loader.NotifyChanges();
                }
            }
        }
Esempio n. 24
0
 private void edit(int idx)
 {
     if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < _dataTable.Rows.Count)
     {
         if (idx == 0)
         {
             Rectangle    rc = dataGridView1.GetCellDisplayRectangle(dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, true);
             MathNodeRoot r  = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] as MathNodeRoot;
             r.ScopeMethod = _method;
             r.Project     = _prj;
             dlgMathEditor dlg = new dlgMathEditor(this.Parent.RectangleToScreen(rc));
             dlg.MathExpression = r;
             dlg.SetScopeMethod(_method);
             if (dlg.ShowDialog(this.FindForm()) == DialogResult.OK)
             {
                 r = (MathNodeRoot)dlg.MathExpression;
                 _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][0] = r;
             }
         }
         else
         {
             ActionList        aList = _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] as ActionList;
             ILimnorDesignPane pane  = _prj.GetTypedData <ILimnorDesignPane>(_method.ClassId);
             if (aList == null || aList.Count == 0)
             {
                 List <IAction> actList = DesignUtil.SelectAction(pane.Loader, null, null, true, _method, _method.CurrentActionsHolder, this.FindForm());
                 if (actList != null && actList.Count > 0)
                 {
                     aList      = new ActionList();
                     aList.Name = "Actions";                            // actList[0].ToString();
                     foreach (IAction act in actList)
                     {
                         aList.Add(new ActionItem(act));
                     }
                     _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] = aList;
                 }
                 else
                 {
                     return;
                 }
             }
             IMethodDialog        imd = this.FindForm() as IMethodDialog;
             MethodDesignerHolder v   = null;
             if (imd != null)
             {
                 v = imd.GetEditor();
             }
             DlgActionList dlg = new DlgActionList();
             dlg.LoadData(aList, _method, _prj, v);
             if (dlg.ShowDialog(this.FindForm()) == DialogResult.OK)
             {
                 aList = dlg.Result;
                 _dataTable.Rows[dataGridView1.CurrentCell.RowIndex][1] = aList;
                 if (v != null)
                 {
                     MethodDiagramViewer mv = v.GetCurrentViewer();
                     foreach (ActionItem a in aList)
                     {
                         if (a.Action != null && a.Action.Changed)
                         {
                             if (!mv.ChangedActions.ContainsKey(a.ActionId))
                             {
                                 mv.ChangedActions.Add(a.ActionId, a.Action);
                             }
                         }
                     }
                 }
             }
             else
             {
                 foreach (ActionItem a in aList)
                 {
                     if (a.Action != null && a.Action.Changed)
                     {
                         a.Action.ReloadFromXmlNode();
                     }
                 }
             }
         }
     }
 }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    MethodClass scopeMethod = context.Instance as MethodClass;
                    if (scopeMethod != null)
                    {
                        //this version only edit FinalActions
                        ILimnorDesignPane dp = scopeMethod.Project.GetTypedData <ILimnorDesignPane>(scopeMethod.RootPointer.ClassId);
                        if (dp != null)
                        {
                            //save the method contents
                            BranchList           bl         = scopeMethod.ActionList;
                            string               methodName = scopeMethod.MethodName;
                            ParameterClass       returnType = scopeMethod.ReturnValue;
                            List <ComponentIcon> icons      = scopeMethod.ComponentIconList;

                            //switch method contents
                            scopeMethod.ActionList = scopeMethod.FinalActions.Actions;
                            scopeMethod.SetName("FinalActions");
                            List <ComponentIcon> icons2 = new List <ComponentIcon>();
                            foreach (ComponentIcon ic in icons)
                            {
                                icons2.Add((ComponentIcon)ic.Clone());
                            }
                            foreach (ComponentIconSubscopeVariable ic in scopeMethod.FinalActions.ComponentIconList)
                            {
                                icons2.Add((ComponentIcon)ic.Clone());
                            }
                            scopeMethod.SetComponentIcons(icons2);
                            //
                            Rectangle rc = new Rectangle(Cursor.Position, new Size(32, 232));
                            if (scopeMethod.Owner == null)
                            {
                                scopeMethod.Owner = dp.Loader.GetRootId();
                            }
                            DlgMethod dlg = scopeMethod.CreateBlockScopeMethodEditor(rc, 1);
                            try
                            {
                                dlg.LoadMethod(scopeMethod, EnumParameterEditType.ReadOnly);
                                dlg.Text = string.Format(CultureInfo.InvariantCulture, "Specify final actionsfor {0}", methodName);
                                if (edSvc.ShowDialog(dlg) == DialogResult.OK)
                                {
                                    scopeMethod.FinalActions.Actions = scopeMethod.ActionList;
                                    List <ComponentIconSubscopeVariable> lst = new List <ComponentIconSubscopeVariable>();
                                    foreach (ComponentIcon ic in scopeMethod.ComponentIconList)
                                    {
                                        ComponentIconSubscopeVariable sv = ic as ComponentIconSubscopeVariable;
                                        if (sv != null)
                                        {
                                            lst.Add(sv);
                                        }
                                    }
                                    scopeMethod.FinalActions.ComponentIconList = lst;
                                    XmlObjectWriter xw = dp.Loader.Writer;
                                    xw.WriteObject(scopeMethod.FinalActions.DataXmlNode, scopeMethod.FinalActions, null);
                                    value = scopeMethod.FinalActions;
                                }
                            }
                            catch (Exception err)
                            {
                                MathNode.LogError(DesignerException.FormExceptionText(err));
                            }
                            finally
                            {
                                //restore method contents
                                scopeMethod.SetName(methodName);
                                scopeMethod.ActionList = bl;
                                scopeMethod.SetComponentIcons(icons);
                                scopeMethod.ExitEditor();
                            }
                        }
                    }
                }
            }
            return(value);
        }
        public override IAction CreateMethodAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            MethodInfoPointer mp = createPointer(designPane.PaneHolder, designPane.RootXmlNode);

            return(DesignUtil.OnCreateAction(holder, mp, scopeMethod, actsHolder, designPane.PaneHolder, designPane.RootXmlNode));
        }
Esempio n. 27
0
 public override ActionClass CreateSetPropertyAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
 {
     return(MenuItemDataPropertySelector.createAction(holder, _property, designPane.Loader.Writer, designPane.Loader.Node, scopeMethod, actsHolder, designPane.PaneHolder.FindForm()));
 }
        public override bool Edit(UInt32 actionBranchId, Rectangle rcStart, ILimnorDesignerLoader loader, Form caller)
        {
            if (this.Owner == null)
            {
                this.Owner = loader.GetRootId();
            }
            DlgMethod dlg = this.CreateMethodEditor(rcStart);

            try
            {
                _origiContext = VPLUtil.CurrentRunContext;
                if (loader.Project.IsWebApplication)
                {
                    if (this.RunAt == EnumWebRunAt.Client)
                    {
                        VPLUtil.CurrentRunContext = EnumRunContext.Client;
                    }
                    else
                    {
                        VPLUtil.CurrentRunContext = EnumRunContext.Server;
                    }
                }
                else
                {
                    VPLUtil.CurrentRunContext = EnumRunContext.Server;
                }
                dlg.LoadMethod(this, EnumParameterEditType.Edit);
                if (dlg.ShowDialog(caller) == DialogResult.OK)
                {
                    _display = null;
                    XmlNode nodeMethodCollection = loader.Node.SelectSingleNode(XmlTags.XML_CONSTRUCTORS);
                    if (nodeMethodCollection == null)
                    {
                        nodeMethodCollection = loader.Node.OwnerDocument.CreateElement(XmlTags.XML_CONSTRUCTORS);
                        loader.Node.AppendChild(nodeMethodCollection);
                    }
                    XmlNode nodeMethod = nodeMethodCollection.SelectSingleNode(
                        string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                      "{0}[@{1}='{2}']",
                                      XmlTags.XML_Item, XmlTags.XMLATT_MethodID, MemberId));
                    if (nodeMethod == null)
                    {
                        nodeMethod = nodeMethodCollection.OwnerDocument.CreateElement(XmlTags.XML_Item);
                        nodeMethodCollection.AppendChild(nodeMethod);
                    }
                    XmlUtil.SetAttribute(nodeMethod, XmlTags.XMLATT_MethodID, MemberId);
                    XmlUtil.SetAttribute(nodeMethod, XmlTags.XMLATT_NAME, Name);
                    XmlObjectWriter wr = loader.Writer;
                    wr.WriteObjectToNode(nodeMethod, this);
                    if (wr.HasErrors)
                    {
                        MathNode.Log(wr.ErrorCollection);
                    }
                    ILimnorDesignPane pane = loader.Project.GetTypedData <ILimnorDesignPane>(loader.ObjectMap.ClassId);

                    pane.OnNotifyChanges();
                    return(true);
                }
            }
            catch (Exception err)
            {
                MathNode.Log(caller, err);
            }
            finally
            {
                ExitEditor();
                VPLUtil.CurrentRunContext = _origiContext;
            }
            return(false);
        }
Esempio n. 29
0
 public void SetData(string folder, string defaultNamespace)
 {
     _folder     = folder;
     _namespace  = defaultNamespace;
     _designPane = null;
 }
 public override IAction CreateMethodAction(ILimnorDesignPane designPane, IClass holder, IMethod scopeMethod, IActionsHolder actsHolder)
 {
     throw new NotImplementedException("MethodItemWrapper.CreateMethodAction");
 }