public void Dispose()
 {
     if (fileSerivce != null)
     {
         fileSerivce = null;
     }
 }
 public void Init()
 {
     FileService      = new FileService();
     this.WindowState = FormWindowState.Maximized;
     LabelFontPtAndHeightInit();
     if (Directory.Exists(ConfigHelper.RepportFileSavePath) == false)
     {
         Directory.CreateDirectory(ConfigHelper.RepportFileSavePath);
     }
     保存路径ToolStripMenuItem.Enabled = User.Now.IsManager;
     仪表位号ToolStripMenuItem.Enabled = User.Now.IsManager;
     labelIsManager.Text           = "操作人员:" + (User.Now.IsManager ? "管理员 " : "用户 ") + User.Now.Name;
     GroupBoxInit();
     SerialPortInit();
     RenewAllDevicesUi();
 }
 public SerialPort[] FromFiles()
 {
     fileSerivce = new FileService();
     int[] parityIndexs; int[] stopBitsIndexs; int[] baudRateIndexs;
     if (fileSerivce.ReadSerialPortConfig(out parityIndexs, out stopBitsIndexs, out baudRateIndexs) == true)
     {
         return(new SerialPort[]
         {
             Default,
             Default,
         });
     }
     return(new SerialPort[]
     {
         Default,
         Default,
     });
 }
 public bool SaveToFiles(int[] parityIndexs, int[] stopBitsIndexs, int[] baudRateIndexs)
 {
     fileSerivce = new FileService();
     return(fileSerivce.SaveSerialPortConfig(parityIndexs, stopBitsIndexs, baudRateIndexs));
 }
 public void FromFiles(out int[] parityIndexs, out int[] stopBitsIndexs, out int[] baudRateIndexs)
 {
     fileSerivce = new FileService();
     fileSerivce.ReadSerialPortConfig(out parityIndexs, out stopBitsIndexs, out baudRateIndexs);
 }