HtmlBoxes.HtmlHost GetHtmlHost(AppHost host)
        {
            if (htmlHost == null)
            {
                htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host,
                                                                //1. img request
                                                                (s, e) =>
                {
                    //load resource -- sync or async?
                    string absolutePath = imgFolderPath + "\\" + e.ImageBinder.ImageSource;
                    if (!System.IO.File.Exists(absolutePath))
                    {
                        return;
                    }

                    //load create and load bitmap
                    e.ImageBinder.SetLocalImage(host.LoadImage(absolutePath));
                },
                                                                //2. stylesheet request
                                                                (s, e) =>
                {
                });
            }
            return(htmlHost);
        }
        HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
        {
            if (htmlHost == null)
            {
                htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                                //1. img request
                                                                (s, e) =>
                {
                    //load resource -- sync or async?
                    string absolutePath = imgFolderPath + "\\" + e.ImageBinder.ImageSource;
                    if (!System.IO.File.Exists(absolutePath))
                    {
                        return;
                    }

                    //load create and load bitmap
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(absolutePath);
                    e.ImageBinder.SetImage(new Bitmap(bmp.Width, bmp.Height, bmp));
                },
                                                                //2. stylesheet request
                                                                (s, e) =>
                {
                });
            }
            return(htmlHost);
        }
Exemple #3
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            ////==================================================
            //html box
            var           htmlHost  = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            var           htmlBox   = new HtmlBox(htmlHost, 800, 400);
            StringBuilder stbuilder = new StringBuilder();

            stbuilder.Append("<html><head></head><body>");
            stbuilder.Append("<div>custom box1</div>");
            stbuilder.Append("<x id=\"my_custombox1\"></x>");
            stbuilder.Append("<div>custom box2</div>");
            stbuilder.Append("<x type=\"textbox\" id=\"my_custombox1\"></x>");
            stbuilder.Append("</body></html>");
            htmlBox.LoadHtmlString(stbuilder.ToString());
            viewport.AddContent(htmlBox);
            //==================================================

            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);

            textbox.SetLocation(0, 200);
            viewport.AddContent(textbox);
            textbox.Focus();
        }
Exemple #4
0
        public virtual void OnStartDemo(SampleViewport viewport)
        {
            //html box
            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();

            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;


            var host = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                            (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                                                            contentMx_LoadStyleSheet);

            //1. htmlbox
            int viewportW = viewport.ViewportControl.Width;
            int viewportH = viewport.ViewportControl.Height;

            htmlBox = new HtmlBox(host, viewportW, viewportH);
            viewport.AddContent(htmlBox);



            if (htmltext == null)
            {
                htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }

            htmlBox.LoadHtmlString(htmltext);
        }
 HtmlBoxes.HtmlHost GetHtmlHost(AppHost host)
 {
     if (_htmlHost == null)
     {
         _htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
         var htmlBoxContentMx = new HtmlHostContentManager();
         var imgLoadingQ      = new LayoutFarm.ContentManagers.ImageLoadingQueueManager();
         imgLoadingQ.AskForImage         += contentMx_AskForImg;
         htmlBoxContentMx.ImgLoadingQueue = imgLoadingQ;
         htmlBoxContentMx.Bind(_htmlHost);
     }
     return(_htmlHost);
 }
Exemple #6
0
 HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
 {
     if (htmlHost == null)
     {
         htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
         var htmlBoxContentMx = new HtmlHostContentManager();
         var contentMx        = new LayoutFarm.ContentManagers.ImageContentManager();
         contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
         htmlBoxContentMx.AddImageContentMan(contentMx);
         htmlBoxContentMx.Bind(htmlHost);
     }
     return(htmlHost);
 }
Exemple #7
0
        protected override void OnStart(AppHost host)
        {
            {
                string html = @"<html><head></head><body><div>OK1</div><div>OK2</div></body></html>";


                string testFilename = @"D:\projects\HtmlRenderer\Source\Test8_HtmlRenderer.Demo\Samples\0_acid1_dev\00.htm";
                //string testFilename = "..\\Test8_HtmlRenderer.Demo\\Samples\\0_acid1_dev\\00.htm";
                if (System.IO.File.Exists(testFilename))
                {
                    html = System.IO.File.ReadAllText(testFilename);
                }


                //html box1
                HtmlBoxes.HtmlHost htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
                //html box
                var htmlBox = new HtmlBox(htmlhost, 800, 600);
                htmlBox.SetLocation(0, 0);
                //htmlBox.PreferSoftwareRenderer = true;
                host.AddChild(htmlBox);

                htmlBox.LoadHtmlString(html);
                //==================================================
            }
            {
                //html box2

                HtmlBoxes.HtmlHost htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
                //html box
                var htmlBox = new HtmlBox(htmlhost, 800, 400);
#if DEBUG
                htmlBox.dbugPreferSoftwareRenderer = true;
#endif
                htmlBox.SetLocation(0, 610);//**
                host.AddChild(htmlBox);
                string html = @"<html><head></head><body><div>OK3</div><div>OK4</div></body></html>";
                htmlBox.LoadHtmlString(html);
                //==================================================
            }

            //{
            //    //textbox
            //    var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 25, true);
            //    textbox.SetLocation(0, 0);
            //    host.AddChild(textbox);
            //    textbox.Focus();
            //}
        }
