简体   繁体   English

C# WebBrowser控制页面返回Windows.Form function

[英]C# WebBrowser control page back to Windows.Form function

I am writing a program that sends data from a windows application to a website.我正在编写一个程序,将数据从 windows 应用程序发送到网站。 In the windows form, I am using the WebBrowser control to connect to the website and login.在 windows 表单中,我使用 WebBrowser 控件连接到网站并登录。 After I login I would like to be able to have a button that when the user clicks on it, it will call a function back in the windows.form so it can send the data to the website in the background.登录后,我希望能够有一个按钮,当用户单击它时,它会在 windows.form 中调用 function,以便它可以在后台将数据发送到网站。 I can't figure out a way to do this, is this actually possible?我想不出办法做到这一点,这真的可能吗? Any help will be much appreciated thanks.任何帮助将不胜感激谢谢。

The mechanism that immediately comes to mind is a shared file.立即想到的机制是共享文件。 Your WinForms application would setup a FileSystemWatcher on a shared directory.您的 WinForms 应用程序将在共享目录上设置一个FileSystemWatcher Then the ASPX page would update the file so that your WinForm would know to upload the data.然后 ASPX 页面将更新该文件,以便您的 WinForm 知道要上传数据。

I do not recommend this method, believing that a WindowsService that was notified via the ASPX page would be preferable, however the above should be a workaround if your are unduly constrained to the architecture you described.我不推荐这种方法,相信通过 ASPX 页面通知的 WindowsService 会更好,但是如果您过度受限于您描述的体系结构,上述方法应该是一种解决方法。

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

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