示例#1
0
 public void Close()
 {
     Window dialog = new Window(hwnd);
     if (dialog.Visible)
     {
     dialog.ForceClose();
     }
 }
示例#2
0
        public void Close()
        {
            Window dialog = new Window(hwnd);

            if (dialog.Visible)
            {
                dialog.ForceClose();
            }
        }
示例#3
0
        /// <summary>
        /// If the window is a dialog and visible, it will be passed to
        /// the registered dialog handlers. I none if these can handle
        /// it, it will be closed if <see cref="CloseUnhandledDialogs"/>
        /// is <c>true</c>.
        /// </summary>
        /// <param name="window">The window.</param>
        public void HandleWindow(Window window)
        {
            if (window.IsDialog())
            {
                // Wait untill window is visible so all properties
                // of the window class (like Style and StyleInHex)
                // will return valid values.
                while (window.Visible == false)
                {
                    Thread.Sleep(50);
                }

                // Lock the thread and see if a handler will handle
                // this dialog window
                lock (this)
                {
                    foreach (IDialogHandler dialogHandler in handlers)
                    {
                        try
                        {
                            if (dialogHandler.HandleDialog(window))
                            {
                                return;
                            }
                        }
                        catch (Exception e)
                        {
                            lastException = e;
                        }
                    }

                    // If no handler handled the dialog, see if it
                    // should be close automatically.
                    if (CloseUnhandledDialogs &&
                        !PopupDialog.IsWarningPopup(window.Hwnd, InfoPathWarningStyleInHex))
                    {
                        window.ForceClose();
                    }
                }
            }
        }
        /// <summary>
        /// If the window is a dialog and visible, it will be passed to
        /// the registered dialog handlers. I none if these can handle
        /// it, it will be closed if <see cref="CloseUnhandledDialogs"/>
        /// is <c>true</c>.
        /// </summary>
        /// <param name="window">The window.</param>
        public void HandleWindow(Window window)
        {
            if (window.IsDialog())
            {
                // Wait untill window is visible so all properties
                // of the window class (like Style and StyleInHex)
                // will return valid values.
                while (window.Visible == false)
                {
                    Thread.Sleep(50);
                }

                // Lock the thread and see if a handler will handle
                // this dialog window
                lock (this)
                {
                    foreach (IDialogHandler dialogHandler in handlers)
                    {
                        try
                        {
                            if (dialogHandler.HandleDialog(window))
                            {
                                return;
                            }
                        }
                        catch (Exception e)
                        {
                            lastException = e;
                        }
                    }

                    // If no handler handled the dialog, see if it
                    // should be close automatically.
                    if (CloseUnhandledDialogs &&
                        !PopupDialog.IsWarningPopup(window.Hwnd, InfoPathWarningStyleInHex))
                    {
                        window.ForceClose();
                    }
                }
            }
        }