private void excelImport_Click(object sender, EventArgs e) { try { string fileName = HKOpenFileDialog.selectFile(HKDialogFilter.Excel); ExcelReader reader = ExcelReader.createReader(fileName); List <StuList> list = reader.stuListsClassifyByClass(); Model.Course course = courseRef; foreach (StuList item in list) { if (course.containsStuListByName(item.name)) { course.getStuListByName(item.name).appendStudents(item); } else { course.addStuList(item); } } GlobalStation.shareInstance.librarySave(delegate() { initTabsContent(); }, null); }catch (ExcelReader.ExcelOpenFailedException ex) { MessageBox.Show("文件打开失败:{0}", ex.Message); }catch (HKOpenFileDialog.CancelOpenFileException ex) { Console.WriteLine(ex.Message); } }