示例#1
0
 public CefXmlReader(CefDomDocument cefDomDocument)
 {
     this.document         = cefDomDocument;
     this.rootNode         = document.GetDocument();
     this.nameTable        = new NameTable();
     this.namespaceManager = new XmlNamespaceManager(nameTable);
 }
示例#2
0
 protected override void Visit(CefDomDocument document)
 {
     // TODO: use some kind of automatic proxy destroying via node map?
     using (var body = document.GetBody())
     {
         var name = body.GetName();
         MainForm.SynchronizationContext.Post((_) =>
         {
             MessageBox.Show(name);
         }, null);
     }
 }
示例#3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.rootNode.Dispose();
         this.rootNode = null;
         this.document = null;
         //System.GC.Collect();
         //System.GC.WaitForPendingFinalizers();
     }
     base.Dispose(disposing);
 }
示例#4
0
 protected override void Visit(CefDomDocument document)
 {
     using (var xmlReader = new CefXmlReader(document))
     {
         try
         {
             Result = XDocument.Load(xmlReader);
         }
         catch (Exception e)
         {
             Exception = e;
         }
     }
 }
示例#5
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.currentNode != null)
         {
             this.currentNode.Dispose();
             this.currentNode = null;
         }
         foreach (var node in this.nodeStack)
         {
             node.Dispose();
         }
         this.nodeStack.Clear();
         this.document = null;
         //System.GC.Collect();
         //System.GC.WaitForPendingFinalizers();
     }
     base.Dispose(disposing);
 }
示例#6
0
 protected override void Visit(CefDomDocument document)
 {
     //var rootNode = document.GetDocument();
     //rootNode.AddEventListener("mouseover", new DomEventEventListener(), false);
     using (var xmlReader = new CefXmlReader(document))
     {
         XDocument dom = null;
         try
         {
             dom = XDocument.Load(xmlReader);
         }
         catch (Exception)
         {
             dom = null;
         }
         lock (FRenderer.FLock)
         {
             FRenderer.FCurrentDom = dom;
         }
     }
 }
示例#7
0
 // Called on UI thread
 internal void OnVisitDom(CefDomDocument document)
 {
     try
     {
         using (var xmlReader = new CefXmlReader(document))
         {
             var dom = XDocument.Load(xmlReader);
             lock (FLock)
             {
                 FCurrentDom = dom;
             }
         }
     }
     catch (Exception e)
     {
         lock (FLock)
         {
             FErrorText = e.ToString();
         }
     }
 }
示例#8
0
 protected override void Visit(CefDomDocument document)
 {
     CefDomNode element;
     switch (_businID)
     {
         case CwbBusinStyle.bsGetElementValue:
             
             Global.Result = "";
             element = document.GetElementById(_elementID);
             if (element == null)
             {
                 Global.flag = true;
                 return;
             }
             Global.Result = element.Value;
             if (element.ElementTagName.ToLower() != "input")
                 Global.Result = element.InnerText;
             Global.flag = true;
             break;
         case CwbBusinStyle.bsSetElementValue:
             element = document.GetElementById(_elementID);
             if (element == null) return;
             if (element.IsEditable)
                 element.SetAttribute("value", _elementValue);
             else
             {
                 string code = "document.getElementById('{0}').innerHTML = '{1}';";
                 code = string.Format(code,_elementID,_elementValue);
                 Global.instance.ExecuteScript(code);
             }
             break;
         case CwbBusinStyle.bsAddElementEvent:
             element = document.GetElementById(_item.id);
             if (element == null) return;
             element.AddEventListener(_item.eventName,new RSEventListener(_item.elementListener),true);
             break;
         case CwbBusinStyle.bsVisitDocument:
             Global.flag = false;
             CefDomNode root = document.Root;
             CwbElement Root = CreateElement(root);
             if (Global.RootList.ContainsKey(browser.Identifier))
             {
                 Global.RootList[ browser.Identifier ] = Root;
             }
             else
             {
                 Global.RootList.Add(browser.Identifier, Root);
             }
             string indexPath = "0";
             Root.IndexPath = indexPath;
             AppendAllChildElement(root, Root, indexPath);
             Global.flag = true;
             break;
         case CwbBusinStyle.bsAttachElementEvent:
             CefDomNode root1 = document.Root;
             string indexPath1 = "0";
             AttachEventHandler(root1, indexPath1, new RSEventListener(_item.elementListener));
             Global.flag = true;
             break;
     }
     _businID = CwbBusinStyle.bsNone;
 }
示例#9
0
 protected override void Visit(CefDomDocument document)
 {
     FRenderer.OnVisitDom(document);
 }
示例#10
0
 protected override void Visit(CefDomDocument document)
 {
     LogManager.WriteLog("===================");
     LogManager.WriteLog(document.Body.ToString());
     LogManager.WriteLog("===================");
 }