Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        public Task InvokeAsync(int index)
        {
            if (index < _windows.Length)
            {
                ToolWindowUtilities.ShowWindowPane <PlotDeviceWindowPane>(_windows[index].InstanceId, true);
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 4
0
        public Task <CommandResult> InvokeAsync(int index)
        {
            if (index < _windows.Length)
            {
                ToolWindowUtilities.ShowWindowPane <PlotDeviceWindowPane>(_windows[index].InstanceId, true);
            }

            return(Task.FromResult(CommandResult.Executed));
        }
Ejemplo n.º 5
0
        /// <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);
            }
        }
Ejemplo n.º 6
0
        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);
            });
        }
Ejemplo n.º 7
0
 protected override void Handle()
 {
     ToolWindowUtilities.ShowWindowPane <T>(0, true);
 }
Ejemplo n.º 8
0
        private void ShowVariableGridWindowPane(object parameter)
        {
            VariableGridWindowPane pane = ToolWindowUtilities.ShowWindowPane <VariableGridWindowPane>(0, true);

            pane.SetEvaluation(this);
        }
Ejemplo n.º 9
0
 protected override void Handle()
 {
     // TODO: find ad show all windows
     ToolWindowUtilities.ShowWindowPane <PlotWindowPane>(0, true);
 }
Ejemplo n.º 10
0
 protected override void Handle()
 {
     ToolWindowUtilities.ShowWindowPane <PlotManagerWindowPane>(0, true);
 }