private async void DocumentViewDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { this.viewModel = (OpenDocumentViewModel)e.NewValue; var container = new LinqPadSourceTextContainer(this.Editor); this.viewModel.Init(container); this.Editor.IntellisenseProvider = new IntellisenseProvider( this.viewModel.MainViewModel.LinqPadEditorHost, this.viewModel.DocumentId); this.Editor.SignatureHelpService = new SignatureHelpService( this.viewModel.MainViewModel.LinqPadEditorHost, this.viewModel.DocumentId); var text = await this.viewModel.LoadText(); this.referencesProvider = new ReferencesProvider(this.viewModel.MainViewModel.LinqPadEditorHost); this.diagnosticService = new DiagnosticsService(this.viewModel.MainViewModel.LinqPadEditorHost); this.colorizerService = new LnqPadColorizerService(this.Editor); this.Editor.TextArea.TextView.BackgroundRenderers.Add(this.colorizerService); this.Editor.AppendText(text); this.Editor.TextChanged += this.EditorTextChanged; this.Editor.ToolTipRequest = this.ToolTipRequest; }
public void Init(LinqPadSourceTextContainer container) { this.DocumentId = this.MainViewModel.LinqPadEditorHost.AddDocument(container); }