private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { foreach (UI.Tab.TabItem te in tabControl.Items) { current = te; define(); // if save == false if (te.saved == false) { MessageBoxResult output = System.Windows.MessageBox.Show("ok do you wan't to close without saving ? " + current.fileName, "delete file?", MessageBoxButton.YesNoCancel); string output_string = output.ToString(); if (output_string == "Cancel") { e.Cancel = true; break; } else if (output_string == "No") { FileEdit.Save(); define(); } } } }
private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { // tabControl.Items[selectedTabIndex] = current; current = tabControl.SelectedItem as UI.Tab.TabItem; selectedTabIndex = tabControl.Items.IndexOf(current); if (current == null) { tabControl.Items.MoveCurrentToPrevious(); if (tabControl.HasItems == false) { newTab("New tab"); } } define(); }