コード例 #1
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID menuCommandID = new CommandID(GuidList.guidTextFormatPickerCmdSet, (int)PkgCmdIDList.cmdidGetTextFormat);
                MenuCommand menuItem = new MenuCommand(ShowTextFormat, menuCommandID);
                mcs.AddCommand(menuItem);
            }

            //Set up Selection Events so that I can tell when a new window in VS has become active.

            IVsMonitorSelection selMonitor = GetService(typeof(SVsShellMonitorSelection)) as IVsMonitorSelection;

            if (selMonitor != null)
                selMonitor.AdviseSelectionEvents(this, out cookieForSelection);

            textInformationManager = new TextInformationManager(this, ComponentModel);
            textInformationManager.RefreshSelection += UpdateSelection;
        }
コード例 #2
0
 public CommandFilter(Action actionInView)
 {
     this.actionInView = actionInView;
     this.manager = manager;
 }