protected virtual void Dispose(bool isDisposing) { if (!isDisposing) { return; } if (this.editorElement != null) { TextCompositionManager.RemoveTextInputStartHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputStart)); TextCompositionManager.RemoveTextInputUpdateHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputUpdate)); this.editorElement.TextInput -= new TextCompositionEventHandler(this.OnTextInput); this.editorElement.KeyDown -= new KeyEventHandler(this.OnKeyDown); this.editorElement.MouseDown -= new MouseButtonEventHandler(this.OnMouseDown); this.editorElement = (FrameworkElement)null; } if (this.codeAidEngine != null) { this.codeAidEngine.Dispose(); this.codeAidEngine = (XamlCodeAidEngine)null; } if (this.undoHistory == null) { return; } this.undoHistory.UndoRedoHappened -= new EventHandler <UndoRedoEventArgs>(this.OnUndoRedoHappened); this.undoHistory = (UndoHistory)null; }
private void EnsureCodeAidEngine() { if (this.xamlCodeAidEngine != null) { return; } this.xamlCodeAidEngine = this.textBuffer.Properties.GetProperty <XamlCodeAidEngine>((object)"XamlCodeAidEngine"); }
public CodeEditorOperations(CodeEditor codeEditor, ICompletionBroker completionBroker, ICodeAidProvider codeAidProvider) { this.editorElement = codeEditor.Element; this.editorOperations = codeEditor.EditorCommands; this.undoHistory = codeEditor.UndoHistory; this.textView = codeEditor.TextView; this.completionBroker = completionBroker; this.codeAidEngine = new XamlCodeAidEngine(codeEditor.TextBuffer, codeAidProvider, codeEditor.Environment); this.editorElement.TextInput += new TextCompositionEventHandler(this.OnTextInput); this.editorElement.KeyDown += new KeyEventHandler(this.OnKeyDown); this.editorElement.MouseDown += new MouseButtonEventHandler(this.OnMouseDown); this.undoHistory.UndoRedoHappened += new EventHandler <UndoRedoEventArgs>(this.OnUndoRedoHappened); TextCompositionManager.AddTextInputStartHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputStart)); TextCompositionManager.AddTextInputUpdateHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputUpdate)); }