简体   繁体   English

C#WPF:Web浏览器模式对话框从Win32应用程序关闭

[英]C# WPF: webbrowser modal dialog close from win32 app

I am curious as to if this is even possible, but basically what I need is when opening a System.Windows.Forms.WebBrowser Modal Dialog from a WPF application I need to catch a value passed back from the page to WPF and keep a window up or close it based on the value that I return. 我很好奇这是否可能,但是基本上我需要从WPF应用程序打开System.Windows.Forms.WebBrowser Modal对话框时,我需要捕获从页面传递回WPF的值并保留一个窗口根据我返回的值来设置或关闭它。 Is this even possible or am I going to have to about in a different way? 这是否有可能,或者我将不得不以另一种方式去做?

Thanks, Andrew 谢谢,安德鲁

surely is possible, just create the dialog, register an event handler for a custom event you have created in your second form and show it as modal, then inside your form you do what you need to do and when something happens you fire the event the main form has registered to, in the custom EventArgs class used in your event you can pass the value main form needs to get. 当然可以,只需创建对话框,为在第二个窗体中创建的自定义事件注册一个事件处理程序,然后将其显示为模式即可,然后在窗体内执行您需要做的事情,并在事件发生时触发该事件。主表单已注册,在事件中使用的自定义EventArgs类中,您可以传递主表单需要获取的值。 from the main form you check the value and you do nothing or close the popup.... 从主窗体中,您可以检查值,但不执行任何操作或关闭弹出窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM