public DrawerControl CreateAndRunDrawerInStandaloneForm(VideoModes videoMode, DrawerSettings drawerSettings, Func <Form> formFactory) { FormDrawer drawer = CreateDrawer(videoMode, drawerSettings); DrawerControl drawerControl = null; var localsync = new ManualResetEventSlim(); var t = new Thread(() => { var form = formFactory(); drawerControl = new DrawerControl(drawer) { Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom }; form.Controls.Add(drawerControl); form.Shown += (o, e) => localsync.Set(); Application.Run(form); }); t.SetApartmentState(ApartmentState.STA); t.Start(); localsync.Wait(); if (drawer != null) { drawer.WaitForInitialization(); } return(drawerControl); }
public DrawerControl(FormDrawer drawer) : this() { Drawer = drawer; }