예제 #1
0
 public SendToWindow(string documentPath, TextViewSelection selection)
 {
     InitializeComponent();
     this._documentPath  = documentPath;
     this._selectionText = selection;
     this.Loaded        += (s, e) => this.SelectionTextBox.Text = selection.Text;
 }
예제 #2
0
        private void MenuItemCallback(object sender, EventArgs e)
        {
            TextViewSelection selection = GetSelection(ServiceProvider);

            Console.WriteLine("Here : " + selection);
            string activeDocumentPath = GetActiveFilePath(ServiceProvider);

            ShowSendToWindow(activeDocumentPath, selection);
        }
예제 #3
0
        private TextViewSelection GetSelection(IServiceProvider serviceProvider)
        {
            var         service     = serviceProvider.GetService(typeof(SVsTextManager));
            var         textManager = service as IVsTextManager2;
            IVsTextView view;
            int         result = textManager.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out view);

            view.GetSelection(out int startLine, out int startColumn, out int endLine, out int endColumn);//end could be before beginning
            var start = new TextViewPosition(startLine, startColumn);
            var end   = new TextViewPosition(endLine, endColumn);

            view.GetSelectedText(out string selectedText);

            TextViewSelection selection = new TextViewSelection(start, end, selectedText);

            return(selection);
        }
예제 #4
0
        private void ShowSendToWindow(string activeDocumentPath, TextViewSelection selection)
        {
            var documentationControl = new SendToWindow(activeDocumentPath, selection);

            documentationControl.ShowDialog();
        }
예제 #5
0
 public CodeViewModel(string documentPath, TextViewSelection selection) : this()
 {
     this._documentPath = documentPath;
     this._selection    = selection;
 }