简体   繁体   English

OneDrive SDK取消操作

[英]OneDrive SDK Canceling Operation

I'm using OneDrive Sdk , reading from doc, only Copy operation that can be canceled. 我正在使用OneDrive Sdk ,从doc读取,仅OneDrive Sdk Copy操作。

OneDrive SDK Copy OneDrive SDK复制

Is there any work around to enable Cancelling from other operation like Download and Upload , I can find a way to pass CancellationToken for those. 是否有任何变通方法可启用从“ Download和“ Upload类的其他操作中Cancelling ,我可以找到一种方法来为这些操作传递CancellationToken

public async Task Download(string itemPath)
{
   var driveClient =
     await
         OneDriveClientExtensions.GetAuthenticatedClientUsingOnlineIdAuthenticator(new[]
         {"wl.signin", "onedrive.readwrite"});


    var item = await driveClient.Drive.Root.ItemWithPath(itemPath).Content.Request().GetAsync();
}

Cancellation operation is not currently supported in OneDrive SDK for download and upload. OneDrive SDK当前不支持取消操作进行下载和上传。 But it seems the SDK team is working on it. 但是似乎SDK团队正在努力。 You can follow the open issue: Cancellation support? 您可以关注未解决的问题: 取消支持? in GitHub to get more information. 在GitHub上获取更多信息。

To support cancellation operation in UWP, you can try to implement you own download and upload method with Windows.Web.Http.HttpClient class . 为了支持UWP中的取消操作,您可以尝试使用Windows.Web.Http.HttpClient类实现自己的下载和上传方法。 This is a modern HTTP client API for Windows Store apps and supports cancellation and progress. 这是Windows Store应用程序的现代HTTP客户端API,支持取消和进度。 For more information about how to use this class, you can refer to the official HttpClient sample . 有关如何使用此类的更多信息,可以参考官方HttpClient示例

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

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