/// <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()
        {
            _dte     = GetService(typeof(DTE)) as DTE2;
            Instance = this;

            Logger.Initialize(this, "BindingRedirects Doctor");

            _commandService = (OleMenuCommandService)GetService(typeof(IMenuCommandService));
            AddCommand(0x0100, (s, e) => { System.Threading.Tasks.Task.Run(() => FixBindingRedirects()); }, CheckFixCommandVisibility);
        }
Ejemplo n.º 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 async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            _dte = await GetServiceAsync(typeof(DTE)) as DTE2;

            Assumes.Present(_dte);
            Instance = this;

            Logger.Initialize(this, "BindingRedirects Doctor");

            _commandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            Assumes.Present(_commandService);
            AddCommand(0x0100, (s, e) => {
                ThreadHelper.JoinableTaskFactory.RunAsync(() => FixBindingRedirectsAsync());
            });
        }