Пример #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);
            }
        }
Пример #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);
                }
            }
        }
Пример #3
0
        protected override void SetStatus()
        {
            var variableWindowPane = ToolWindowUtilities.FindWindowPane <VariableWindowPane>(0);

            // 'Delete all variables' button should be enabled only when the Global environment
            // is selected in Variable Explorer.
            Enabled = (variableWindowPane?.IsGlobalREnvironment()) ?? false;
        }