protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) { _editor = this.FindControl <Standard.CodeEditor.CodeEditor>("editor"); _editor.RequestTooltipContent += _editor_RequestTooltipContent; shell = IoC.Get <IShell>(); _editor.GetObservable(AvalonStudio.Controls.Standard.CodeEditor.CodeEditor.IsDirtyProperty).Subscribe(dirty => { if (dirty && DataContext is EditorViewModel editorVm) { editorVm.Dock = Dock.Left; // Selecting the document event though it already is, causes it to be removed from the temporary document cache. editorVm.IsTemporary = false; shell.SelectedDocument = editorVm; } }); }
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) { _editor = this.FindControl <Standard.CodeEditor.CodeEditor>("editor"); _editor.RequestTooltipContent += _editor_RequestTooltipContent; shell = IoC.Get <IShell>(); _editor.GetObservable(AvalonStudio.Controls.Standard.CodeEditor.CodeEditor.IsDirtyProperty).Subscribe(dirty => { if (dirty && DataContext is EditorViewModel editorVm) { editorVm.Dock = Dock.Left; // Selecting the document event though it already is, causes it to be removed from the temporary document cache. editorVm.IsTemporary = false; shell.SelectedDocument = editorVm; } }); _editor.AddHandler(PointerWheelChangedEvent, (sender, ee) => { _editorViewModel?.OnPointerWheelChanged(ee); }, Avalonia.Interactivity.RoutingStrategies.Tunnel, handledEventsToo: true); }
public void Dispose() { _editor = null; _textArea = null; }