private void OnModelUpdated(ModelUpdatedMessageResult <StorageDocument> updateResult) { if (updateResult.UpdateEvent == ModelUpdateEvent.Created) //only add event support for this example { var container = new StorageDocumentContainer(updateResult.UpdatedModel.FileType, updateResult.UpdatedModel.RemoteStorageFileId) { File = updateResult.UpdatedModel }; Files.Add(container); CheckHasFiles(); } }
private async void DeleteFile(StorageDocumentContainer fileContainer) { IsBusy = true; try { await StorageService.DeleteFileAsync(fileContainer.File.FileType, fileContainer.File.RemoteStorageFileId); } finally { IsBusy = false; BusyMessage = null; } }
private async void FetchStorageFiles() { IsBusy = true; try { BusyMessage = "fetching images..."; var imageFiles = await StorageService.GetFilesListAsync(FileType.Image); BusyMessage = "fetching documents..."; var documentFiles = await StorageService.GetFilesListAsync(FileType.Document); BusyMessage = "generating models..."; var files = new List <StorageDocumentContainer>(); foreach (var imageFile in imageFiles) { var fileContainer = new StorageDocumentContainer(FileType.Image, imageFile); fileContainer.File.Name = imageFile; files.Add(fileContainer); } foreach (var documentFile in documentFiles) { var fileContainer = new StorageDocumentContainer(FileType.Document, documentFile); fileContainer.File.Name = documentFile; files.Add(fileContainer); } Files = new ObservableCollection <StorageDocumentContainer>(files); CheckHasFiles(); } catch (StorageException se) { //DialogService.DisplayAlert(se.message) Debug.WriteLine(se.Message); } finally { IsBusy = false; BusyMessage = null; } }