private void buttonImport_Click(object sender, EventArgs e) { if (!DataService.checkOutModified(packName, pack.lines)) { OpenFileDialog sfd = new OpenFileDialog(); sfd.Title = "选择文件"; sfd.InitialDirectory = "F://"; sfd.FileName = packName; sfd.Filter = "Csv files (*.csv)|*.csv|All files (*.*)|*.*"; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { pack.ImportPackData(sfd.FileName, true); DataService.resetData(packName, pack); MessageBox.Show("导入完成!"); Close(); } sfd.Dispose(); } }