当前位置: 首页>>代码示例>>C#>>正文


C# Window.IsDialog方法代码示例

本文整理汇总了C#中Window.IsDialog方法的典型用法代码示例。如果您正苦于以下问题:C# Window.IsDialog方法的具体用法?C# Window.IsDialog怎么用?C# Window.IsDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window.IsDialog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleWindow

	    /// <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;
	        if (!IsWindowOfIexploreProcess(window)) 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;
		        
                Logger.LogAction("Auto closing dialog with title: '{0}', text: {1}, style: ", window.Title, window.Message, window.StyleInHex);
		        window.ForceClose();
		    }
		}
开发者ID:kevinswarner,项目名称:Hover_OLD,代码行数:44,代码来源:DialogWatcher.cs

示例2: HandleWindow

 public void HandleWindow(Window window)
 {
     if (!window.IsDialog() || !this.HasDialogSameProcessNameAsBrowserWindow(window))
     return;
       DialogWatcher.WaitUntilVisibleOrTimeOut(window);
       lock (this)
       {
     foreach (IDialogHandler item_0 in (IEnumerable<IDialogHandler>) this._handlers)
     {
       try
       {
     if (item_0.CanHandleDialog(window, this.MainWindow.Hwnd))
     {
       if (item_0.HandleDialog(window))
         return;
     }
       }
       catch (Exception exception_0)
       {
     this.LastException = exception_0;
     Logger.LogAction((LogMessageCallback) (log => log("Exception was thrown while DialogWatcher called HandleDialog: {0}", new object[1]
     {
       (object) exception_0.ToString()
     })));
       }
     }
     if (!this.CloseUnhandledDialogs || !this.MainWindow.Equals((object) window.ToplevelWindow))
       return;
     Logger.LogAction((LogMessageCallback) (log => log("Auto closing dialog with title: '{0}', text: {1}, style: ", new object[3]
     {
       (object) window.Title,
       (object) window.Message,
       (object) window.StyleInHex
     })));
     window.ForceClose();
       }
 }
开发者ID:Workker,项目名称:EntregaRergressaoTestes,代码行数:37,代码来源:DialogWatcher.cs


注:本文中的Window.IsDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。