代码之家  ›  专栏  ›  技术社区  ›  JontyMC

VS插件:在web应用程序上添加上下文按钮

  •  0
  • JontyMC  · 技术社区  · 17 年前

    我已经能够在项目上下文菜单上添加上下文项了:

    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    

    { applicationObject=(DTE2)应用程序; addInInstance=(Add-)addInInst;

    if (connectMode == ext_ConnectMode.ext_cm_UISetup) {
        var contextGuids = new Object[] {};
        var iisSetupCommand = applicationObject.Commands.AddNamedCommand(
            addInInstance,
            CommandNameSetupIis,
            "Setup IIS",
            "Create the bindings in IIS for the website. Requires an IIS folder in the project root with the archive xml files for the website.",
            true,
            52,
            ref contextGuids,
            (int) vsCommandStatus.vsCommandStatusSupported + (int) vsCommandStatus.vsCommandStatusEnabled
            );
    
        var commandBars = (CommandBars) applicationObject.CommandBars;
        var projectMenu = commandBars["Project"];
        iisSetupCommand.AddControl(projectMenu, projectMenu.Controls.Count + 1);
    }
    

    }

    问题1是点击后按钮消失。

    http://dotnetslackers.com/articles/vs_addin/Lessons_learned_from_Copy_to_Html_Add_in.aspx

    有人能帮忙吗?

    1 回复  |  直到 17 年前
        1
  •  0
  •   JontyMC    17 年前

    问题1:重写QueryStatus并将状态设置为vsCommandStatus.vsCommandStatus支持| vsCommandStatus-vsCommandStateEnabled