private static void Default_ExecuteVerbs(object sender, ExecuteVerbEventArgs e)
 {
     IVirtualItem target = null;
     if (ContextMenuVirtualItem.IsAlive)
     {
         target = ContextMenuVirtualItem.Target as IVirtualItem;
     }
     if (string.Equals(e.Verb, "eject", StringComparison.OrdinalIgnoreCase))
     {
         VolumeEvents.RaiseRemovingEvent(target.FullName);
     }
     ContextMenuVirtualItem = null;
 }
 private void ToolStrip_ItemClick(object sender, ToolStripItemClickedEventArgs e)
 {
     ToolStripDropDownItem clickedItem = e.ClickedItem as ToolStripDropDownItem;
     if (((clickedItem != null) && (clickedItem.DropDownItems.Count <= 0)) && (clickedItem.Tag is MenuItemInfo))
     {
         MenuItemInfo tag = (MenuItemInfo) clickedItem.Tag;
         bool handled = false;
         if (this.OnExecuteVerb != null)
         {
             IntPtr pszName = Marshal.AllocHGlobal(0x100);
             try
             {
                 this.ContextMenu.GetCommandString(tag.Info.wID - 1, GCS.VERBA, 0, pszName, 0x100);
                 ExecuteVerbEventArgs args = new ExecuteVerbEventArgs(Marshal.PtrToStringAnsi(pszName));
                 this.OnExecuteVerb(this, args);
                 handled = args.Handled;
             }
             catch (SystemException)
             {
             }
             finally
             {
                 Marshal.FreeHGlobal(pszName);
             }
         }
         if (!handled)
         {
             ContextMenuStrip owner = sender as ContextMenuStrip;
             if (owner == null)
             {
                 for (ToolStripItem item2 = sender as ToolStripItem; (owner == null) && (item2 != null); item2 = item2.OwnerItem)
                 {
                     owner = item2.Owner as ContextMenuStrip;
                 }
             }
             Debug.Assert(owner != null);
             owner.Closed -= new ToolStripDropDownClosedEventHandler(this.ContextMenuStrip_Closed);
             owner.Hide();
             try
             {
                 CMINVOKECOMMANDINFOEX cminvokecommandinfoex;
                 cminvokecommandinfoex = new CMINVOKECOMMANDINFOEX {
                     cbSize = Marshal.SizeOf(cminvokecommandinfoex),
                     lpVerb = (IntPtr) (tag.Info.wID - 1),
                     lpVerbW = (IntPtr) (tag.Info.wID - 1)
                 };
                 if (!string.IsNullOrEmpty(this.ParentName))
                 {
                     cminvokecommandinfoex.lpDirectory = this.ParentName;
                     cminvokecommandinfoex.lpDirectoryW = this.ParentName;
                 }
                 cminvokecommandinfoex.fMask = ((CMIC.ASYNCOK | CMIC.PTINVOKE | CMIC.UNICODE) | (((Control.ModifierKeys & Keys.Control) > Keys.None) ? CMIC.CONTROL_DOWN : ((CMIC) 0))) | (((Control.ModifierKeys & Keys.Shift) > Keys.None) ? CMIC.SHIFT_DOWN : ((CMIC) 0));
                 cminvokecommandinfoex.ptInvoke = Cursor.Position;
                 cminvokecommandinfoex.nShow = SW.SW_SHOWNORMAL;
                 cminvokecommandinfoex.hwnd = this.Owner.Handle;
                 this.ContextMenu.InvokeCommand(ref cminvokecommandinfoex);
             }
             finally
             {
                 this.ItemContainer.Dispose();
             }
         }
     }
 }
 private void ExecuteVerb(object sender, ExecuteVerbEventArgs e)
 {
     if (e.Verb == "rename")
     {
         base.SelectedNode.BeginEdit();
         e.Handled = true;
     }
 }