使用文件下载C#拖放 [英] Drag'n Drop with file downloading C#

查看:66
本文介绍了使用文件下载C#拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题.我想将文件从窗体拖放到资源管理器/桌面.

I got a problem. I'd like to drag'n drop a file from my Form to explorer/ the desktop.

问题是文件在线.然后,必须先将其下载到磁盘上的某个位置,然后才能将其复制到目标文件夹中.

The problem is that the file is online. Then it must be downloaded somewhere on the disk before being copied in the destination folder.

我创建了一个shell扩展(无论如何,我认为这是一个扩展),他使用后台工作程序来下载文件,但是当然,即使如此,在下载文件时,拖放操作也不是'结束,UI冻结了.

I created a shell extension (I think it's that, at any rate), who use a background worker to download the file, but of course, even with that, while the file is downloading, the drag and drop operation isn't over and the UI is freezing.

我想做的只是拖放资源管理器,它将启动下载并复制文件,而在下载过程中不会冻结UI.

What I would like to do is just doing a drag and drop to explorer, which will launch a download and copy the file, without the UI freezing during the download.

那我该怎么办?

我可以获取目标路径并自己复制吗?

Could I get the destination path and do the copying myself ?

我可以在另一个线程中启动整个拖放操作吗?

Could I launch the entire drag and drop operation in another thread ?

我搜索了一段时间,找不到任何明确的答案.

I searched for a while and couldn't find any clear answers.

推荐答案

您可以在内部调用 BackgroundWorkder 放置事件处理程序.

You can call a BackgroundWorkder inside the drop event handler.

这篇关于使用文件下载C#拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