private void RefreshDriveEntries(IDrive drive, TreeNode node, DataGridView grid, bool forceRefresh) { var driveEntryKey = node.Name.Split('|')[0]; if (!_driveEntryCache.ContainsKey(driveEntryKey) || forceRefresh) { var driveEntries = drive.GetDriveEntries(driveEntryKey); if (driveEntries == null) { grid.DataSource = null; return; } _driveEntryCache[driveEntryKey] = driveEntries; } grid.DataSource = _driveEntryCache[driveEntryKey].ToList(); if (node.FirstNode == null || !String.IsNullOrEmpty(node.FirstNode.Name)) { return; } node.Nodes.Clear(); foreach (var newNode in _driveEntryCache[driveEntryKey] .Where(entry => entry.Type == DriveEntryType.Directory) .Select(directory => node.Nodes.Add(directory.Key, directory.Name))) { newNode.Nodes.Add(Resources.LoadingText); } }
private void RefreshDriveEntries(IDrive drive, TreeNode node, DataGridView grid, bool forceRefresh) { var driveEntryKey = node.Name.Split('|')[0]; if (!_driveEntryCache.ContainsKey(driveEntryKey) || forceRefresh) { var driveEntries = drive.GetDriveEntries(driveEntryKey); if (driveEntries == null) { grid.DataSource = null; return; } _driveEntryCache[driveEntryKey] = driveEntries; } grid.DataSource = _driveEntryCache[driveEntryKey].ToList(); if (node.FirstNode == null || !String.IsNullOrEmpty(node.FirstNode.Name)) return; node.Nodes.Clear(); foreach (var newNode in _driveEntryCache[driveEntryKey] .Where(entry => entry.Type == DriveEntryType.Directory) .Select(directory => node.Nodes.Add(directory.Key, directory.Name))) { newNode.Nodes.Add(Resources.LoadingText); } }