Exemplo n.º 1
0
        internal InteractiveWindow(VisualStudioInstance host, string dteViewCommand, string dteWindowTitle)
        {
            _host           = host;
            _dteViewCommand = dteViewCommand;

            // We have to show the window at least once to ensure the interactive service is loaded.
            ShowAsync(waitForPrompt: false).GetAwaiter().GetResult();

            var dteWindow = _host.LocateDteWindowAsync(dteWindowTitle).GetAwaiter().GetResult();

            dteWindow.Close();

            // Return a wrapper to the actual interactive window service that exists in the host process
            _interactiveWindowWrapper = _host.ExecuteOnHostProcess <InteractiveWindowWrapper>(typeof(RemotingHelper), nameof(RemotingHelper.CreateCSharpInteractiveWindowWrapper), (BindingFlags.Public | BindingFlags.Static));
        }
        internal InteractiveWindow(VisualStudioInstance visualStudioInstance, string dteViewCommand, string dteWindowTitle, string createMethodName)
        {
            _visualStudioInstance = visualStudioInstance;
            _dteViewCommand       = dteViewCommand;

            // We have to show the window at least once to ensure the interactive service is loaded.
            ShowAsync(waitForPrompt: false).GetAwaiter().GetResult();

            var dteWindow = IntegrationHelper.WaitForNotNullAsync(() => _visualStudioInstance.Dte.LocateWindow(dteWindowTitle)).GetAwaiter().GetResult();

            IntegrationHelper.RetryRpcCall(() => dteWindow.Close());

            // Return a wrapper to the actual interactive window service that exists in the host process
            var integrationService = _visualStudioInstance.IntegrationService;

            _interactiveWindowWrapper = integrationService.Execute <InteractiveWindowWrapper>(typeof(InteractiveWindowWrapper), createMethodName);
        }