public void AddDownloadOperation(DownloadOperation downloadOperation) { var entry = new BucketEntryViewModel(this, _bucketService, _objectService); entry.IsDownloadOperation = true; entry.DownloadOperation = downloadOperation; entry.InitDownloadOperation(); Entries.Add(entry); }
public void AddUploadOperation(UploadOperation uploadOperation) { var entry = new BucketEntryViewModel(this, _bucketService, _objectService); entry.IsUploadOperation = true; entry.UploadOperation = uploadOperation; entry.InitUploadOperation(); Entries.Add(entry); }
public async Task InitAsync() { StartLoading(); //Fetch all UploadOperations var uploadOperations = (ActiveUploadOperations.Where(u => u.Key == BucketName)).FirstOrDefault(); if (uploadOperations.Value != null) { foreach (var uploadOperation in uploadOperations.Value) { if (!uploadOperation.Completed) { AddUploadOperation(uploadOperation); } } } //Fetch all DownloadOperations var downloadOperations = (ActiveDownloadOperations.Where(u => u.Key == BucketName)).FirstOrDefault(); if (downloadOperations.Value != null) { foreach (var downloadOperation in downloadOperations.Value) { if (!downloadOperation.Completed) { AddDownloadOperation(downloadOperation); } } } //Load all objects try { var bucket = await _bucketService.GetBucketAsync(BucketName); var listOptions = new ListObjectsOptions(); var objects = await _objectService.ListObjectsAsync(bucket, listOptions); foreach (var obj in objects.Items) { var entry = new BucketEntryViewModel(this, _bucketService, _objectService); entry.IsObject = true; entry.ObjectInfo = obj; Entries.Add(entry); } } catch (Exception ex) { Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog("Could not open bucket - " + ex.Message); await dialog.ShowAsync(); } DoneLoading(); }