/// <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 async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            //dte = (DTE)GetGlobalService(typeof(DTE));

            //VSDocumentEvents = dte.Events.DocumentEvents[null];
            //if (VSDocumentEvents != null)
            //{
            //    VSDocumentEvents.DocumentClosing += VSDocumentEvents_DocumentClosing;
            //    VSDocumentEvents.DocumentOpened += VSDocumentEvents_DocumentOpened;
            //    VSDocumentEvents.DocumentOpening += VSDocumentEvents_DocumentOpening;
            //    VSDocumentEvents.DocumentSaved += VSDocumentEvents_DocumentSaved;
            //}

            //VSBuildEvents = dte.Events.BuildEvents;
            //if (VSBuildEvents != null)
            //{
            //    VSBuildEvents.OnBuildBegin += VSBuildEvents_OnBuildBegin;
            //    VSBuildEvents.OnBuildDone += VSBuildEvents_OnBuildDone;
            //    VSBuildEvents.OnBuildProjConfigBegin += VSBuildEvents_OnBuildProjConfigBegin;
            //    VSBuildEvents.OnBuildProjConfigDone += VSBuildEvents_OnBuildProjConfigDone;
            //}

            //VSSolutionEvents = dte.Events.SolutionEvents;
            //if (VSSolutionEvents != null)
            //{
            //    VSSolutionEvents.AfterClosing += VSSolutionEvents_AfterClosing;
            //    VSSolutionEvents.BeforeClosing += VSSolutionEvents_BeforeClosing;
            //    VSSolutionEvents.Opened += VSSolutionEvents_Opened;
            //    VSSolutionEvents.ProjectAdded += VSSolutionEvents_ProjectAdded;
            //    VSSolutionEvents.ProjectRemoved += VSSolutionEvents_ProjectRemoved;
            //    VSSolutionEvents.ProjectRenamed += VSSolutionEvents_ProjectRenamed;
            //    VSSolutionEvents.QueryCloseSolution += VSSolutionEvents_QueryCloseSolution;
            //    VSSolutionEvents.Renamed += VSSolutionEvents_Renamed;
            //}

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            OptionDialogPage page = (OptionDialogPage)GetDialogPage(typeof(OptionDialogPage));

            if (page != null)
            {
                page.RegisterPackage(this);
                page.LoadSettingsFromStorage();
                OptionPage = page;
            }

            BlackSpaceAdornment.Initialize(this);
        }
Пример #2
0
        /// <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()
        {
            base.Initialize();

            //dte = (DTE)GetGlobalService(typeof(DTE));

            //VSDocumentEvents = dte.Events.DocumentEvents[null];
            //if (VSDocumentEvents != null)
            //{
            //    VSDocumentEvents.DocumentClosing += VSDocumentEvents_DocumentClosing;
            //    VSDocumentEvents.DocumentOpened += VSDocumentEvents_DocumentOpened;
            //    VSDocumentEvents.DocumentOpening += VSDocumentEvents_DocumentOpening;
            //    VSDocumentEvents.DocumentSaved += VSDocumentEvents_DocumentSaved;
            //}

            //VSBuildEvents = dte.Events.BuildEvents;
            //if (VSBuildEvents != null)
            //{
            //    VSBuildEvents.OnBuildBegin += VSBuildEvents_OnBuildBegin;
            //    VSBuildEvents.OnBuildDone += VSBuildEvents_OnBuildDone;
            //    VSBuildEvents.OnBuildProjConfigBegin += VSBuildEvents_OnBuildProjConfigBegin;
            //    VSBuildEvents.OnBuildProjConfigDone += VSBuildEvents_OnBuildProjConfigDone;
            //}

            //VSSolutionEvents = dte.Events.SolutionEvents;
            //if (VSSolutionEvents != null)
            //{
            //    VSSolutionEvents.AfterClosing += VSSolutionEvents_AfterClosing;
            //    VSSolutionEvents.BeforeClosing += VSSolutionEvents_BeforeClosing;
            //    VSSolutionEvents.Opened += VSSolutionEvents_Opened;
            //    VSSolutionEvents.ProjectAdded += VSSolutionEvents_ProjectAdded;
            //    VSSolutionEvents.ProjectRemoved += VSSolutionEvents_ProjectRemoved;
            //    VSSolutionEvents.ProjectRenamed += VSSolutionEvents_ProjectRenamed;
            //    VSSolutionEvents.QueryCloseSolution += VSSolutionEvents_QueryCloseSolution;
            //    VSSolutionEvents.Renamed += VSSolutionEvents_Renamed;
            //}

            var page = (OptionDialogPage)GetDialogPage(typeof(OptionDialogPage));

            if (page != null)
            {
                page.RegisterPackage(this);
                page.LoadSettingsFromStorage();
                OptionPage = page;
            }

            BlackSpaceAdornment.Initialize(this);
        }