本文介绍了URL作为文件名中OpenFileIDialog C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C#赢形式我使用打开文件对话框为用户选择一个文件来保存。当用户指定的如 http://www.xyz.com/qdms/MyFile.PDF 打开文件对话框的URL文件下载文件,并给从<$ C $下载的文件C> OpenFileDialog.FileName 如 C:\Documents和Settings\MyName\Local Settings\Temporary互联网Files\Content.IE5\GPIR4TYV\QDMS4 [3] .PDF 键,挂了很多时间



有没有什么办法让的http:// www.xyz.com/qdms/MyFile.PDF OpenFileDialog.FileName 当用户输入一个URL路径?


解决方案

A "hang" has a well defined meaning, it occurs when a program becomes unresponsive to user input, typically also suffering from painting artifacts and having its UI replaced by the ghost window, the one that says "Not responding" in the title bar.

None of this happens in the OpenFileDialog. It simply disables input but keeps the Cancel button operable while the download is progressing. A progress bar would have been nice but it is not a widget that's included in the dialog. Nothing hangs, the user can fire up Solitair and the dialog paints just fine when he switches back. If he gets tired of waiting then pressing the Cancel button works well.

No user is ever going to be flummoxed by this. You could use the FileOk event to have a look at the selected file before the download starts and display a warning that it might take a while. That however isn't terribly useful since you have no way to estimate how long it is going to take and is likely to just exhaust the user with an "I know, I know, stop telling me about the obvious" exclamation. Best to avoid helping here, you can if you want to.

这篇关于URL作为文件名中OpenFileIDialog C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 13:10
查看更多