private void Window_CR(object sender, EventArgs e) { MainTabControl.AddHandler(TabControl.SelectionChangedEvent, new RoutedEventHandler(TabControl_SelectionChanged)); try { BuildDataGrid.ItemsSource = null; BuildDataGrid.ItemsSource = loadAndDisplayCsvFile(UniversalConstants.CurrentDirectory + "ShipBuildLog.csv").DefaultView; } catch (FileNotFoundException) { MessageBox.Show("没有对应的记录!"); } catch { } }