コード例 #1
0
 public IRSession GetOrCreate(Guid guid, IRHostClientApp hostClientApp) {
     IRSession session;
     if (!_sessions.TryGetValue(guid, out session)) {
         session = new RSessionMock();
         _sessions[guid] = session;
     }
     return session;
 }
コード例 #2
0
        public IRSession GetOrCreate(Guid guid, IRHostClientApp hostClientApp)
        {
            IRSession session;

            if (!_sessions.TryGetValue(guid, out session))
            {
                session         = new RSessionMock();
                _sessions[guid] = session;
            }
            return(session);
        }
コード例 #3
0
ファイル: RHostScript.cs プロジェクト: AlexanderSher/RTVS-Old
        public RHostScript(IRSessionProvider sessionProvider, IRHostClientApp clientApp = null) {
            SessionProvider = sessionProvider;

            Session = SessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, clientApp ?? new RHostClientTestApp());
            Session.IsHostRunning.Should().BeFalse();

            Session.StartHostAsync(new RHostStartupInfo {
                Name = "RHostScript",
                RBasePath = RToolsSettings.Current.RBasePath,
                RHostCommandLineArguments = RToolsSettings.Current.RCommandLineArguments,
                CranMirrorName = RToolsSettings.Current.CranMirror
            }, 50000).Wait();
        }
コード例 #4
0
ファイル: RSession.cs プロジェクト: AlexanderSher/RTVS-Old
        public RSession(int id, IRHostClientApp hostClientApp, Action onDispose) {
            Id = id;
            _hostClientApp = hostClientApp;
            _onDispose = onDispose;
            _disposeToken = DisposeToken.Create<RSession>();
            _disableMutatingOnReadConsole = new CountdownDisposable(() => {
                if (!_delayedMutatedOnReadConsole) {
                    return;
                }

                _delayedMutatedOnReadConsole = false;
                Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty));
            });
        }
コード例 #5
0
        public RHostScript(IRSessionProvider sessionProvider, IRHostClientApp clientApp = null)
        {
            SessionProvider = sessionProvider;

            Session = SessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, clientApp ?? new RHostClientTestApp());
            Session.IsHostRunning.Should().BeFalse();

            Session.StartHostAsync(new RHostStartupInfo {
                Name      = "RHostScript",
                RBasePath = RToolsSettings.Current.RBasePath,
                RHostCommandLineArguments = RToolsSettings.Current.RCommandLineArguments,
                CranMirrorName            = RToolsSettings.Current.CranMirror
            }, 50000).Wait();
        }
コード例 #6
0
        public RSession(int id, IRHostClientApp hostClientApp, Action onDispose)
        {
            Id             = id;
            _hostClientApp = hostClientApp;
            _onDispose     = onDispose;
            _disposeToken  = DisposeToken.Create <RSession>();
            _disableMutatingOnReadConsole = new CountdownDisposable(() => {
                if (!_delayedMutatedOnReadConsole)
                {
                    return;
                }

                _delayedMutatedOnReadConsole = false;
                Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty));
            });
        }
コード例 #7
0
        public RInteractiveWorkflow(IRSessionProvider sessionProvider
                                    , IRHistoryProvider historyProvider
                                    , IActiveWpfTextViewTracker activeTextViewTracker
                                    , IDebuggerModeTracker debuggerModeTracker
                                    , IRHostClientApp hostClientApp
                                    , ICoreShell coreShell
                                    , IRSettings settings
                                    , Action onDispose)
        {
            _activeTextViewTracker = activeTextViewTracker;
            _debuggerModeTracker   = debuggerModeTracker;
            _settings  = settings;
            _coreShell = coreShell;
            _onDispose = onDispose;

            RSession    = sessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, hostClientApp);
            History     = historyProvider.CreateRHistory(this);
            _operations = new RInteractiveWorkflowOperations();

            _activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged;
            RSession.Disconnected += RSessionDisconnected;
        }
コード例 #8
0
        public RInteractiveWorkflow(IRSessionProvider sessionProvider
            , IRHistoryProvider historyProvider
            , IActiveWpfTextViewTracker activeTextViewTracker
            , IDebuggerModeTracker debuggerModeTracker
            , IRHostClientApp hostClientApp
            , ICoreShell coreShell
            , IRSettings settings
            , Action onDispose) {

            _activeTextViewTracker = activeTextViewTracker;
            _debuggerModeTracker = debuggerModeTracker;
            _settings = settings;
            _coreShell = coreShell;
            _onDispose = onDispose;

            RSession = sessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, hostClientApp);
            History = historyProvider.CreateRHistory(this);
            _operations = new RInteractiveWorkflowOperations();

            _activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged;
            RSession.Disconnected += RSessionDisconnected;
        }
コード例 #9
0
 public IRSession GetOrCreate(Guid guid, IRHostClientApp hostClientApp) {
     _disposeToken.ThrowIfDisposed();
     return _sessions.GetOrAdd(guid, id => new RSession(Interlocked.Increment(ref _sessionCounter), hostClientApp, () => DisposeSession(guid)));
 }
コード例 #10
0
 public VsRHostScript(IRHostClientApp clientApp = null) : 
     base(VsAppShell.Current.ExportProvider.GetExportedValue<IRSessionProvider>(), clientApp) {
 }
コード例 #11
0
ファイル: VsRHostScript.cs プロジェクト: nomada2/RTVS
 public VsRHostScript(IRHostClientApp clientApp = null) :
     base(VsAppShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>(), clientApp)
 {
 }
コード例 #12
0
 public IRSession GetOrCreate(Guid guid, IRHostClientApp hostClientApp)
 {
     _disposeToken.ThrowIfDisposed();
     return(_sessions.GetOrAdd(guid, id => new RSession(Interlocked.Increment(ref _sessionCounter), hostClientApp, () => DisposeSession(guid))));
 }