Esempio n. 1
0
        public void ShowContentInWindow()
        {
            if (widgetWithPopContent.HasBeenClosed)
            {
                if (systemWindowWithPopContent != null)
                {
                    systemWindowWithPopContent.Close();
                }

                return;
            }

            if (systemWindowWithPopContent == null)
            {
                // So the window is open now only change this is we close it.
                UserSettings.Instance.Fields.SetBool(WindowLeftOpenKey, true);

                string windowSize = UserSettings.Instance.get(WindowSizeKey);
                int    width      = 600;
                int    height     = 400;
                if (windowSize != null && windowSize != "")
                {
                    string[] sizes = windowSize.Split(',');
                    width  = Math.Max(int.Parse(sizes[0]), (int)minSize.x);
                    height = Math.Max(int.Parse(sizes[1]), (int)minSize.y);
                }

                systemWindowWithPopContent                   = new SystemWindow(width, height);
                systemWindowWithPopContent.Padding           = new BorderDouble(3);
                systemWindowWithPopContent.Title             = windowTitle;
                systemWindowWithPopContent.AlwaysOnTopOfMain = true;
                systemWindowWithPopContent.BackgroundColor   = ActiveTheme.Instance.PrimaryBackgroundColor;
                systemWindowWithPopContent.Closing          += SystemWindow_Closing;
                if (widgetWithPopContent.Children.Count == 1)
                {
                    GuiWidget child = widgetWithPopContent.Children[0];
                    widgetWithPopContent.RemoveChild(child);
                    child.ClearRemovedFlag();
                    widgetWithPopContent.AddChild(CreateContentForEmptyControl());
                    systemWindowWithPopContent.AddChild(child);
                }
                systemWindowWithPopContent.ShowAsSystemWindow();

                systemWindowWithPopContent.MinimumSize = minSize;
                string desktopPosition = UserSettings.Instance.get(PositionKey);
                if (desktopPosition != null && desktopPosition != "")
                {
                    string[] sizes = desktopPosition.Split(',');

                    //If the desktop position is less than -10,-10, override
                    int xpos = Math.Max(int.Parse(sizes[0]), -10);
                    int ypos = Math.Max(int.Parse(sizes[1]), -10);
                    systemWindowWithPopContent.DesktopPosition = new Point2D(xpos, ypos);
                }
            }
            else
            {
                systemWindowWithPopContent.BringToFront();
            }
        }
 public static void ShowPrintLevelWizard(LevelWizardBase.RuningState runningState)
 {
     if (printLevelWizardWindow == null)
     {
         printLevelWizardWindow         = LevelWizardBase.CreateAndShowWizard(runningState);
         printLevelWizardWindow.Closed += (sender, e) =>
         {
             printLevelWizardWindow = null;
         };
     }
     else
     {
         printLevelWizardWindow.BringToFront();
     }
 }