private void LoadPlate()
 {
     SetHint("");
     try
     {
         OpenFileDialog openFileDialog = new OpenFileDialog();
         if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
         {
             return;
         }
         PlateLayoutDefFile layoutDefFile = new PlateLayoutDefFile();
         var newPlateInfo = layoutDefFile.Read(openFileDialog.FileName);
         if (AlreadyExist(newPlateInfo.Name))
         {
             SetHint(string.Format("板名为:{0}的微孔板已经存在!", newPlateInfo.Name));
             return;
         }
         plates.Add(newPlateInfo);
         lstboxPlates.SelectedIndex = plates.Count - 1;
     }
     catch (Exception ex)
     {
         SetHint(ex.Message);
     }
 }
        private bool WriteAllPlates2File()
        {
            string errMsg     = "";
            bool   allConsist = true;

            foreach (var plateInfo in plates)
            {
                PlateLayoutDefFile layoutDefFile = new PlateLayoutDefFile();
                Trace.WriteLine(string.Format("将板子{0}写到文件", plateInfo.Name));
                string workingFolder = Utility.GetSaveFolder();
                string dstFile       = workingFolder + plateInfo.Name + ".txt";
                if (File.Exists(dstFile))
                {
                    Trace.WriteLine(string.Format("文件已经存在于{0}", dstFile));
                    //throw new Exception(string.Format("文件已经存在于{0}",dstFile));
                }
                bool consist = IsConsistentWithCheckDoc(plateInfo, ref errMsg);
                if (consist)
                {
                    layoutDefFile.Write(dstFile, plateInfo);
                }
                else
                {
                    allConsist = false;
                }
            }
            SetHint(errMsg);
            return(allConsist);
        }