Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Need help in adding additional command in VSPackage.cs

$
0
0

i am currently facing an issue, and desperately need help. any help will be very much appreciated.

in my vsct file, i do have 2 buttons. 

   <Button guid="guidMyFyp_PluginCmdSet" id="cmdidGenerateDiagram" priority="0x0100" type="Button">
        <Parent guid="guidMyFyp_PluginCmdSet" id="MyMenuGroup" />
        <Icon guid="guidImages" id="bmpPic1" />
        <Strings>
          <ButtonText>Generate Diagram</ButtonText>
        </Strings>
      </Button>

      <Button guid="guidMyFyp_PluginCmdSet" id="cmdidCreateRulesCommand" priority="0x0200" type="Button">
        <Parent guid="guidMyFyp_PluginCmdSet" id="RulesGroup" />
        <Icon guid="guidImages" id="bmpPic2" />
        <Strings>
          <CommandName>cmdidCreateRulesCommand</CommandName>
          <ButtonText>Create Rules</ButtonText>
        </Strings>
      </Button>

and i am trying to create a new command for the button with the id "cmdidCreateRulesCommand". therefore in my VSPackage.cs, i included the following in my initialize method.

  OleMenuCommandService mcs2 = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs2)
            {
          
                CommandID openRuleForm = new CommandID(GuidList.guidMyFyp_PluginCmdSet,(int)PkgCmdIDList.cmdidCreateRulesCommand);
                MenuCommand menuItem2 = new MenuCommand(MenuItemCallback, openRuleForm);
                mcs2.AddCommand(menuItem2);
            }

however upon running my program, it is not able to detect my new command to execute my method. can anyone please enlighten me? 


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>