public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app)
            : base(null, element)
        {
            _app   = app;
            _title = title;

            var compModel          = _app.GetService <IComponentModel>(typeof(SComponentModel));
            var replWindowProvider = compModel.GetService <InteractiveWindowProvider>();

            _replWindow = replWindowProvider
#if DEV14_OR_LATER
                          .AllOpenWindows
#else
                          .GetReplWindows()
#endif
                          .OfType <ToolWindowPane>()
                          .FirstOrDefault(p => p.Caption.Equals(title, StringComparison.CurrentCulture));
#if DEV14_OR_LATER
            _interactive = ((IVsInteractiveWindow)_replWindow).InteractiveWindow;
#else
            _interactive = (IReplWindow)_replWindow;
#endif

            _replWindowInfo = _replWindows.GetValue(_replWindow, window => {
                var info = new InteractiveWindowInfo();
                _interactive.ReadyForInput += new Action(info.OnReadyForInput);
                return(info);
            });
        }
        private InteractiveWindowInfo CreateInteractiveWindowInternal(IInteractiveEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId)
        {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model   = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveInteractiveInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            __VSCREATETOOLWIN creationFlags = 0;

            if (!roles.Contains("DontPersist"))
            {
                creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate;
            }

            var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags);

            replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType);
            replWindow.InteractiveWindow.InitializeAsync();

            return(_windows[id] = new InteractiveWindowInfo(replWindow, replId));
        }
        private InteractiveWindowInfo CreateInteractiveWindowInternal(IInteractiveEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId) {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveInteractiveInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            __VSCREATETOOLWIN creationFlags = 0;
            if (!roles.Contains("DontPersist")) {
                creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate;
            }

            var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags);
            replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType);
            replWindow.InteractiveWindow.InitializeAsync();

            return _windows[id] = new InteractiveWindowInfo(replWindow, replId);
        }
Exemple #4
-1
        public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app)
            : base(null, element) {
            _app = app;
            _title = title;

            var compModel = _app.GetService<IComponentModel>(typeof(SComponentModel));
            var replWindowProvider = compModel.GetService<InteractiveWindowProvider>();
            _replWindow = replWindowProvider
#if DEV14_OR_LATER
                .GetReplToolWindows()
#else
                .GetReplWindows()
#endif
                .OfType<ToolWindowPane>()
                .FirstOrDefault(p => p.Caption.Equals(title, StringComparison.CurrentCulture));
#if DEV14_OR_LATER
            _interactive = ((IVsInteractiveWindow)_replWindow).InteractiveWindow;
#else
            _interactive = (IReplWindow)_replWindow;
#endif

            _replWindowInfo = _replWindows.GetValue(_replWindow, window => {
                var info = new InteractiveWindowInfo();
                _interactive.ReadyForInput += new Action(info.OnReadyForInput);
                return info;
            });
        }