Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileContext"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private FileContext(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            m_SelectedItemUtil = new SelectedItemUtil();
            m_SqlClipboard     = new SqlClipboard();

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var            menuCommandID = new CommandID(CommandSet, CommandId);
                OleMenuCommand menuItem      = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;
                commandService.AddCommand(menuItem);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SolutionMenuContext"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private SolutionMenuContext(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package          = package;
            m_SelectedItemUtil    = new SelectedItemUtil();
            m_RegistryMap         = new RegistryMap();
            m_BeyondCompareRunner = new BeyondCompareRunner();

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var            menuCommandID = new CommandID(CommandSet, CommandId);
                OleMenuCommand menuItem      = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;

                commandService.AddCommand(menuItem);
            }
        }