Ejemplo n.º 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 System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // 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.guidObjectExporter_CmdSet, (int)PkgCmdIDList.cmdidExportObjects);
                var       menuItem      = new OleMenuCommand(MenuItemCallback, menuCommandID);

                menuItem.BeforeQueryStatus += menuItem_BeforeQueryStatus;
                mcs.AddCommand(menuItem);
            }

            //Initialize Object Exporter settings for use with Aspects (can't pass any objects into constructor)
            _packageSettings = (PackageSettings)GetDialogPage(typeof(PackageSettings));
            GlobalPackageSettings.Initialize(_packageSettings);

            //Add user information for exception handling with raygun
            UserInfo info = new UserInfo()
            {
                VisualStudioVersion = _dte2.Version
            };

            Raygun.Initialize(info);

            return(base.InitializeAsync(cancellationToken, progress));
        }
Ejemplo n.º 2
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}", 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.guidObjectExporter_CmdSet, (int)PkgCmdIDList.cmdidExportObjects);
                var       menuItem      = new OleMenuCommand(MenuItemCallback, menuCommandID);

                menuItem.BeforeQueryStatus += menuItem_BeforeQueryStatus;
                mcs.AddCommand(menuItem);
            }

            //Initialize Object Exporter settings for use with Aspects (can't pass any objects into constructor)
            _packageSettings = (PackageSettings)GetDialogPage(typeof(PackageSettings));
            GlobalPackageSettings.Initialize(_packageSettings);

            //Add user information for exception handling with raygun
            UserInfo info = new UserInfo()
            {
                VisualStudioVersion = _dte2.Version
            };

            Raygun.Initialize(info);
        }