コード例 #1
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);
        }
コード例 #2
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);
        }