Example #1
0
        private async Task DeleteItem(string filePath, FSItem item)
        {
            try
            {
                if (item.ParentIds.Count == 1)
                {
                    if (item.IsUploading)
                    {
                        UploadService.CancelUpload(item.Id);
                    }
                    else
                    {
                        await cloud.Nodes.Trash(item.Id);
                    }
                }
                else
                {
                    var dir     = Path.GetDirectoryName(filePath);
                    var dirItem = await FetchNode(dir);

                    await cloud.Nodes.Remove(dirItem.Id, item.Id);
                }
            }
            catch (AggregateException ex)
            {
                throw ex.Flatten();
            }
            catch (CloudException ex) when(ex.Error == HttpStatusCode.NotFound || ex.Error == HttpStatusCode.Conflict)
            {
                Log.Warn(ex.Error.ToString());
            }
        }
Example #2
0
 public void CancelUpload(string id)
 {
     UploadService.CancelUpload(id);
 }