Exemple #8
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            this.htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            SetupHtmlMenuBox();
            //==================================================
            //box1 test area
            //html box
            this.testHtmlBox = new HtmlBox(htmlhost, 800, 400);
            testHtmlBox.SetLocation(30, 50);
            viewport.AddContent(testHtmlBox);
            string html = @"<html><head></head><body><div id='div1'>OK1</div><div>OK2</div></body></html>";

            testHtmlBox.LoadHtmlString(html);
            //==================================================
        }
        protected override void OnStart(AppHost host, IGameHTMLUI pcx)
        {
            _host         = host;
            this.htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
            SetupHtmlMenuBox();
            //==================================================
            //box1 test area
            //html box
            this.testHtmlBox = new HtmlBox(htmlhost, 800, 400);
            testHtmlBox.SetLocation(30, 50);
            host.AddChild(testHtmlBox);
            string html = @"<html><head></head><body><div id='div1'>OK1</div><div>OK2</div></body></html>";

            testHtmlBox.LoadHtmlString(html);
            //==================================================
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //html box
            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();

            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
            var host = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                            (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                                                            contentMx_LoadStyleSheet);

            htmlBox = new HtmlBox(host, 1024, 800);
            viewport.AddContent(htmlBox);
            if (htmltext == null)
            {
                htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }

            htmlBox.LoadHtmlString(htmltext);
        }
Exemple #11
0
        protected override void OnStart(AppHost host, IGameHTMLUI pcx)
        {
            htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
            ////==================================================
            //html box
            {
                HtmlBox lightHtmlBox = new HtmlBox(htmlHost, 800, 50);
                lightHtmlBox.SetLocation(50, 450);
                host.AddChild(lightHtmlBox);
                //light box can't load full html
                //all light boxs of the same lightbox host share resource with the host
                string html = @"<div>OK1</div><div>OK2</div>";
                //if you want to use full html-> use HtmlBox instead
                lightHtmlBox.LoadHtmlFragmentString(html);
            }
            //==================================================
            {
                HtmlBox lightHtmlBox2 = new HtmlBox(htmlHost, 800, 50);
                lightHtmlBox2.SetLocation(0, 60);
                host.AddChild(lightHtmlBox2);
                //light box can't load full html
                //all light boxs of the same lightbox host share resource with the host
                string html2 = @"<div>OK3</div><div>OK4</div>";
                //if you want to use ful l html-> use HtmlBox instead
                lightHtmlBox2.LoadHtmlFragmentString(html2);
            }
            //==================================================
            {
                HtmlBox lightHtmlBox3 = new HtmlBox(htmlHost, 800, 50);
                lightHtmlBox3.SetLocation(0, 100);
                host.AddChild(lightHtmlBox3);
                //fragment dom
                //create dom then to thie light box
                lightHtmlBox3.LoadHtmlDom(CreateSampleHtmlDoc());
            }
            //==================================================
            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 150, true);

            textbox.SetLocation(0, 200);
            host.AddChild(textbox);
            textbox.Focus();
        }
Exemple #12
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            ////==================================================
            //html box
            var htmlBox = new HtmlBox(htmlhost, 800, 400);

            htmlBox.SetLocation(30, 30);
            viewport.AddContent(htmlBox);
            string html = @"<html><head></head><body><div>OK1</div><div>OK2</div></body></html>";

            htmlBox.LoadHtmlString(html);
            //==================================================

            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);

            textbox.SetLocation(0, 200);
            viewport.AddContent(textbox);
            textbox.Focus();
        }
Exemple #13
0
        protected override void OnStart(AppHost host)
        {
            //html box
            _host = host;
            var loadingQueueMx = new LayoutFarm.ContentManagers.ImageLoadingQueueManager();

            loadingQueueMx.AskForImage += loadingQueue_AskForImg;

            HtmlBoxes.HtmlHost htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host,
                                                                               (s, e) => loadingQueueMx.AddRequestImage(e.ImageBinder),
                                                                               contentMx_LoadStyleSheet);

            //
            _htmlBox = new HtmlBox(htmlHost, 1024, 800);
            _htmlBox.SetLocation(0, 10); //test
            host.AddChild(_htmlBox);
            if (_htmltext == null)
            {
                _htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }
            _htmlBox.LoadHtmlString(_htmltext);
        }
Exemple #14
0
        protected override void OnStart(AppHost host)
        {
            {
                //html box1
                HtmlBoxes.HtmlHost htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
                //html box
                var htmlBox = new HtmlBox(htmlhost, 800, 400);
                htmlBox.SetLocation(0, 0);
                //htmlBox.PreferSoftwareRenderer = true;
                host.AddChild(htmlBox);
                string html = @"<html><head></head><body><div>OK1</div><div>OK2</div></body></html>";
                htmlBox.LoadHtmlString(html);
                //==================================================
            }
            {
                //html box2

                HtmlBoxes.HtmlHost htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null);
                //html box
                var htmlBox = new HtmlBox(htmlhost, 800, 400);
                htmlBox.PreferSoftwareRenderer = true;
                htmlBox.SetLocation(0, 420);//**
                host.AddChild(htmlBox);
                string html = @"<html><head></head><body><div>OK3</div><div>OK4</div></body></html>";
                htmlBox.LoadHtmlString(html);
                //==================================================
            }

            //{
            //    //textbox
            //    var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 25, true);
            //    textbox.SetLocation(0, 0);
            //    host.AddChild(textbox);
            //    textbox.Focus();
            //}
        }