使用 DropBox api 时的进度条

发布于 2024-10-20 13:25:40 字数 889 浏览 2 评论 0原文

使用 Dropnet (dropbox api)。我可以上传这样的文件:

        DropNet.DropNetClient dc = new DropNet.DropNetClient("*************", "g86p9959v9tvg49");
        dc.Login("[email protected]", "********");
        byte[] rawData = File.ReadAllBytes("Ionic.Zip.dll");
         dc.UploadFile("Public", "Ionic.Zip.dll",rawData );
        Console.WriteLine(dc.Account_Info().quota_info.quota/(1024*1024));

有没有办法有一个进度条? 这里说:

这是你可以解决的事情 你自己 - 你知道文件有多大 是,你知道你寄了多少 或目前已收到,其余基本 数学。 :)

我如何知道已发送了多少数据?有什么帮助吗?

谢谢

编辑: upload 方法返回 - DropNet.Models.DropNetResult.statuscode System.net.httpstatuscode 对象。是这个吗?我是否必须以某种方式使用这个东西来制作进度条?

Using Dropnet ( dropbox api) . I can upload a file like this:

        DropNet.DropNetClient dc = new DropNet.DropNetClient("*************", "g86p9959v9tvg49");
        dc.Login("[email protected]", "********");
        byte[] rawData = File.ReadAllBytes("Ionic.Zip.dll");
         dc.UploadFile("Public", "Ionic.Zip.dll",rawData );
        Console.WriteLine(dc.Account_Info().quota_info.quota/(1024*1024));

Is there a way to have a progress bar with this ? It says here:

Its something you can work out
yourself - you know how big the files
are, you know how much you have sent
or received so far, the rest is basic
math. :)

How do I figure out how much data has been sent ? any help please ?

Thanks

Edit:
the upload method returns - DropNet.Models.DropNetResult.statuscode a System.net.httpstatuscode object. Is this it ? Do I have to somehow use this thing to make a progress bar ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北城半夏 2024-10-27 13:25:40

我认为不可能查看他们的源代码< /a> 在 git-hub 上,因为没有任何反馈。有一个 UploadFileAsync() ,它采用除了完成时调用的回调操作之外,还具有与 UploadFile() 相同的参数。您可以使用异步方法来显示字幕样式进度条并清理回调操作。

我不确定这是否有效,但您可以在上传之前捕获quota_info并启动异步上传并定期监视quota_info。如果配额信息在文件上传时更新,那么您就知道文件的大小以及已上传的文件量,并且您应该能够进行数学计算。

I don't think it's possible looking at their source code on git-hub as there is no feedback what so ever. There is an UploadFileAsync() that takes the same parameters as UploadFile() in addition to a callback Action that's called on completion. You could use the asynchronous method to show a marquee style progressbar and clean up on the callback Action.

I'm not sure if this will work but you could capture the quota_info before upload and start async upload and keep monitoring the quota_info periodically. If quota_info is updated as the file is uploaded then you know the size of the file and how much of it has been uploaded and you should be able to do the math.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文