Esempio n. 1
0
 public void SetHtmlHost(HtmlHost htmlhost)
 {
     this.htmlhost = htmlhost;//***
     htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
     {
         var updatedHtmlCont = htmlCont as MyHtmlContainer;
         if (updatedHtmlCont != null && !updatedHtmlCont.IsInUpdateQueue)
         {
             updatedHtmlCont.IsInUpdateQueue = true;
             waitingUpdateList.Add(updatedHtmlCont);
         }
     });
     htmlContainer = new MyHtmlContainer(htmlhost);
     htmlContainer.AttachEssentialHandlers(
         OnRefresh,
         myHtmlContainer_NeedUpdateDom,
         OnRefresh,
         null);
     //-------------------------------------------------------
     htmlLayoutVisitor = new LayoutVisitor(htmlhost.GetTextService());
     htmlLayoutVisitor.Bind(htmlContainer);
     //-------------------------------------------------------
     timer01.Interval = 20;//20ms?
     timer01.Tick    += (s, e) =>
     {
         //----------------------
         //TODO: not to run this
         //----------------------
         //clear waiting
         int j = waitingUpdateList.Count;
         for (int i = 0; i < j; ++i)
         {
             var htmlCont = waitingUpdateList[i];
             htmlCont.IsInUpdateQueue = false;
             htmlCont.RefreshDomIfNeed();
         }
         for (int i = j - 1; i >= 0; --i)
         {
             waitingUpdateList.RemoveAt(i);
         }
     };
     timer01.Enabled = true;
     //-------------------------------------------
     _htmlInputEventAdapter = new HtmlInputEventAdapter();
     _htmlInputEventAdapter.Bind(htmlContainer);
     //-------------------------------------------
 }
 //
 public MyHtmlVisualRoot(HtmlHost htmlhost)
 {
     _htmlhost    = htmlhost;
     _textService = htmlhost.GetTextService();
 }