public static async Task InitializeAsync(AsyncPackage package)
        {
            // Switch to the main thread - the call to AddCommand in DependencyGraphToolWindowCommand's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService ?? throw new InvalidOperationException("Command service not found");

            Instance = new DependencyGraphToolWindowCommand(package, commandService);
        }
Exemplo n.º 2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            UserOptionsDialog = GetDialogPage(typeof(UserOptionsDialog)) as UserOptionsDialog;

            await DependencyGraphToolWindowCommand.InitializeAsync(this);
        }