/// <summary>
 /// Shows the explorer shell menu
 /// </summary>
 private void ShowShellMenu(Object sender, EventArgs e)
 {
     Int32 count = this.fileView.SelectedItems.Count;
     FileInfo[] selectedPathsAndFiles = new FileInfo[count];
     ShellContextMenu scm = new ShellContextMenu();
     for (Int32 i = 0; i < count; i++)
     {
         String path = this.fileView.SelectedItems[i].Tag.ToString();
         selectedPathsAndFiles[i] = new FileInfo(path);
     }
     if (count == 0)
     {
         String path = this.selectedPath.Text;
         if (!Directory.Exists(path)) return;
         selectedPathsAndFiles = new FileInfo[1];
         selectedPathsAndFiles[0] = new FileInfo(path);
     }
     this.menu.Hide(); /* Hide default menu */
     Point location = new Point(this.menu.Bounds.Left, this.menu.Bounds.Top);
     scm.ShowContextMenu(selectedPathsAndFiles, location);
 }
示例#2
0
 /// <summary>
 /// Shows the explorer shell menu
 /// </summary>
 private void TreeShowShellMenu()
 {
     String parentDir = null;
     ShellContextMenu scm = new ShellContextMenu();
     List<FileInfo> selectedPathsAndFiles = new List<FileInfo>();
     for (Int32 i = 0; i < Tree.SelectedPaths.Length; i++)
     {
         String path = Tree.SelectedPaths[i];
         // only select files in the same directory
         if (parentDir == null) parentDir = Path.GetDirectoryName(path);
         else if (Path.GetDirectoryName(path) != parentDir) continue;
         selectedPathsAndFiles.Add(new FileInfo(path));
     }
     this.pluginUI.Menu.Hide(); /* Hide default menu */
     Point location = new Point(this.pluginUI.Menu.Bounds.Left, this.pluginUI.Menu.Bounds.Top);
     scm.ShowContextMenu(selectedPathsAndFiles.ToArray(), location);
 }