protected void FireNavigateFiles(NavigateFileOperation operation) { if (this.NavigateFilesEvent != null) { NavigateFilesEvent(operation); } }
private void NavigateFiles(NavigateFileOperation operation) { if (operation == NavigateFileOperation.Next || operation == NavigateFileOperation.Previous) { TreeNode n = this.fileList.SelectedNode; int i = this.fileList.Nodes.IndexOf(n); if (i == -1) { i = operation == NavigateFileOperation.Next ? 0 : this.fileList.Nodes.Count - 1; } else { i += operation == NavigateFileOperation.Next ? 1 : -1; } if (i >= 0 && i < this.fileList.Nodes.Count) { n = this.fileList.Nodes[i]; this.fileList.SelectedNode = n; } } if (operation == NavigateFileOperation.Delete) { TreeNode n = this.fileList.SelectedNode; if (n != null && n.Tag is FileSystemInfo) { ShellFileOperation fo = new ShellFileOperation(); int i = this.fileList.Nodes.IndexOf(n); fo.Operation = ShellFileOperation.FileOperations.FO_DELETE; fo.OwnerWindow = this.Handle; fo.SourceFiles = new string[] { ((FileSystemInfo)n.Tag).FullName };; bool RetVal = fo.DoOperation(); if (RetVal) { // delete was successful -> update the list RefreshFileList(currentDirectory, true); if (i >= this.fileList.Nodes.Count) { i = this.fileList.Nodes.Count - 1; } if (i >= 0 && i < this.fileList.Nodes.Count) { n = this.fileList.Nodes[i]; this.fileList.SelectedNode = n; } } } } }