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); }
private string ValidateRBasePath(string path) { // If path is null, folder selector dialog was canceled if (path != null) { path = RInstallation.NormalizeRPath(path); bool valid = RInstallationHelper.VerifyRIsInstalled(VsAppShell.Current, path, showErrors: !_allowLoadingFromStorage); if (!valid) { path = null; // Prevents assignment of bad values to the property. } } return(path); }