这篇文章主要围绕C#等待返回void的函数以完成System.NET.WebClient.DownloadFileAsync()同时仍保持活动的WinFormsUI展开,旨在为您提供一份详细的参考资料
这篇文章主要围绕C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI展开,旨在为您提供一份详细的参考资料。我们将全面介绍C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI,同时也会为您带来.NET Framework 4 Client Profile System.Web.dll?、.net – System.Windows.Forms.WebBrowser:强制X86?、.net – 如何向System.Windows.Forms.MenuItem添加图标?、Android WebView DownloadListener的实用方法。
本文目录一览:- C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI
- .NET Framework 4 Client Profile System.Web.dll?
- .net – System.Windows.Forms.WebBrowser:强制X86?
- .net – 如何向System.Windows.Forms.MenuItem添加图标?
- Android WebView DownloadListener
C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI
如何解决C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI?
下载函数异步下载以便 UI 不会冻结,但我需要它一次下载一个文件,所以我有一个名为 downloadall() 的第二个函数需要调用下载函数,然后等待下载并安装的文件(这是一个bool变量),然后再次调用下载函数
public void Download()
{
using (WebClient wc = new WebClient())
{
wc.Credentials = new NetworkCredential(User,Password);
wc.DownloadProgressChanged += wc_DownloadProgressChanged;
wc.DownloadFileAsync
(
new System.Uri(DownloadURL),path + Name + ".zip"
);
}
}
private void DownloadAllBtn_Click(object sender,EventArgs e)
{
foreach (Pakage p in Program.Pakages)
{
if (!p.IsInstalled)
{
Download(p);
}
while (!p.IsInstalled)
{
///wait without freezing UI
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
.NET Framework 4 Client Profile System.Web.dll?
但是,我无法添加对System.Web.dll的引用,因为它在此版本中不存在 – 我该怎么办?
将System.Web.dll与我的应用程序一起部署是一个好主意,还是不行?我真的需要HTTP连接和所有,所以我不能修改我的应用程序作为一种解决方法.将我的应用程序定位到.NET 4(没有客户端配置文件)可能或仅仅在仅具有客户端配置文件的计算机上工作?
解决方法
NET 4 Client Profile,as this is the
version that will be present on most
home computers through Windows Update
不是真的.默认情况下,任何Windows 10之前的安装目前都不存在.NET 4(客户端配置文件或非客户端配置文件).例如,Windows 7附带.NET 3.5 SP1,而不是.NET 4.0.可能有Windows更新,但它是可选的.
因此,您也可以定位完整的.NET 4框架.
操作系统和.NET框架版本之间的链接可以在here找到.复选标记表示版本可用,开箱即用,加号表示可以安装.
另请注意,4.5,4.6和4.6.1都是就地更新,这意味着具有其中任何一个的系统也被认为具有4.0.
.net – System.Windows.Forms.WebBrowser:强制X86?
有什么办法可以强迫它使用x86 IE吗?浏览器访问的网页元素在x64上不起作用,并且不受我的控制.
.net – 如何向System.Windows.Forms.MenuItem添加图标?
这是我写的代码:
private System.Windows.Forms.ContextMenu notifyContextMenu; private void foo() { if (notifyIcon == null) { notifyIcon = new System.Windows.Forms.NotifyIcon(); } if (notifyContextMenu == null) { notifyContextMenu = new System.Windows.Forms.ContextMenu(); notifyContextMenu.MenuItems.Add("Exit"); // How do I add an icon to this context menu item? } notifyIcon.ContextMenu = notifyContextMenu; } }
解决方法
更改
notifyContextMenu = new System.Windows.Forms.ContextMenu(); notifyContextMenu.MenuItems.Add("Exit");
至
notifyContextMenu = new System.Windows.Forms.ContextMenuStrip(); var exitMenuItem = notifyContextMenu.Items.Add("Exit"); exitMenuItem.Image = ...;
http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitem.image.aspx
最后附上上下文菜单条来通知图标,
notifyIcon.ContextMenuStrip = notifyContextMenu;
Android WebView DownloadListener
java WebView.setDownloadListener(new DownloadListener() { [@Override](https://my.oschina.net/u/1162528) public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } });
今天关于C# 等待返回 void 的函数以完成 System.NET.WebClient.DownloadFileAsync() 同时仍保持活动的 WinForms UI的介绍到此结束,谢谢您的阅读,有关.NET Framework 4 Client Profile System.Web.dll?、.net – System.Windows.Forms.WebBrowser:强制X86?、.net – 如何向System.Windows.Forms.MenuItem添加图标?、Android WebView DownloadListener等更多相关知识的信息可以在本站进行查询。
本文标签: