public override void ShowSystemWindow(SystemWindow systemWindow)
        {
            bool firstWindow = false;

            if (factoryToUse == null)
            {
                if (systemWindow.UseOpenGL)
                {
                    factoryToUse = new WindowsFormsOpenGLFactory();
                }
                else
                {
                    factoryToUse = new WindowsFormsBitmapFactory();
                }
                firstWindow = true;

                // When our top most window closes reset this so we can make a window in the future.
                systemWindow.Closed += (sender, e) =>
                {
                    factoryToUse = null;
                };
            }

            AbstractOsMappingWidget osMappingWindow = factoryToUse.CreateSurface(systemWindow);

            osMappingWindow.Caption = systemWindow.Title;
            osMappingWindow.AddChild(systemWindow);
            osMappingWindow.MinimumSize = systemWindow.MinimumSize;

            systemWindow.AbstractOsMappingWidget = osMappingWindow;

            if (pendingSetInitialDesktopPosition)
            {
                pendingSetInitialDesktopPosition = false;
                systemWindow.DesktopPosition     = InitialDesktopPosition;
            }

            systemWindow.AnchorAll();
            systemWindow.TitleChanged += new EventHandler(TitelChangedEventHandler);
            // and make sure the title is correct right now
            TitelChangedEventHandler(systemWindow, null);

            if (firstWindow)
            {
                osMappingWindow.Run();
            }
            else
            {
                if (systemWindow.IsModal)
                {
                    osMappingWindow.ShowModal();
                }
                else
                {
                    osMappingWindow.Show();
                    osMappingWindow.BringToFront();
                }
            }
        }
Exemplo n.º 2
0
        public static AbstractOsMappingWidget CreateOsMappingWidget(SystemWindow childSystemWindow)
        {
            if (factoryToUse == null)
            {
                throw new NotSupportedException("You must call 'SetGuiBackend' with a GuiFactory before you can create any surfaces");
            }

            AbstractOsMappingWidget osMappingWidget = factoryToUse.CreateSurface(childSystemWindow);

            if (primaryOsMappingWidget == null)
            {
                primaryOsMappingWidget = osMappingWidget;
            }

            return(osMappingWidget);
        }