private void Remove(ImageUploadModel imageUploadModel) { _items.Remove(imageUploadModel); _removeCount++; if (!imageUploadModel.IsFailed && !imageUploadModel.IsCompleted && imageUploadModel.Ready > 0) { imageUploadModel.IsDeleting = true; } else { Delete(imageUploadModel); } }
private void Upload(ImageUploadModel file) { if (!_cancel && !file.IsFailed && !file.IsCompleted) { using (var stream = file.FileInfo.OpenRead()) { stream.Position = file.Ready; var len = (int)Math.Min(BUFFER_SIZE, stream.Length - stream.Position); var buffer = new byte[len]; stream.Read(buffer, 0, len); _context.UploadFile(_path, file.Name, buffer, stream.Position == 0, UploadCallback, file); } } }
private void Delete(ImageUploadModel file) { _context.DeleteFile(_path, file.Name, DeleteCallback, file); }