Ejemplo n.º 1
0
 protected static void RemoveSeparatorIfLast(IMenuModel model)
 {
     if (model.Count > 0 && model.GetTypeAt(model.Count - 1) == MenuItemType.Separator)
     {
         model.RemoveAt(model.Count - 1);
     }
 }
Ejemplo n.º 2
0
 public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
 {
     for (int i = 0; i < model.Count; i++)
     {
         var commandId = model.GetCommandIdAt(i);
         if (commandId == CefMenuCommand.Print)
         {
             model.RemoveAt(i);
             i--;
             continue;
         }
         if (commandId == CefMenuCommand.Back)
         {
             model.RemoveAt(i);
             i--;
             continue;
         }
         if (commandId == CefMenuCommand.Forward)
         {
             model.RemoveAt(i);
             i--;
             continue;
         }
         if (commandId == CefMenuCommand.ViewSource)
         {
             model.RemoveAt(i);
             i--;
             continue;
             model.AddItem((CefMenuCommand)26501, "开发者工具(F12)");
             model.AddItem((CefMenuCommand)26502, "全屏(F11)");
             continue;
         }
     }
     while (true)
     {
         if (model.Count > 0 && model.GetCommandIdAt(0) == CefMenuCommand.NotFound)
         {
             model.RemoveAt(0);
         }
         else
         {
             break;
         }
     }
 }