Exemple #1
0
        internal DirectoryBlock CreateDirectoryObject(Box.V2.Models.BoxItem item, DirectoryBlock parentDirectory)
        {
            string parent = null;

            if (item.Parent == null)
            {
                parent = "";
            }

            DirectoryBlock directory = new DirectoryBlock()
            {
                id           = item.Id,
                Name         = item.Name,
                Description  = item.Description,
                Size         = item.Size,
                SharedLink   = GetSharedLink(item),
                Owners       = GetOwners(item),
                CreationTime = item.CreatedAt.ToString(),
                Users        = GetUsers(item),
                Parent       = new List <string> {
                    parent
                },
                path = parentDirectory.path + "\\" + item.Name,
            };

            return(directory);
        }
Exemple #2
0
        internal List <User> GetUsers(Box.V2.Models.BoxItem item)
        {
            List <User> Users = null;

            try
            {
                Task <BoxCollection <BoxCollaboration> > task = Task.Run(() => client.FoldersManager.GetCollaborationsAsync(item.Id));
                var collaborations = task.Result;
                if (collaborations.Entries.Count > 0)
                {
                    Users = new List <User>();
                    // Add users and permissions
                    foreach (var collaboration in collaborations.Entries)
                    {
                        User newUser = CreateUserObject(collaboration);
                        Users.Add(newUser);
                    }
                }
            }
            catch (BoxException e)
            {
                throw new Exception(e.Message + " " + e.StackTrace);
            }
            return(Users);
        }
 async void boxItemPicker_ItemSelected(object sender, BoxItem e)
 {
     if (e != null)
     {
         MessageDialog dialog = new MessageDialog(string.Format("{0} Selected!", e.Name));
         await dialog.ShowAsync();
     }
     
 }
Exemple #4
0
        internal String GetSharedLink(Box.V2.Models.BoxItem item)
        {
            String url = null;

            if (item.SharedLink != null)
            {
                url = item.SharedLink.Url;
            }
            return(url);
        }
Exemple #5
0
        internal List <Owner> GetOwners(Box.V2.Models.BoxItem item)
        {
            List <Owner> owners = new List <Owner>();
            Owner        owner  = new Owner()
            {
                DisplayName = item.OwnedBy.Name,
                Email       = item.OwnedBy.Login,
            };

            owners.Add(owner);
            return(owners);
        }
Exemple #6
0
 internal void AddToParentDirectoryObject(Box.V2.Models.BoxItem item, DirectoryBlock directory)
 {
     if (isDirectory(item.Type))
     {
         DirectoryBlock newDirectory = CreateDirectoryObject(item, directory);
         if (directory.SubDirectories == null)
         {
             directory.SubDirectories = new List <DirectoryBlock>();
         }
         directory.SubDirectories.Add(newDirectory);
     }
     else
     {
         FileBlock newFile = CreateFileObject(item, directory);
         if (directory.Files == null)
         {
             directory.Files = new List <FileBlock>();
         }
         directory.Files.Add(newFile);
     }
 }
 /// <summary>
 /// Fires the ItemSelected EvenHandler passing in the selected item
 /// </summary>
 /// <param name="item"></param>
 public void OnItemSelected(BoxItem item)
 {
     if (ItemSelected != null)
         ItemSelected(this, item);
 }
 public BoxItemViewModel(BoxItem item, BoxClient client)
 {
     _client = client;
     UpdateBaseBindings(item);
 }
        private void UpdateBaseBindings(BoxItem item)
        {
            Item = item;
            Name = item.Name;
            ModifiedAt = item.ModifiedAt;
            if (item.Type == "file")
            {
                Size = item.Size;
                ItemType = BoxItemType.File;
            }
            else if (item.Type == "folder")
            {
                ItemType = BoxItemType.Folder;
            }

        }