public void RefreshNode(TreeNode node, bool force) { if (node == null) { return; } if (_treeviewUpdating) { return; } try { treeView1.BeginUpdate(); _treeviewUpdating = true; if (force || node.Nodes.Count == 0) { AddDirectories(node); node.Expand(); } // Get files from disk, add to DataGridView control AddFiles(node.FullPath); SetPath(SimplePath.GetFullPathWithoutTrailingSeparator(node.FullPath), false); if (escPressed) { SetStatusText("Operation cancelled."); } else { SetStatusText(String.Format("{0} Folder{1}, {2} File{3}", node.Nodes.Count, (node.Nodes.Count > 1 ? "s" : ""), dgvData.Rows.Count, (dgvData.Rows.Count > 1 ? "s" : ""))); } CheckDropFile(null); } catch (Exception ex) { SetStatusText(ex.Message); } finally { treeView1.EndUpdate(); _treeviewUpdating = false; } }