private void ItemSelected(DriveItem item) { HandleItem(item); if (!IsFolder(item)) { GoBack(); } }
private async void HandleItem(DriveItem item) { if (!IsFolder(item)) { UI.Publish(item); } else { _folders.Push(item.Id); await GetDriveItems(); OnPropertyChanged(() => IsRootFolder); } }
private async void ViewFile(DriveItem item) { using (new Loading(this)) { var data = await GraphService.GetDriveItemContent(item.Id); if (data != null) { await UI.OpenAttachment(new FileAttachment { Name = item.Name, ContentBytes = data, }); } } }
private bool IsFolder(DriveItem item) { return item?.Folder != null; }
private async void DeleteFile(DriveItem item) { using (new Loading(this)) { await GraphService.DeleteDriveItem(item.Id); Items.Remove(item); } }
private async void AttachmentSelected(DriveItem driveItem) { using (new Loading(this)) { var data = await GraphService.GetDriveItemContent(driveItem.Id); if (data != null) { _attachments.Add(new FileAttachment { Name = driveItem.Name, ContentBytes = data, }); OnPropertyChanged(() => HasAttachments); } } }