Example #1
0
        public static void Show(string description = null, string link = null, bool showMatchingPages = false)
        {
            ClipboardEx.UseInternalClipboard(false);

            Form parentWindow = SkylineWindow;

            if (SkylineWindow != null)
            {
                SkylineWindow.UseKeysOverride = false;
            }
            else
            {
                parentWindow = AbstractFunctionalTest.FindOpenForm <StartPage>();
            }

            RunUI(parentWindow, () =>
            {
                var dlg = new PauseAndContinueForm(description, link, showMatchingPages)
                {
                    Left = parentWindow.Left
                };
                const int spacing = 15;
                var screen        = Screen.FromControl(parentWindow);
                if (parentWindow.Top > screen.WorkingArea.Top + dlg.Height + spacing)
                {
                    dlg.Top = parentWindow.Top - dlg.Height - spacing;
                }
                else if (parentWindow.Bottom + dlg.Height + spacing < screen.WorkingArea.Bottom)
                {
                    dlg.Top = parentWindow.Bottom + spacing;
                }
                else
                {
                    dlg.Top = parentWindow.Top;
                    if (parentWindow.Left > screen.WorkingArea.Top + dlg.Width + spacing)
                    {
                        dlg.Left = parentWindow.Left - dlg.Width - spacing;
                    }
                    else if (parentWindow.Right + dlg.Width + spacing < screen.WorkingArea.Right)
                    {
                        dlg.Left = parentWindow.Right + spacing;
                    }
                    else
                    {
                        // Can't fit on screen without overlap, so put in upper left of screen
                        // despite overlap
                        dlg.Top  = screen.WorkingArea.Top;
                        dlg.Left = screen.WorkingArea.Left;
                    }
                }
                dlg.Show(parentWindow);
            });

            lock (_pauseLock)
            {
                // Wait for an event on the pause lock, when the form is closed
                Monitor.Wait(_pauseLock);
                ClipboardEx.UseInternalClipboard();
                if (SkylineWindow != null)
                {
                    RunUI(SkylineWindow, () => SkylineWindow.UseKeysOverride = true);
                }
            }
        }
        public static void Show(string description = null, string link = null, bool showMatchingPages = false)
        {
            ClipboardEx.UseInternalClipboard(false);

            Form parentWindow = SkylineWindow;
            if (SkylineWindow != null)
                SkylineWindow.UseKeysOverride = false;
            else
                parentWindow = AbstractFunctionalTest.FindOpenForm<StartPage>();

            RunUI(parentWindow, () =>
            {
                var dlg = new PauseAndContinueForm(description, link, showMatchingPages) { Left = parentWindow.Left };
                const int spacing = 15;
                var screen = Screen.FromControl(parentWindow);
                if (parentWindow.Top > screen.WorkingArea.Top + dlg.Height + spacing)
                    dlg.Top = parentWindow.Top - dlg.Height - spacing;
                else if (parentWindow.Bottom + dlg.Height + spacing < screen.WorkingArea.Bottom)
                    dlg.Top = parentWindow.Bottom + spacing;
                else
                {
                    dlg.Top = parentWindow.Top;
                    if (parentWindow.Left > screen.WorkingArea.Top + dlg.Width + spacing)
                        dlg.Left = parentWindow.Left - dlg.Width - spacing;
                    else if (parentWindow.Right + dlg.Width + spacing < screen.WorkingArea.Right)
                        dlg.Left = parentWindow.Right + spacing;
                    else
                    {
                        // Can't fit on screen without overlap, so put in upper left of screen
                        // despite overlap
                        dlg.Top = screen.WorkingArea.Top;
                        dlg.Left = screen.WorkingArea.Left;
                    }
                }
                dlg.Show(parentWindow);
            });

            lock (_pauseLock)
            {
                // Wait for an event on the pause lock, when the form is closed
                Monitor.Wait(_pauseLock);
                ClipboardEx.UseInternalClipboard();
                if (SkylineWindow != null)
                    RunUI(SkylineWindow, () => SkylineWindow.UseKeysOverride = true);
            }
        }