public void CreateEditor() { this.editor = new ICSharpCode.AvalonEdit.TextEditor(); using (System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Program.BasePath + "config/squirrel.xshd")) { try { this.editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); } catch (System.IO.FileNotFoundException) { this.WriteToConsole("Could not read syntax highlighter definitions file."); } } editor.TextChanged += delegate(object s, System.EventArgs args) { this.EditorTextChanged(); }; editor.TextArea.TextEntered += delegate(object s, System.Windows.Input.TextCompositionEventArgs args) { this.EditorTextChanged(); }; this.RegisterCompletionEvents(); this.editor.FontFamily = new System.Windows.Media.FontFamily("Consolas, Courier New"); this.editor.WordWrap = false; this.editor.ShowLineNumbers = true; this.editor.FontSize = 13; // code folding foldingManager = ICSharpCode.AvalonEdit.Folding.FoldingManager.Install(editor.TextArea); foldingStrategy = new AvalonEdit.Sample.BraceFoldingStrategy(); this.foldingStrategy.UpdateFoldings(this.foldingManager, this.editor.Document); this.editorHost.Child = this.editor; }
public void CreateEditor(){ this.editor = new ICSharpCode.AvalonEdit.TextEditor(); using (System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Program.BasePath + "config/squirrel.xshd")) { try { this.editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); } catch (System.IO.FileNotFoundException) { this.WriteToConsole("Could not read syntax highlighter definitions file."); } } editor.TextChanged += delegate(object s, System.EventArgs args) { this.EditorTextChanged(); }; editor.TextArea.TextEntered += delegate(object s, System.Windows.Input.TextCompositionEventArgs args) { this.EditorTextChanged(); }; this.RegisterCompletionEvents(); this.editor.FontFamily = new System.Windows.Media.FontFamily("Consolas, Courier New"); this.editor.WordWrap = false; this.editor.ShowLineNumbers = true; this.editor.FontSize = 13; // code folding foldingManager = ICSharpCode.AvalonEdit.Folding.FoldingManager.Install(editor.TextArea); foldingStrategy = new AvalonEdit.Sample.BraceFoldingStrategy(); this.foldingStrategy.UpdateFoldings(this.foldingManager, this.editor.Document); this.editorHost.Child = this.editor; }