control Html input logic
예제 #1
0
 HtmlInputEventAdapter GetInputEventAdapter()
 {
     if (inputEventAdapter == null)
     {
         inputEventAdapter = this.htmlhost.GetNewInputEventAdapter();
         inputEventAdapter.Bind(myHtmlCont);
     }
     return inputEventAdapter;
 }
예제 #2
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();
     htmlLayoutVisitor.Bind(htmlContainer);
     //------------------------------------------------------- 
     timer01.Interval = 20;//20ms?
     timer01.Tick += (s, e) =>
     {
         //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);
     //-------------------------------------------
 }