public RInteractiveWorkflow(IServiceContainer services) { Services = services.Extend() .AddService <IRInteractiveWorkflow>(this) .AddService <IRSessionProvider, RSessionProvider>(); RSession = RSessions.GetOrCreate(SessionNames.InteractiveWindow); _disposableBag = DisposableBag.Create <RInteractiveWorkflow>() .Add(RSessions); }
public RInteractiveWorkflow(IConnectionManagerProvider connectionsProvider , IContainerManagerProvider containerProvider , IRHistoryProvider historyProvider , IRPackageManagerProvider packagesProvider , IRPlotManagerProvider plotsProvider , IActiveWpfTextViewTracker activeTextViewTracker , IDebuggerModeTracker debuggerModeTracker , IServiceManager services) { _services = services .AddService <IRInteractiveWorkflow>(this) .AddService <IConsole, InteractiveWindowConsole>() .AddService <IRSessionProvider, RSessionProvider>() .AddService(s => connectionsProvider.CreateConnectionManager(this)) .AddService(s => containerProvider.CreateContainerManager(this)) .AddService(s => historyProvider.CreateRHistory(this)) .AddService(s => packagesProvider.CreateRPackageManager(this)) .AddService(s => plotsProvider.CreatePlotManager(this)); _settings = _services.GetService <IRSettings>(); _mainThread = _services.MainThread(); _operations = new RInteractiveWorkflowOperations(this, debuggerModeTracker, Services); RSession = RSessions.GetOrCreate(SessionNames.InteractiveWindow); _settings.PropertyChanged += OnSettingsChanged; activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged; RSession.Disconnected += RSessionDisconnected; _disposableBag = DisposableBag.Create <RInteractiveWorkflow>() .Add(() => _settings.PropertyChanged -= OnSettingsChanged) .Add(() => activeTextViewTracker.LastActiveTextViewChanged -= LastActiveTextViewChanged) .Add(() => RSession.Disconnected -= RSessionDisconnected) .Add(Operations) .Add(_services); }