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 override void ShowSystemWindow(SystemWindow systemWindow)
        {
            bool haveInitializedMainWindow = false;

            if (OsMappingWidgetFactory.PrimaryOsMappingWidget != null)
            {
                haveInitializedMainWindow = true;
            }

            if (!haveInitializedMainWindow)
            {
                if (systemWindow.UseOpenGL)
                {
                    OsMappingWidgetFactory.SetFactory(new WindowsFormsOpenGLFactory());
                }
                else
                {
                    OsMappingWidgetFactory.SetFactory(new WindowsFormsBitmapFactory());
                }
            }

            AbstractOsMappingWidget windowsFormsTopWindow = OsMappingWidgetFactory.CreateOsMappingWidget(systemWindow);

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

            systemWindow.AbstractOsMappingWidget = windowsFormsTopWindow;

            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 (haveInitializedMainWindow)
            {
                if (systemWindow.IsModal)
                {
                    windowsFormsTopWindow.ShowModal();
                }
                else
                {
                    windowsFormsTopWindow.Show();
                }
            }
            else
            {
                windowsFormsTopWindow.Run();
            }
        }
Exemplo n.º 3
0
        public void ShowSystemWindow(SystemWindow systemWindow)
        {
            // Set the active SystemWindow & PlatformWindow references
            systemWindow.PlatformWindow = this;

            systemWindow.AnchorAll();

            if (firstWindow)
            {
                firstWindow          = false;
                this.aggSystemWindow = systemWindow;

                this.Show();
            }
            else
            {
                systemWindow.Size = new Vector2(this.aggSystemWindow.Width, this.aggSystemWindow.Height);
            }
        }