Exemple #1
0
 public void UpdateXmlNode(XmlObjectWriter writer)
 {
     if (_xmlNode != null)
     {
         if (writer != null)
         {
             writer.WriteObjectToNode(_xmlNode, this);
         }
         else if (Writer != null)
         {
             _writer.WriteObjectToNode(_xmlNode, this);
         }
     }
 }
 protected override void OnSave(XmlNode node)
 {
     if (_methodPointer != null)
     {
         MathNodeRoot r = this.root;
         if (r != null)
         {
             XmlObjectWriter xw = r.Writer as XmlObjectWriter;
             if (xw != null)
             {
                 XmlNode nodeMethod = node.SelectSingleNode(XmlSerialization.XML_METHOD);
                 if (nodeMethod == null)
                 {
                     nodeMethod = node.OwnerDocument.CreateElement(XmlSerialization.XML_METHOD);
                     node.AppendChild(nodeMethod);
                 }
                 xw.WriteObjectToNode(nodeMethod, _methodPointer);
                 XmlUtil.SetAttribute(nodeMethod, XmlTags.XMLATT_NodeId, ID);
             }
             else
             {
                 throw new DesignerException("Writer not available calling MathNodeMethodPointer.OnSave");
             }
         }
     }
 }
 public virtual void UpdateXmlNode(XmlObjectWriter writer)
 {
     if (_xmlNode != null)
     {
         if (writer != null)
         {
             writer.WriteObjectToNode(_xmlNode, this);
             Changed = false;
         }
         else if (_writer != null)
         {
             _writer.WriteObjectToNode(_xmlNode, this);
             Changed = false;
         }
     }
 }
 protected override void OnSave(XmlNode node)
 {
     if (_valuePointer != null)
     {
         XmlObjectWriter xw = this.root.Serializer as XmlObjectWriter;
         if (xw != null)
         {
             //    try
             //    {
             //        ObjectIDmap map = (ObjectIDmap)MathNode.GetService(typeof(ObjectIDmap));
             //        XmlObjectWriter xw = new XmlObjectWriter(map);
             XmlNode nd = node.OwnerDocument.CreateElement(XmlTags.XML_Property);
             node.AppendChild(nd);
             xw.WriteObjectToNode(nd, _valuePointer);
             //        if (xw.HasErrors)
             //        {
             //            MathNode.Log(xw.ErrorCollection);
             //        }
             //    }
             //    catch (Exception e)
             //    {
             //        MathNode.Log(e);
         }
     }
 }
 public void OnChangeWithinMethod(bool withinmethod)
 {
     if (this.XmlData != null)
     {
         XmlObjectWriter writer = GetWriter();
         if (writer != null)
         {
             if (withinmethod)
             {
                 _xmlNodeChanged = XmlData.OwnerDocument.CreateElement(XmlData.Name);
                 writer.WriteObjectToNode(_xmlNodeChanged, this);
             }
             else
             {
                 writer.WriteObjectToNode(XmlData, this);
             }
         }
     }
 }
Exemple #6
0
 public void UpdateXmlNode(XmlObjectWriter writer)
 {
     if (_xmlNode != null)
     {
         if (writer != null)
         {
             writer.WriteObjectToNode(_xmlNode, this);
         }
         else
         {
             if (_writer == null)
             {
                 _writer = XmlSerializerUtility.GetWriter(_reader) as XmlObjectWriter;
             }
             if (_writer != null)
             {
                 _writer.WriteObjectToNode(_xmlNode, this);
             }
         }
     }
 }
        protected override void OnSave(XmlNode node)
        {
            XmlUtil.SetAttribute(node, XmlTags.XMLATT_NAME, _value);
            XmlUtil.SetAttribute(node, XMLATT_Subcript, _subscript);
            XmlUtil.SetAttribute(node, XmlTags.XMLATT_VARID, ID);
            XmlObjectWriter xw = this.root.Serializer as XmlObjectWriter;

            if (xw != null)
            {
                XmlNode nd = node.OwnerDocument.CreateElement(XML_ValueType);
                node.AppendChild(nd);
                xw.WriteObjectToNode(nd, VariableType);
            }
        }
Exemple #8
0
        public override void OnWriteToXmlNode(IXmlCodeWriter serializer, XmlNode node)
        {
            XmlUtil.SetLibTypeAttribute(node, this.GetType());
            base.OnWriteToXmlNode(serializer, node);
            XmlNode         eNode  = XmlUtil.CreateSingleNewElement(node, XML_Event);
            XmlObjectWriter writer = (XmlObjectWriter)serializer;

            writer.WriteObjectToNode(eNode, _event);
            if (_relativeLocation != Point.Empty)
            {
                XmlUtil.SetAttribute(node, XMLATTR_RELX, _relativeLocation.X);
                XmlUtil.SetAttribute(node, XMLATTR_RELY, _relativeLocation.Y);
            }
        }
 public void WriteToXmlNode(XmlObjectWriter writer, XmlNode node)
 {
     if (_valuePointer != null)
     {
         //try
         //{
         XmlNode nd = node.OwnerDocument.CreateElement(XmlTags.XML_Property);
         node.AppendChild(nd);
         writer.WriteObjectToNode(nd, _valuePointer);
         //    if (xw.HasErrors)
         //    {
         //        MathNode.Log(xw.ErrorCollection);
         //    }
         //}
         //catch (Exception e)
         //{
         //    MathNode.Log(e);
         //}
     }
 }
Exemple #10
0
        public void WriteToXmlNode(XmlObjectWriter writer, XmlNode node)
        {
            //
            XmlSerialization.WriteValueToChildNode(node, XML_RelativePosition, _label.RelativePosition.Location);
            XmlNode nd = node.SelectSingleNode(XML_RelativePosition);

            XmlSerialization.SetAttribute(nd, "xTo0", _label.RelativePosition.IsXto0);
            XmlSerialization.SetAttribute(nd, "yTo0", _label.RelativePosition.IsYto0);
            //
            XmlNode eNode = XmlUtil.CreateSingleNewElement(node, XML_Event);

            writer.WriteObjectToNode(eNode, _event);
            //
            XmlNode ndPos = XmlUtil.CreateSingleNewElement(node, XML_Position);

            XmlSerialization.WriteValueToChildNode(ndPos, XML_RelativePosition, RelativePosition.Location);
            nd = ndPos.SelectSingleNode(XML_RelativePosition);
            XmlSerialization.SetAttribute(nd, "xTo0", RelativePosition.IsXto0);
            XmlSerialization.SetAttribute(nd, "yTo0", RelativePosition.IsYto0);
            //
            if (_outPortList != null && _outPortList.Count > 0)
            {
                XmlNode portsNode = XmlUtil.CreateSingleNewElement(node, XML_OutPorts);
                foreach (EventPortOut port in _outPortList)
                {
                    XmlNode pNode = portsNode.OwnerDocument.CreateElement(XmlTags.XML_Item);
                    portsNode.AppendChild(pNode);
                    port.OnWriteToXmlNode(writer, pNode);
                }
            }
            if (_inPortList != null && _inPortList.Count > 0)
            {
                XmlNode portsNode = XmlUtil.CreateSingleNewElement(node, XML_InPorts);
                foreach (EventPortIn port in _inPortList)
                {
                    XmlNode pNode = portsNode.OwnerDocument.CreateElement(XmlTags.XML_Item);
                    portsNode.AppendChild(pNode);
                    port.OnWriteToXmlNode(writer, pNode);
                }
            }
        }
        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);
        }