Example #1
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, CodeEditorHost codeEditor)
            : base(package)
        {
            this.editor     = codeEditor;
            this.package    = package;
            this.textBuffer = textBuffer;
            FileName        = fileName;

            editorControl         = new Panel();
            editorControl.Content = editor.wpfElement.ToEto();

            previewSplitter           = new PreviewEditorViewSplitter(editorControl, mainAssembly, references, () => textBuffer?.GetText());
            previewSplitter.GotFocus += (sender, e) =>
            {
                WpfTextView?.VisualElement?.Focus();
            };
            preview = previewSplitter.Preview;

            var content = previewSplitter.ToNative(true);

            if (!preview.SetBuilder(fileName))
            {
                throw new InvalidOperationException(string.Format("Could not find builder for file {0}", fileName));
            }
            Content = content;
        }
Example #2
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    preview?.Dispose();
                    preview = null;

                    RegisterIndependentView(false);

                    editorControl?.Dispose();
                    editorControl = null;

                    GC.SuppressFinalize(this);
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Example #3
0
        protected override void Dispose(bool disposing)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            try
            {
                if (disposing)
                {
                    RegisterIndependentView(false);

                    editorControl?.Dispose();
                    editorControl = null;

                    previewSplitter?.Dispose();
                    previewSplitter = null;

                    GC.SuppressFinalize(this);
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }