Наследование: IVsRunningDocTableEvents3
        /// <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()
        {
            var dte = (DTE)GetService(typeof(DTE));

            var txtMgr = (IVsTextManager)GetService(typeof(SVsTextManager));
            var runningDocumentTable = new RunningDocumentTable(this);
            var documentFormatter = new DocumentFormatter(txtMgr, dte);
            plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatter);
            runningDocumentTable.Advise(plugin);

            base.Initialize();
        }
Пример #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()
        {
            var dte = (DTE)GetService(typeof(DTE));

            var runningDocumentTable = new RunningDocumentTable(this);
            var defaultConfig        = (VisualStudioConfiguration)GetDialogPage(typeof(VisualStudioConfiguration));

            var documentFormatService = new DocumentFormatService(dte, (doc) => new FormatDocumentConfiguration(doc, defaultConfig));

            plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatService);
            runningDocumentTable.Advise(plugin);

            base.Initialize();
        }
Пример #3
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()
        {
            isAsyncLoadSupported = this.IsAsyncPackageSupported();

            // Only perform initialization if async package framework is not supported
            if (!isAsyncLoadSupported)
            {
                var dte = (DTE)GetService(typeof(DTE));

                var runningDocumentTable = new RunningDocumentTable(this);
                var defaultConfig        = (VisualStudioConfiguration)GetDialogPage(typeof(VisualStudioConfiguration));

                var documentFormatService = new DocumentFormatService(dte, (doc) => new FormatDocumentConfiguration(doc, defaultConfig));
                plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatService);
                runningDocumentTable.Advise(plugin);
            }

            base.Initialize();
        }
Пример #4
0
        public IVsTask Initialize(IAsyncServiceProvider pServiceProvider, IProfferAsyncService pProfferService, IAsyncProgressCallback pProgressCallback)
        {
            if (!isAsyncLoadSupported)
            {
                throw new InvalidOperationException("Async Initialize method should not be called when async load is not supported.");
            }

            return(ThreadHelper.JoinableTaskFactory.RunAsync <object>(async() =>
            {
                var dte = await pServiceProvider.GetServiceAsync <DTE>(typeof(DTE));

                var runningDocumentTable = new RunningDocumentTable(this);
                var defaultConfig = (VisualStudioConfiguration)GetDialogPage(typeof(VisualStudioConfiguration));

                var documentFormatService = new DocumentFormatService(dte, (doc) => new FormatDocumentConfiguration(doc, defaultConfig));
                plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatService);
                runningDocumentTable.Advise(plugin);

                return null;
            }).AsVsTask());
        }
        /// <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()
        {
            var dte = (DTE)GetService(typeof(DTE));

            var runningDocumentTable = new RunningDocumentTable(this);
            var documentFormatService = new DocumentFormatService(dte, () => (ExtensionsCfg)GetDialogPage(typeof(ExtensionsCfg)));
            plugin = new FormatDocumentOnBeforeSave(dte, runningDocumentTable, documentFormatService);
            runningDocumentTable.Advise(plugin);

            base.Initialize();
        }