Ejemplo n.º 1
0
        private bool EnumChildForTridentDialogFrame(IntPtr hWnd, IntPtr lParam)
        {
            if (PopupDialog.IsWarningPopup(hWnd, DialogWatcher.WarningStyleInHex))
            {
                PopupDialog popupDialog = new PopupDialog(hWnd);
                popupDialogs.Add(popupDialog);
            }

            return(true);
        }
Ejemplo n.º 2
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();
                    }
                }
            }
        }