private void main_Loaded(object sender, RoutedEventArgs e) { g_TabManager = new TabManager(); createBlankTab("default"); g_TabManager = new TabManager(g_files[0]); GetActiveBox().AddHandler(RichTextBox.SelectionChangedEvent, new RoutedEventHandler(RichTextBox_SelectionChanged)); //register event handler to that new document }
}//end getActiveTab private void TabControl_ChangeTab(object sender, SelectionChangedEventArgs e) { //Create dynamic event handler for the newly selected richtext box RichTextBox active = GetActiveBox(); if (active != null) { GetActiveBox().AddHandler(RichTextBox.SelectionChangedEvent, new RoutedEventHandler(RichTextBox_SelectionChanged)); } //Set the title File temp = GetActiveTabObject(); if (temp != null) { //Assign the newly selected tab to tabmanager g_TabManager = new TabManager(g_files.ElementAt(mainTabControl.SelectedIndex)); if (temp.Path == "") { mainWindow.Title = temp.Tab.Header + " - TextyEdit++"; } else { mainWindow.Title = temp.Path + " - TextyEdit++"; } } }//end of Tab change
private void TabControl_ChangeTab(object sender, SelectionChangedEventArgs e) { //Create dynamic event handler for the newly selected richtext box RichTextBox active = GetActiveBox(); if(active != null) GetActiveBox().AddHandler(RichTextBox.SelectionChangedEvent, new RoutedEventHandler(RichTextBox_SelectionChanged)); //Set the title File temp = GetActiveTabObject(); if (temp != null) { //Assign the newly selected tab to tabmanager g_TabManager = new TabManager(g_files.ElementAt(mainTabControl.SelectedIndex)); if (temp.Path == "") mainWindow.Title = temp.Tab.Header + " - TextyEdit++"; else mainWindow.Title = temp.Path + " - TextyEdit++"; } }