Example #1
0
        public static Form RunSpecificDemo(LayoutFarm.App demo,
                                           LayoutFarm.AppHost appHost,
                                           InnerViewportKind innerViewportKind = InnerViewportKind.GdiPlusOnGLES)
        {
            System.Drawing.Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
            Form formCanvas = LayoutFarm.UI.FormCanvasHelper.CreateNewFormCanvas(
                workingArea.Width,
                workingArea.Height,
                innerViewportKind,
                out GraphicsViewRoot viewroot);

#if DEBUG
            formCanvas.Text = innerViewportKind.ToString();
#endif


            formCanvas.FormClosed += (s, e) =>
            {
                demo.OnClosing();
                demo.OnClosed();
            };


            LayoutFarm.AppHostConfig config = new LayoutFarm.AppHostConfig();
            YourImplementation.UISurfaceViewportSetupHelper.SetUISurfaceViewportControl(config, viewroot);
            appHost.Setup(config);

            appHost.StartApp(demo);
            //
            //viewroot.TopDownRecalculateContent();
            //==================================================
            viewroot.PaintToOutputWindow();

            //formCanvas.WindowState = FormWindowState.Maximized;
            formCanvas.Show();
#if DEBUG
            if (dbugShowLayoutInspectorForm)
            {
                LayoutInspectorUtils.ShowFormLayoutInspector(viewroot);
            }
#endif

            //Application.Run(formCanvas);

            formCanvas.Show();
            return(formCanvas);
        }
Example #2
0
        public static Form RunSpecificDemo(LayoutFarm.App demo, LayoutFarm.AppHostWinForm appHost, InnerViewportKind innerViewportKind = InnerViewportKind.GdiPlusOnGLES)
        {
            System.Drawing.Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
            Form formCanvas = FormCanvasHelper.CreateNewFormCanvas(
                workingArea.Width,
                workingArea.Height,
                innerViewportKind,
                out UISurfaceViewportControl latestviewport);

#if DEBUG
            formCanvas.Text = innerViewportKind.ToString();
#endif

            formCanvas.FormClosed += (s, e) =>
            {
                demo.OnClosing();
                demo.OnClosed();
            };

            appHost.SetUISurfaceViewportControl(latestviewport);
            appHost.StartApp(demo);
            //
            latestviewport.TopDownRecalculateContent();
            //==================================================
            latestviewport.PaintMe();

            //formCanvas.WindowState = FormWindowState.Maximized;
            formCanvas.Show();
#if DEBUG
            if (dbugShowLayoutInspectorForm)
            {
                LayoutInspectorUtils.ShowFormLayoutInspector(latestviewport);
            }
#endif

            //Application.Run(formCanvas);

            formCanvas.Show();
            return(formCanvas);
        }
Example #3
0
        public static Form RunSpecificDemo(DemoAppInitInfo[] demoInitArr)
        {
            System.Drawing.Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;


            //1st form

            DemoAppInitInfo appInitInfo = demoInitArr[0];

            //
            Form formCanvas = FormCanvasHelper.CreateNewFormCanvas(
                appInitInfo.Area.Left,
                appInitInfo.Area.Top,
                appInitInfo.Area.Width,
                appInitInfo.Area.Height,
                appInitInfo.InnerViewportKind,
                out UISurfaceViewportControl latestviewport);



            latestviewport.PaintMe();
            {
                LayoutFarm.App demo = appInitInfo.App;

                var appHost = new LayoutFarm.AppHostWinForm();
                appHost.SetUISurfaceViewportControl(latestviewport);
                appHost.StartApp(demo);

                latestviewport.TopDownRecalculateContent();

                formCanvas.FormClosed += (s, e) =>
                {
                    demo.OnClosing();
                    demo.OnClosed();
                };
            }
            //==================================================

            for (int i = 1; i < demoInitArr.Length; ++i)
            {
                appInitInfo = demoInitArr[i];
                LayoutFarm.App demo = appInitInfo.App;

                FormCanvasHelper.CreateCanvasControlOnExistingControl(
                    formCanvas,
                    appInitInfo.Area.Left,
                    appInitInfo.Area.Top,
                    appInitInfo.Area.Width,
                    appInitInfo.Area.Height,
                    appInitInfo.InnerViewportKind,
                    out latestviewport);

                formCanvas.FormClosed += (s, e) =>
                {
                    demo.OnClosing();
                    demo.OnClosed();
                };

                latestviewport.PaintMe();
                var appHost = new LayoutFarm.AppHostWinForm();
                appHost.SetUISurfaceViewportControl(latestviewport);
                appHost.StartApp(demo);

                latestviewport.TopDownRecalculateContent();
            }

            formCanvas.Show();
            return(formCanvas);
        }