public IVsInteractiveWindow Open(bool focus)
        {
            _vsImmediateWindow = _vsImmediateWindow ?? Create();
            _vsImmediateWindow.Show(focus);

            return _vsImmediateWindow;
        }
        public IVsInteractiveWindow Open(bool focus)
        {
            _vsImmediateWindow = _vsImmediateWindow ?? Create();
            _vsImmediateWindow.Show(focus);

            return(_vsImmediateWindow);
        }
Exemplo n.º 3
0
        internal void Execute(IVsInteractiveWindow vsInteractiveWindow, string title)
        {
            var hierarchyPointer          = default(IntPtr);
            var selectionContainerPointer = default(IntPtr);

            try
            {
                uint itemid;
                IVsMultiItemSelect multiItemSelectPointer;
                Marshal.ThrowExceptionForHR(_monitorSelection.GetCurrentSelection(
                                                out hierarchyPointer, out itemid, out multiItemSelectPointer, out selectionContainerPointer));

                if (hierarchyPointer != IntPtr.Zero)
                {
                    List <string> references, referenceSearchPaths, sourceSearchPaths, namespacesToImport;
                    string        projectDirectory;
                    GetProjectProperties(hierarchyPointer, out references, out referenceSearchPaths, out sourceSearchPaths, out namespacesToImport, out projectDirectory);

                    // Now, we're going to do a bunch of async operations.  So create a wait
                    // indicator so the user knows something is happening, and also so they cancel.
                    var waitIndicator = _componentModel.GetService <IWaitIndicator>();
                    var waitContext   = waitIndicator.StartWait(title, ServicesVSResources.BuildingProject, allowCancel: true);

                    var resetInteractiveTask = ResetInteractiveAsync(
                        vsInteractiveWindow,
                        references.ToImmutableArray(),
                        referenceSearchPaths.ToImmutableArray(),
                        sourceSearchPaths.ToImmutableArray(),
                        namespacesToImport.ToImmutableArray(),
                        projectDirectory,
                        waitContext);

                    // Once we're done resetting, dismiss the wait indicator and focus the REPL window.
                    resetInteractiveTask.SafeContinueWith(
                        _ =>
                    {
                        waitContext.Dispose();

                        // We have to set focus to the Interactive Window *after* the wait indicator is dismissed.
                        vsInteractiveWindow.Show(focus: true);
                    },
                        TaskScheduler.FromCurrentSynchronizationContext());
                }
            }
            finally
            {
                SafeRelease(hierarchyPointer);
                SafeRelease(selectionContainerPointer);
            }
        }
Exemplo n.º 4
0
        public IVsInteractiveWindow Open(int instanceId, bool focus)
        {
            // TODO: we don't support multi-instance yet
            Debug.Assert(instanceId == 0);

            if (_vsInteractiveWindow == null)
            {
                _vsInteractiveWindow = Create(instanceId);
            }

            _vsInteractiveWindow.Show(focus);

            return(_vsInteractiveWindow);
        }
Exemplo n.º 5
0
        internal void Execute(IVsInteractiveWindow vsInteractiveWindow, string title)
        {
            var hierarchyPointer = default(IntPtr);
            var selectionContainerPointer = default(IntPtr);

            try
            {
                uint itemid;
                IVsMultiItemSelect multiItemSelectPointer;
                Marshal.ThrowExceptionForHR(_monitorSelection.GetCurrentSelection(
                    out hierarchyPointer, out itemid, out multiItemSelectPointer, out selectionContainerPointer));

                if (hierarchyPointer != IntPtr.Zero)
                {
                    List<string> references, referenceSearchPaths, sourceSearchPaths, namespacesToImport;
                    string projectDirectory;
                    GetProjectProperties(hierarchyPointer, out references, out referenceSearchPaths, out sourceSearchPaths, out namespacesToImport, out projectDirectory);

                    // Now, we're going to do a bunch of async operations.  So create a wait
                    // indicator so the user knows something is happening, and also so they cancel.
                    var waitIndicator = _componentModel.GetService<IWaitIndicator>();
                    var waitContext = waitIndicator.StartWait(title, ServicesVSResources.BuildingProject, allowCancel: true);

                    var resetInteractiveTask = ResetInteractiveAsync(vsInteractiveWindow, references, referenceSearchPaths, sourceSearchPaths, namespacesToImport, projectDirectory, waitContext);

                    // Once we're done resetting, dismiss the wait indicator and focus the REPL window.
                    resetInteractiveTask.SafeContinueWith(
                        _ =>
                        {
                            waitContext.Dispose();

                            // We have to set focus to the Interactive Window *after* the wait indicator is dismissed.
                            vsInteractiveWindow.Show(focus: true);
                        },
                        TaskScheduler.FromCurrentSynchronizationContext());
                }
            }
            finally
            {
                SafeRelease(hierarchyPointer);
                SafeRelease(selectionContainerPointer);
            }
        }