public async Task <IEnumerable <INetDiskFile> > GetFilesAsync() { return(await Task.Run(() => { var fileResult = _client.GetFileList(FilePath.FullPath); //var result = fileResult["list"]?.Select(job => JsonConvert.DeserializeObject<NetDiskFile>(job.ToString())); if (fileResult.list == null) { throw new NullReferenceException("目标目录不存在"); } return fileResult.list; })); }
private async Task <NetDiskFileResult> GetFileList(string temp) { return(await Task.Run(() => { var flst = _client.GetFileList(temp); Application.Current.Dispatcher.Invoke(() => { ChildrenFile.Clear(); if (flst != null && flst.list.Length > 0) { ChildrenFile.AddRange(flst.list); } }); return flst; })); }