コード例 #1
0
        public CSharpInteractiveDemo(VisualStudioInstanceFactory instanceFactory)
        {
            _visualStudio = instanceFactory.GetNewOrUsedInstance();

            _interactiveWindow = _visualStudio.Instance.CSharpInteractiveWindow;

            _interactiveWindow.ShowAsync().GetAwaiter().GetResult();
            _interactiveWindow.ResetAsync().GetAwaiter().GetResult();
        }
コード例 #2
0
        public VisualStudioInstance(Process process, DTE dte)
        {
            _hostProcess = process;
            _dte         = dte;

            ExecuteDteCommandAsync("Tools.StartIntegrationTestService").GetAwaiter().GetResult();

            _serviceChannel = new IpcClientChannel($"ipc channel client for {_hostProcess.Id}", sinkProvider: null);
            ChannelServices.RegisterChannel(_serviceChannel, ensureSecurity: true);

            // Connect to a 'well defined, shouldn't conflict' IPC channel
            _serviceUri = string.Format($"ipc://{IntegrationService.PortNameFormatString}", _hostProcess.Id);
            _service    = (IntegrationService)(Activator.GetObject(typeof(IntegrationService), $"{_serviceUri}/{typeof(IntegrationService).FullName}"));

            _csharpInteractiveWindow = new Lazy <InteractiveWindow>(() => InteractiveWindow.CreateCSharpInteractiveWindow(this));
            _editorWindow            = new Lazy <EditorWindow>(() => new EditorWindow(this));
            _solutionExplorer        = new Lazy <SolutionExplorer>(() => new SolutionExplorer(this));
        }