Esempio n. 1
0
 private void InitComponents()
 {
     if (!Directory.Exists(Constants.btwTopDir))
     {
         Directory.CreateDirectory(Constants.btwTopDir);
     }
     this.ListBtwDirs();
     this.StartingNumberMaxLength = 7;
     this.ObsPrintHistoryVMs      = new ObservableCollection <PrintHistoryViewModel>();
     this.SelectedDate            = DateTime.Today;
     this.StartingNumber          = 1;
     this.ReadFieldsAliasXml();
     SqliteHistory.CreateDb();
     this.labelOperator = new LabelOperator(this.BtEngine);
     try
     {
         this.serialPort = new SerialPort(Constants.SerialPortComName, 9600);
         this.serialPort.DataReceived += SerialPort_DataReceived;
         this.serialPort.Open();
     }
     catch (Exception ex)
     {
         Log.Instance.Logger.Error($"初始化串口出错{ex.Message}");
         this.Message = $"初始化串口出错{ex.Message}";
     }
 }