/// <summary> /// This event is handled when user select another editor tab. /// </summary> /// <param name="sender">The instance of code editor</param> /// <param name="e"></param> private void CodeEditorBox_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { SyntaxHighlightBox codeEditorBox = (SyntaxHighlightBox)sender; // We need to know when editor TextChanged event is raised because of the changed context codeEditorBox.Tag = ConfigManager.TabChangedTag; }
/// <summary> /// This method initializes the CodeEditorBox property /// </summary> /// <param name="codeEditorBox"></param> public void InitializeCodeEditorBox(SyntaxHighlightBox codeEditorBox) { // It is necessary to null check, because the tab removal causes the CodeEditorBox_Loaded event and this method //to be raised/called again. So when the CodeEditorBox is already initialized we do not need to do initialization again. if (CodeEditorBox == null) { CodeEditorBox = codeEditorBox; // Just remove a temporal element by index 0, because it is useless now TabItemsSource.RemoveAt(0); } }
public Editor(FileInfo file) { File = file; UI = new SyntaxHighlightBox { IsLineNumbersMarginVisible = true, FontFamily = new FontFamily("Consolas"), CurrentHighlighter = HighlighterManager.Instance.Highlighters["CRL"] }; }