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); }
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); }