private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (Configure == null) return;
     CloneConfigure dialog = new CloneConfigure() { ParentName = Configure.Name };
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Configure conf = new Configure();
         conf.Name = dialog.NewConfigureName;
         conf.ExamRecord = Configure.ExamRecord;
         conf.PrintSubjectList.AddRange(Configure.PrintSubjectList);
         conf.RankFilterTagList.AddRange(Configure.RankFilterTagList);
         conf.RankFilterTagName = Configure.RankFilterTagName;
         conf.RefenceExamRecord = Configure.RefenceExamRecord;
         conf.SchoolYear = Configure.SchoolYear;
         conf.Semester = Configure.Semester;
         conf.SubjectLimit = Configure.SubjectLimit;
         conf.StudentLimit = Configure.StudentLimit;
         conf.TagRank1SubjectList.AddRange(Configure.TagRank1SubjectList);
         conf.TagRank1TagList.AddRange(Configure.TagRank1TagList);
         conf.TagRank1TagName = Configure.TagRank1TagName;
         conf.TagRank2SubjectList.AddRange(Configure.TagRank2SubjectList);
         conf.TagRank2TagList.AddRange(Configure.TagRank2TagList);
         conf.TagRank2TagName = Configure.TagRank2TagName;
         conf.Template = Configure.Template;
         conf.Encode();
         conf.Save();
         _Configures.Add(conf);
         cboConfigure.Items.Insert(cboConfigure.Items.Count - 1, conf);
         cboConfigure.SelectedIndex = cboConfigure.Items.Count - 2;
     }
 }
 private void cboConfigure_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboConfigure.SelectedIndex == cboConfigure.Items.Count - 1)
     {
         //新增
         btnSaveConfig.Enabled = btnPrint.Enabled = false;
         NewConfigure dialog = new NewConfigure();
         if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Configure = new Configure();
             Configure.Name = dialog.ConfigName;
             Configure.Template = dialog.Template;
             Configure.SubjectLimit = dialog.SubjectLimit;
             Configure.StudentLimit = dialog.StudentLimit;
             Configure.SchoolYear = _DefalutSchoolYear;
             Configure.Semester = _DefaultSemester;
             if (cboExam.Items.Count > 0)
                 Configure.ExamRecord = (ExamRecord)cboExam.Items[0];
             _Configures.Add(Configure);
             cboConfigure.Items.Insert(cboConfigure.SelectedIndex, Configure);
             cboConfigure.SelectedIndex = cboConfigure.SelectedIndex - 1;
             Configure.Encode();
             Configure.Save();
         }
         else
         {
             cboConfigure.SelectedIndex = -1;
         }
     }
     else
     {
         if (cboConfigure.SelectedIndex >= 0)
         {
             btnSaveConfig.Enabled = btnPrint.Enabled = true;
             Configure = _Configures[cboConfigure.SelectedIndex];
             if (Configure.Template == null)
                 Configure.Decode();
             if (!cboSchoolYear.Items.Contains(Configure.SchoolYear))
                 cboSchoolYear.Items.Add(Configure.SchoolYear);
             cboSchoolYear.Text = Configure.SchoolYear;
             cboSemester.Text = Configure.Semester;
             if (Configure.ExamRecord != null)
             {
                 foreach (var item in cboExam.Items)
                 {
                     if (((ExamRecord)item).ID == Configure.ExamRecord.ID)
                     {
                         cboExam.SelectedIndex = cboExam.Items.IndexOf(item);
                         break;
                     }
                 }
             }
             cboRefExam.SelectedIndex = -1;
             if (Configure.RefenceExamRecord != null)
             {
                 foreach (var item in cboRefExam.Items)
                 {
                     if (((ExamRecord)item).ID == Configure.RefenceExamRecord.ID)
                     {
                         cboRefExam.SelectedIndex = cboRefExam.Items.IndexOf(item);
                         break;
                     }
                 }
             }
             cboRankRilter.Text = Configure.RankFilterTagName;
             foreach (ListViewItem item in listViewEx1.Items)
             {
                 item.Checked = Configure.PrintSubjectList.Contains(item.Text);
             }
             cboTagRank1.Text = Configure.TagRank1TagName;
             foreach (ListViewItem item in listViewEx2.Items)
             {
                 item.Checked = Configure.TagRank1SubjectList.Contains(item.Text);
             }
             cboTagRank2.Text = Configure.TagRank2TagName;
             foreach (ListViewItem item in listViewEx3.Items)
             {
                 item.Checked = Configure.TagRank2SubjectList.Contains(item.Text);
             }
         }
         else
         {
             Configure = null;
             cboSchoolYear.SelectedIndex = -1;
             cboSemester.SelectedIndex = -1;
             cboExam.SelectedIndex = -1;
             cboRefExam.SelectedIndex = -1;
             cboRankRilter.SelectedIndex = -1;
             cboTagRank1.SelectedIndex = -1;
             cboTagRank2.SelectedIndex = -1;
             foreach (ListViewItem item in listViewEx1.Items)
             {
                 item.Checked = false;
             }
             foreach (ListViewItem item in listViewEx2.Items)
             {
                 item.Checked = false;
             }
             foreach (ListViewItem item in listViewEx3.Items)
             {
                 item.Checked = false;
             }
         }
     }
 }