SetHtmlContainerUpdateHandler() public method

public SetHtmlContainerUpdateHandler ( HtmlContainerUpdateHandler htmlContainerUpdateHandler ) : void
htmlContainerUpdateHandler HtmlContainerUpdateHandler
return void
コード例 #1
0
        public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
                                                        EventHandler <ContentManagers.ImageRequestEventArgs> imageReqHandler,
                                                        EventHandler <ContentManagers.TextRequestEventArgs> textReq)
        {
            HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost();
            htmlhost.SetRootGraphics(sampleViewport.Root);

            List <HtmlBoxes.HtmlContainer> htmlContUpdateList = new List <HtmlBoxes.HtmlContainer>();

            sampleViewport.Root.ClearingBeforeRender += (s, e) =>
            {
                //1.
                htmlhost.ClearUpdateWaitingCssBoxes();
                //1.
                int j = htmlContUpdateList.Count;
                for (int i = 0; i < j; ++i)
                {
                    var htmlCont = htmlContUpdateList[i];
                    htmlCont.RefreshDomIfNeed();
                    htmlCont.IsInUpdateQueue = false;
                }
                htmlContUpdateList.Clear();
            };
            htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));
            htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
            htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
            {
                if (!htmlCont.IsInUpdateQueue)
                {
                    htmlCont.IsInUpdateQueue = true;
                    htmlContUpdateList.Add(htmlCont);
                }
            });
            return(htmlhost);
        }
コード例 #2
0
 public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
     EventHandler<ContentManagers.ImageRequestEventArgs> imageReqHandler,
     EventHandler<ContentManagers.TextRequestEventArgs> textReq)
 {
     HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost();
     htmlhost.SetRootGraphics(sampleViewport.Root);
     htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));
     htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
     htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
     {
         sampleViewport.Root.AddToUpdateQueue(htmlCont);
     });
     return htmlhost;
 }
コード例 #3
0
        public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
                                                        EventHandler <ContentManagers.ImageRequestEventArgs> imageReqHandler,
                                                        EventHandler <ContentManagers.TextRequestEventArgs> textReq)
        {
            HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost(sampleViewport.P);
            htmlhost.SetRootGraphics(sampleViewport.Root);
            htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));

            htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
            htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
            {
                sampleViewport.Root.AddToUpdateQueue(htmlCont);
            });
            return(htmlhost);
        }
コード例 #4
0
ファイル: HtmlPanel.cs プロジェクト: asmboom/HtmlRenderer
        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(this.gfxPlatform);
            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(gfxPlatform.SampleIFonts);
            _htmlInputEventAdapter.Bind(htmlContainer);
            //-------------------------------------------
        }
コード例 #5
0
ファイル: HtmlPanel.cs プロジェクト: prepare/HTML-Renderer
 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);
     //-------------------------------------------
 }