Пример #1
0
	    public virtual void Close()
		{
			var dialog = new Window(hwnd);
			if (dialog.Visible)
			{
				dialog.ForceClose();
			}
			base.Dispose(true);
		}
Пример #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()) return;
            
            // This is needed otherwise the window Style will return a "wrong" result.
            WaitUntilVisibleOrTimeOut(window);

		    // Lock the thread and see if a handler will handle
		    // this dialog window
           
		    lock (this)
		    {
                /*
               foreach (var dialogHandler in _handlers)
               {
                   try
                   {
                       if (dialogHandler.CanHandleDialog(window, MainWindowHwnd))
                       {
                           if (dialogHandler.HandleDialog(window)) return;
                       }
                   }
                   catch (Exception e)
                   {
                       LastException = e;

                       Logger.LogAction("Exception was thrown while DialogWatcher called HandleDialog: {0}",e.ToString());
                   }
               }
               */
		        // If no handler handled the dialog, see if the dialog
		        // should be closed automatically.
		       //if (!CloseUnhandledDialogs || MainWindowHwnd != window.ToplevelWindow.Hwnd) return;
                if (!CloseUnhandledDialogs ) return;
                //Logger.LogAction("Auto closing dialog with title: '{0}', text: {1}, style: ", window.Title, window.Message, window.StyleInHex);
		        try
		        {
                    window.ForceClose();
		        }
		        catch (Exception)
		        {
		           
		        }
               
		    }
		}