예제 #1
0
 public virtual Task <IEnumerable <StorageProviderItem> > GetChildrenByParentItem(StorageProviderItem parent)
 {
     return(BaseProvider.GetChildrenByParentItem(parent));
 }
예제 #2
0
        private async Task SetSelectedItem(StorageProviderItem item)
        {
            if (m_selectedItem == item || item.Type != StorageProviderItemType.Folder) return;

            m_selectedItem = item;

            await UpdateListView();
            m_txtUrl.Text = GetResultUri();
        }
예제 #3
0
        private async Task<ItemInfo> GetItemInfo(StorageProviderItem item)
        {
            if (m_cache.ContainsKey(item))
                return m_cache[item];

            var info = new ItemInfo();
            var result = await m_provider.GetChildrenByParentItem(item);
            info.Children = result.OrderByDescending(_ => _.Type).ThenBy(_ => _.Name).ToArray();

            if (item.ParentReferenceId != null)
            {
                var parent = m_cache.Keys.SingleOrDefault(_ => _.Id == item.ParentReferenceId);
                if (parent != null)
                    info.Parent = parent;
                else
                    throw new NotImplementedException();
                //await m_provider.GetItem(item.ParentReference.Id);
            }

            m_cache.Add(item, info);

            return info;
        }
예제 #4
0
        private async Task<ItemInfo> GetItemInfo(StorageProviderItem item)
        {
            if (m_cache.ContainsKey(item))
                return m_cache[item];

            var info = new ItemInfo();
            if (item.ParentReferenceId != null)
            {
                var parent = m_cache.Keys.SingleOrDefault(_ => _.Id == item.ParentReferenceId);
                if (parent != null)
                    info.Parent = parent;
                else
                    throw new InvalidOperationException("Parent of node not found!");
                //await m_provider.GetItem(item.ParentReference.Id);
            }

            IEnumerable<StorageProviderItem> result;

            try
            {
                result = await m_provider.GetChildrenByParentItem(item);
            }
            catch (Exception ex)
            {
                MessageService.ShowWarning("Error loading file list.\r\nException:", ex);
                return info;
            }

            info.Children = result.OrderByDescending(_ => _.Type).ThenBy(_ => _.Name).ToArray();

            m_cache.Add(item, info);

            return info;
        }