internal ReplWindowProxy(PythonVisualStudioApp app, ReplWindow window, ReplWindowProxySettings settings)
 {
     Assert.IsNotNull(app, "app is required");
     Assert.IsNotNull(window, "window is required");
     _app                   = app;
     _window                = window;
     _settings              = settings;
     _replWindowInfo        = _replWindows.GetOrCreateValue(_window);
     _window.ReadyForInput += _replWindowInfo.OnReadyForInput;
     _editorOperations      = _app.ComponentModel.GetService <IEditorOperationsFactoryService>()
                              .GetEditorOperations(_window.TextView);
 }
        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<IReplWindowProvider>();
            _replWindow = replWindowProvider.GetReplWindows()
                .OfType<ReplWindow>()
                .FirstOrDefault(p => p.Title.Equals(title, StringComparison.CurrentCulture));

            _replWindowInfo = _replWindows.GetValue(_replWindow, window => {
                var info = new ReplWindowInfo();
                window.ReadyForInput += new Action(info.OnReadyForInput);
                return info;
            });
        }
        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 <IReplWindowProvider>();

            _replWindow = replWindowProvider.GetReplWindows()
                          .OfType <ReplWindow>()
                          .FirstOrDefault(p => p.Title.Equals(title, StringComparison.CurrentCulture));

            _replWindowInfo = _replWindows.GetValue(_replWindow, window => {
                var info              = new ReplWindowInfo();
                window.ReadyForInput += new Action(info.OnReadyForInput);
                return(info);
            });
        }
        private ReplWindowInfo CreateReplWindowInternal(IReplEvaluator 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));

            SaveReplInfo(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 ReplWindowInfo(replWindow, replId));
        }
        private ReplWindowInfo CreateReplWindowInternal(IReplEvaluator 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));

            SaveReplInfo(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 ReplWindowInfo(replWindow, replId);
        }