private void RefreshBottomBarSelectedItem(int[] idList) { if (idList != null && idList.Length > 0) { var index = m_GridViewDataSource.GetItemIndexByItemId(idList[0]); if (index == -1) { var item = m_ConfigSource.GetValue <FolderGridItem>(BottomSelectedItem); var parentItem = m_TreeView.FindItem(item.ParentId) as FolderTreeViewItem; if (parentItem == null) { return; } if (parentItem.hasChildren) { foreach (var child in parentItem.children) { if (child.id == item.Id) { m_BottomBarSelectedItem = item; m_BottomBar.SelectedPathSplitted.Clear(); return; } } } if (parentItem.FileList != null) { foreach (var child in parentItem.FileList) { if (child.id == item.Id) { m_BottomBarSelectedItem = item; m_BottomBar.SelectedPathSplitted.Clear(); return; } } } return; } m_BottomBarSelectedItem = m_GridViewDataSource.GetItemByIndex(index) as FolderGridItem; m_ConfigSource.SetValue(BottomSelectedItem, m_BottomBarSelectedItem); m_BottomBar.SelectedPathSplitted.Clear(); } else { m_BottomBarSelectedItem = null; m_ConfigSource.SetValue <FolderGridItem>(BottomSelectedItem, null); m_BottomBar.SelectedPathSplitted.Clear(); } m_ConfigSource.SetConfigDirty(); }
protected List <GridItem> GetItemList(List <int> selectedItemIdList) { List <GridItem> itemList = new List <GridItem>(); foreach (var id in selectedItemIdList) { var item = m_DataSource.GetItemByIndex(m_DataSource.GetItemIndexByItemId(id)); itemList.Add(item); } return(itemList); }
private void ItemExpandedAction(int itemId, bool expanded) { var index = m_GridViewDataSource.GetItemIndexByItemId(itemId); var item = m_GridViewDataSource.GetItemByIndex(index); if (expanded) { var children = item.GetChildItemRange(0, item.ChildItemCount); if (children != null) { m_GridViewDataSource.ItemList.InsertRange(index + 1, item.GetChildItemRange(0, item.ChildItemCount)); } } else { int endIndex = index + 1; bool hasChild = false; for (; endIndex < m_GridViewDataSource.Count;) { var nextItem = m_GridViewDataSource.GetItemByIndex(endIndex); if (nextItem.IsChildItem) { hasChild = true; ++endIndex; } else { break; } } if (hasChild) { m_GridViewDataSource.ItemList.RemoveRange(index + 1, endIndex - index - 1); } } }