示例#1
0
        protected override void Run()
        {
            Document document = IdeApp.Workbench.ActiveDocument;

            if (document == null)
            {
                return;
            }

            var view = document.GetContent <ITextView> ();

            if (view == null)
            {
                return;
            }

            if (view.Selection.IsEmpty)
            {
                // Nothing selected send the line instead.
                ITextSnapshotLine line = view.Caret.Position.BufferPosition.GetContainingLine();
                string            text = line.GetText();

                CSharpInteractivePad.EvaluateText(text);
            }
            else
            {
                foreach (VirtualSnapshotSpan span in view.Selection.VirtualSelectedSpans)
                {
                    string text = span.GetText();
                    CSharpInteractivePad.EvaluateText(text);
                }
            }
        }
示例#2
0
        protected override void Run()
        {
            Document document = IdeApp.Workbench.ActiveDocument;

            if (document?.TextBuffer == null)
            {
                return;
            }

            string text = document.TextBuffer.CurrentSnapshot.GetText();

            CSharpInteractivePad.EvaluateText(text);
        }
        protected override void Run()
        {
            Document document = IdeApp.Workbench.ActiveDocument;

            if (document == null)
            {
                return;
            }

            var view = document.GetContent <ITextView> ();

            if (view == null)
            {
                return;
            }

            ITextSnapshotLine line = view.Caret.Position.BufferPosition.GetContainingLine();
            string            text = line.GetText();

            CSharpInteractivePad.EvaluateText(text);
        }