예제 #1
0
        private async Task CreateOneDriveAsync()
        {
            var userAccount = authProvider.CurrentUserAccount;

            if (TreeItemVMs.Any(vm => vm.Item.Name == userAccount.Username))
            {
                MessageBox.Show("User has already signed in.");
                return;
            }
            var user = await graphManager.GetMeAsync().ConfigureAwait(true);

            if (user == null)
            {
                return;
            }
            if (authProvider.UserIdAccountRegistry.ContainsKey(user.Id))
            {
                MessageBox.Show("User has already signed in.");
                return;
            }
            var root = await graphManager.GetDriveRootAsync().ConfigureAwait(true);

            if (root == null)
            {
                return;
            }

            authProvider.UserIdAccountRegistry.Add(user.Id, userAccount);
            var item = OneDriveItemFactory.CreateRoot(root, user);

            TreeItemVMs.Add(new ItemVM(item));
            CurrentItemVMs.Add(new ItemVM(item));
        }
예제 #2
0
 public async IAsyncEnumerable <IItem> GetChildrenAsync()
 {
     await foreach (var item in graphManager.GetChildrenAsync(Id, UserId).ConfigureAwait(false))
     {
         yield return(OneDriveItemFactory.CreateChild(item, this));
     }
 }