public async Task <IInteractiveWindowVisualComponent> GetOrCreateVisualComponent(IInteractiveWindowComponentContainerFactory componentContainerFactory, int instanceId = 0) { Shell.AssertIsOnMainThread(); if (ActiveWindow != null) { // Right now only one instance of interactive window is allowed if (instanceId != 0) { throw new InvalidOperationException("Right now only one instance of interactive window is allowed"); } return(ActiveWindow); } var evaluator = RInstallationHelper.VerifyRIsInstalled(Shell, _settings.RBasePath) ? new RInteractiveEvaluator(RSession, History, Shell, _settings) : (IInteractiveEvaluator) new NullInteractiveEvaluator(); ActiveWindow = componentContainerFactory.Create(instanceId, evaluator); var interactiveWindow = ActiveWindow.InteractiveWindow; interactiveWindow.TextView.Closed += (_, __) => evaluator.Dispose(); _operations.InteractiveWindow = interactiveWindow; await interactiveWindow.InitializeAsync(); ActiveWindow.Container.UpdateCommandStatus(true); return(ActiveWindow); }
public async Task<IInteractiveWindowVisualComponent> GetOrCreateVisualComponent(IInteractiveWindowComponentContainerFactory componentContainerFactory, int instanceId = 0) { // Right now only one instance of interactive window is allowed if (ActiveWindow != null) { throw new InvalidOperationException("Right now only one instance of interactive window is allowed"); } _coreShell.AssertIsOnMainThread(); var evaluator = RInstallationHelper.VerifyRIsInstalled(_coreShell, _settings.RBasePath) ? new RInteractiveEvaluator(RSession, History, _coreShell, _settings) : (IInteractiveEvaluator) new NullInteractiveEvaluator(); ActiveWindow = componentContainerFactory.Create(instanceId, evaluator); var interactiveWindow = ActiveWindow.InteractiveWindow; interactiveWindow.TextView.Closed += (_, __) => evaluator.Dispose(); _operations.InteractiveWindow = interactiveWindow; await interactiveWindow.InitializeAsync(); ActiveWindow.Container.UpdateCommandStatus(true); return ActiveWindow; }