public void OpenFile(string editorText, string tabName, string filepath = "") { TabItem tab = new TabItem(); tab.Header = tabName; LinedTextBox_UC textbox = new LinedTextBox_UC() { Text = editorText, FilePath = filepath, TabName = tabName, Tab_Owner = tab, IsFromJet = true }; if (tabName.ToLower().Contains("analyzer")) { textbox.IsAnalyzerResult = true; } tab.Content = textbox; TabTextEditor_UC.TabController.Items.Add(tab); TabTextEditor_UC.TabController.SelectedIndex = TabTextEditor_UC.TabController.Items.Count - 1; }
private void JetEditor_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if ((Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) && Keyboard.IsKeyDown(Key.S)) { LinedTextBox_UC linedTB = new LinedTextBox_UC(); linedTB.OnSaveAllOpenedFiles(new LinedTextBox_UC.LinedTBEventArgs()); } else if ((Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) && Keyboard.IsKeyDown(Key.S)) { var selectedTab = TabTextEditor_UC.TabController.SelectedItem; foreach (var tab in LinedTextBox_UC.OpenedFiles) { if (tab.Tab_Owner == selectedTab) { tab.OnSaveFile(new LinedTextBox_UC.LinedTBEventArgs()); } } } }