public override bool Edit(UInt32 actionBranchId, Rectangle rcStart, ILimnorDesignerLoader loader, Form caller)
 {
     if (Owner == null)
     {
         Owner = loader.GetRootId();
     }
     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;
         }
         DlgMethod dlg = this.CreateMethodEditor(rcStart);
         dlg.LoadMethod(this, EnumParameterEditType.ReadOnly);
         if (dlg.EditSubAction(caller))
         {
             IsNewMethod = false;
             loader.GetRootId().SaveAction(this, loader.Writer);
             loader.NotifyChanges();
             return(true);
         }
     }
     catch (Exception err)
     {
         MathNode.Log(caller, err);
     }
     finally
     {
         ExitEditor();
         VPLUtil.CurrentRunContext = _origiContext;
     }
     return(false);
 }
예제 #2
0
 public override bool Edit(UInt32 actionBranchId, Rectangle rcStart, ILimnorDesignerLoader loader, Form caller)
 {
     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;
         }
         DlgMethod dlg = GetEditDialog(rcStart, loader);
         if (dlg.ShowDialog(caller) == DialogResult.OK)
         {
             OnFinishEdit(actionBranchId, loader);
             return(true);
         }
     }
     catch (Exception err)
     {
         MathNode.Log(caller, err);
     }
     finally
     {
         VPLUtil.CurrentRunContext = _origiContext;
     }
     return(false);
 }
        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);
        }