public bool IsSameObjectRef(IObjectIdentity objectIdentity) { ActionExecMath aem = objectIdentity as ActionExecMath; if (aem != null) { return(aem.WholeActionId == this.WholeActionId); } return(false); }
public bool IsSameMethod(IAction act) { ActionExecMath ae = act as ActionExecMath; if (ae != null) { if (ae.WholeActionId == this.WholeActionId) { return(true); } } return(false); }
public virtual IAction CreateNewCopy() { ActionExecMath a = (ActionExecMath)Activator.CreateInstance(this.GetType(), _class); a._actId = (UInt32)(Guid.NewGuid().GetHashCode()); a._asLocal = _asLocal; a._desc = _desc; if (_mathExp != null) { a._mathExp = (MathExpMethod)_mathExp.Clone(); } if (string.IsNullOrEmpty(_name)) { a._name = "Action" + Guid.NewGuid().GetHashCode().ToString("x"); } else { if (_name.Length > 30) { a._name = _name.Substring(0, 30) + Guid.NewGuid().GetHashCode().ToString("x"); } else { a._name = _name + "_" + Guid.NewGuid().GetHashCode().ToString("x"); } } a.ScopeMethodId = ScopeMethodId; a.SubScopeId = SubScopeId; if (_parameters != null) { ParameterValueCollection ps = new ParameterValueCollection(); foreach (ParameterValue pv in _parameters) { pv.SetCloneOwner(a); ps.Add((ParameterValue)pv.Clone()); } a._parameters = ps; } return(a); }
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); }