Beispiel #1
0
 void editor_ReadyStateComplete(object sender, EventArgs e)
 {
     if (id != null && EdxDocument.GetEdxDocument.ViewLink != null) // probably nothing loaded
     {
         Interop.IHTMLDocument3 doc3 = (Interop.IHTMLDocument3)((Interop.IHTMLElement)EdxDocument.GetEdxDocument.ViewLink.DesignTimeElementView).GetDocument();
         backLinkNode = doc3.GetElementById(id);
         if (backLinkNode != null)
         {
             ve                 = new ViewElement(backLinkNode, editor);
             ve.Click          += new GuruComponents.Netrix.Events.DocumentEventHandler(ve_Click);
             ve.ControlSelect  += new GuruComponents.Netrix.Events.DocumentEventHandler(ve_ControlSelect);
             ve.PropertyChange += new GuruComponents.Netrix.Events.DocumentEventHandler(ve_PropertyChange);
         }
     }
 }
Beispiel #2
0
        public string Update()
        {
            doc3 = (Interop.IHTMLDocument3)((Interop.IHTMLElement)ViewLink.DesignTimeElementView).GetDocument();

            XmlNodeList edxNodes = xFrag.SelectNodes("//*[@id != '']", XmlnsFrag);

            object[] pVars = new object[1] {
                null
            };
            foreach (XmlNode edxNode in edxNodes)
            {
                XmlAttribute idAttribute = edxNode.Attributes["id"];
                string       id          = idAttribute.Value;
                edxNode.Attributes.Remove(idAttribute);
                Interop.IHTMLElement viewElement = doc3.GetElementById(id);
                if (viewElement != null)
                {
                    string s = viewElement.GetInnerHTML();

                    string Debug = viewElement.GetOuterHTML();

                    viewElement.GetAttribute("edxpath", 0, pVars);
                    string sPath = pVars[0].ToString();
                    if (String.IsNullOrEmpty(sPath))
                    {
                        continue;
                    }
                    // now rertieve the path to set to proper position
                    XmlNode xNode = edxNode.SelectSingleNode(sPath, XmlnsFrag);
                    if (xNode == null)
                    {
                        continue;
                    }
                    switch (xNode.NodeType)
                    {
                    case XmlNodeType.Attribute:
                        xNode.Value = s;
                        break;

                    case XmlNodeType.Element:
                        if (String.IsNullOrEmpty(s))
                        {
                            edxNode.ParentNode.RemoveChild(edxNode);
                        }
                        else
                        {
                            try
                            {
                                xNode.InnerXml = s;     // String.IsNullOrEmpty(s) ? "" : s;
                            }
                            catch (Exception ex)
                            {
                                xNode.InnerXml = ex.Message;
                            }
                        }
                        break;
                    }
                }
            }
            return(XmlDocument.OuterXml);
        }