Пример #1
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.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.guidPasteToTargetCmdSet, (int)PkgCmdIDList.cmdidPasteToTarget);
                MenuCommand menuItem      = new MenuCommand(OnPasteToTargetClicked, menuCommandID);
                mcs.AddCommand(menuItem);
            }

            DTE2 dte = GetService(typeof(SDTE)) as DTE2;

            if (dte != null)
            {
                m_packageEvents = dte.Events.DTEEvents;
                m_packageEvents.OnBeginShutdown += DTEEvents_OnBeginShutdown;
            }

            m_activity = new PasteToTargetActivity();
        }
Пример #2
0
 private void DTEEvents_OnBeginShutdown()
 {
     m_activity.Dispose();
     m_activity = null;
 }