public static string GetSubstring(this IVsTextLines buffer, int start, int end)
        {
            string text = buffer.GetText();

            if (!string.IsNullOrEmpty(text))
            {
                return(text.Substring(start, end - start));
            }
            return(string.Empty);
        }
示例#2
0
        void UpdateView()
        {
            var text = textBuffer.GetText();

            if (!string.IsNullOrEmpty(text))
            {
                builder.Create(text, SetChild, error =>
                {
                    previewControl.Content = new Label {
                        Text = error
                    };
                });
            }
        }
示例#3
0
        void UpdateView()
        {
            var text = textBuffer.GetText();

            if (!string.IsNullOrEmpty(text))
            {
                builder.Create(text, SetChild, error =>
                {
                    host.Child = new Label {
                        Text = error
                    }.ToNative(true);
                });
            }
        }
示例#4
0
        /// <summary>
        /// Constructor that calls the Microsoft.VisualStudio.Shell.WindowPane constructor then
        /// our initialization functions.
        /// </summary>
        /// <param name="package">Our Package instance.</param>
        public EtoPreviewPane(EtoAddinPackage package, string fileName, IVsTextLines textBuffer)
            : base(package)
        {
            this.package    = package;
            this.textBuffer = textBuffer;
            FileName        = fileName;

            editorControl = new Panel();
            preview       = new PreviewEditorView(editorControl, () => textBuffer?.GetText());
            if (!preview.SetBuilder(fileName))
            {
                throw new InvalidOperationException(string.Format("Could not find builder for file {0}", fileName));
            }

            Content = preview.ToNative(true);
        }
示例#5
0
        /// <summary>
        /// Constructor that calls the Microsoft.VisualStudio.Shell.WindowPane constructor then
        /// our initialization functions.
        /// </summary>
        /// <param name="package">Our Package instance.</param>
        public EtoPreviewPane(EtoAddinPackage package, string fileName, IVsTextLines textBuffer, string mainAssembly, IEnumerable <string> references)
            : base(package)
        {
            this.package    = package;
            this.textBuffer = textBuffer;
            FileName        = fileName;

            editorControl     = new Panel();
            preview           = new PreviewEditorView(editorControl, mainAssembly, references, () => textBuffer?.GetText());
            preview.GotFocus += (sender, e) =>
            {
                wpfViewHost?.TextView?.VisualElement?.Focus();
            };
            if (!preview.SetBuilder(fileName))
            {
                throw new InvalidOperationException(string.Format("Could not find builder for file {0}", fileName));
            }

            var content = preview.ToNative(true);

            Content = content;
        }