public async Task ViewAsync(string expression, string title, CancellationToken cancellationToken = default(CancellationToken)) { var evaluation = await EvaluateAsync(expression, _properties, RValueRepresentations.Str(), cancellationToken); if (evaluation != null) { await VsAppShell.Current.SwitchToMainThreadAsync(cancellationToken); var id = Math.Abs(_toolWindowIdBase + expression.GetHashCode() % (Int32.MaxValue - _toolWindowIdBase)); var pane = ToolWindowUtilities.FindWindowPane <VariableGridWindowPane>(id); if (pane == null) { pane = ToolWindowUtilities.ShowWindowPane <VariableGridWindowPane>(id, true); } else { var frame = pane.Frame as IVsWindowFrame; Debug.Assert(frame != null); frame?.Show(); } title = !string.IsNullOrEmpty(title) ? title : evaluation.Expression; pane.SetEvaluation(new VariableViewModel(evaluation, _aggregator), title); } }
public async Task ViewAsync(string expression, string title) { var evaluation = await EvaluateAsync(expression, _properties, RValueRepresentations.Str()) as IRValueInfo; if (evaluation != null) { await VsAppShell.Current.SwitchToMainThreadAsync(); var id = Math.Abs(_toolWindowIdBase + expression.GetHashCode() % (Int32.MaxValue - _toolWindowIdBase)); var existingPane = ToolWindowUtilities.FindWindowPane <VariableGridWindowPane>(id); var frame = existingPane?.Frame as IVsWindowFrame; if (frame != null) { frame.Show(); } else { VariableGridWindowPane pane = ToolWindowUtilities.ShowWindowPane <VariableGridWindowPane>(id, true); frame = (IVsWindowFrame)pane.Frame; frame.SetProperty((int)__VSFPROPID.VSFPROPID_IsWindowTabbed, true); frame.SetFramePos(VSSETFRAMEPOS.SFP_fDock, typeof(VariableGridWindowPane).GUID, 0, 0, 0, 0); title = !string.IsNullOrEmpty(title) ? title : evaluation.Expression; pane.SetEvaluation(new VariableViewModel(evaluation, _aggregator), title); } } }
public Task InvokeAsync(int index) { if (index < _windows.Length) { ToolWindowUtilities.ShowWindowPane <PlotDeviceWindowPane>(_windows[index].InstanceId, true); } return(Task.CompletedTask); }
public Task <CommandResult> InvokeAsync(int index) { if (index < _windows.Length) { ToolWindowUtilities.ShowWindowPane <PlotDeviceWindowPane>(_windows[index].InstanceId, true); } return(Task.FromResult(CommandResult.Executed)); }
/// <summary> /// Displays R help URL in a browser on in the host app-provided window /// </summary> public async Task ShowHelp(string url) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (RToolsSettings.Current.HelpBrowser == HelpBrowserType.External) { Process.Start(url); } else { HelpWindowPane pane = ToolWindowUtilities.ShowWindowPane <HelpWindowPane>(0, focus: false); pane.Component.Navigate(url); } }
public async Task RefreshHistoryInfo() { var info = await PlotContentProvider.GetHistoryInfoAsync(); ActivePlotIndex = info.ActivePlotIndex; PlotCount = info.PlotCount; VsAppShell.Current.DispatchOnUIThread(() => { // We need to push creation of the tool window // so it appears on the first plot if (!VsAppShell.Current.IsUnitTestEnvironment) { ToolWindowUtilities.ShowWindowPane <PlotWindowPane>(0, false); } HistoryChanged?.Invoke(this, EventArgs.Empty); }); }
protected override void Handle() { ToolWindowUtilities.ShowWindowPane <T>(0, true); }
private void ShowVariableGridWindowPane(object parameter) { VariableGridWindowPane pane = ToolWindowUtilities.ShowWindowPane <VariableGridWindowPane>(0, true); pane.SetEvaluation(this); }
protected override void Handle() { // TODO: find ad show all windows ToolWindowUtilities.ShowWindowPane <PlotWindowPane>(0, true); }
protected override void Handle() { ToolWindowUtilities.ShowWindowPane <PlotManagerWindowPane>(0, true); }