奇怪的下载错误(wp7 + skydrive api)

时间:2012-03-27 17:45:22

标签: c# windows-phone onedrive

如果文件名包含 - 从skydrive下载失败。更确切地说 - 结果的长度始终为0.其他文件的加载没有任何问题;

由于

开始下载:

if (!loading) {
                if (!Storage.Exists(item.Name)
                    || MessageBox.Show(AppResources.alreadyExists, AppResources.confirmation, MessageBoxButton.OKCancel) == MessageBoxResult.OK) {
                    loading = true;
                    App.loadInfo.Name = item.Name;
                    App.loadInfo.Info = AppResources.loadingStart;
                    PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disa bled;
                    client.DownloadAsync(item.Id + CONTENT, item);
                }
            }

下载完成:

void client_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e) {
        PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
        try {
            FileItem item = e.UserState as FileItem;
            if (e.Error == null
                && !e.Cancelled
                && e.UserState != null
                && item.Size == e.Result.Length.ToString()) //LENGTH = 0 { Storage.SaveFile(item.Name, e.Result);
                App.loadInfo.Info = AppResources.loadingComplete;
                new GetIcon(item._name);
            }
            else {
                if (item != null) App.loadInfo.Name = item.Name;
                App.loadInfo.Info = AppResources.loadingError;
            }
        }
        finally { App.loadInfo.Progress = 0; loading = false; MakeUi(); }
    }

LiveDownloadProgressChangedEventArgs不会出现

2 个答案:

答案 0 :(得分:0)

如果真的是这种情况,您是否可以在发出请求之前从URI中剥离片段?

答案 1 :(得分:0)