Exemple #1
0
 /// <summary>
 /// 初始化串口主配置
 /// </summary>
 public void InitSerialMainConfig()
 {
     SerialMainConfig.Path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "SerialMainConfig.config";
     objSerialMainConfig   = Json.ReadFile <SerialMainConfig>(SerialMainConfig.Path);
     if (objSerialMainConfig == null)
     {
         objSerialMainConfig = new SerialMainConfig();
         objSerialMainConfig.ResetConfig();
     }
 }
Exemple #2
0
        /// <summary>
        /// 初始化串口主配置UI
        /// </summary>
        /// <param name="serialMainConfig"></param>
        private void InitSerialMainConfigUI(SerialMainConfig serialMainConfig)
        {
            chkSaveSerial1Config.Checked     = serialMainConfig.IsSaveConfig1;
            chkSaveSerial2Config.Checked     = serialMainConfig.IsSaveConfig2;
            chkAutoLinkSerial1.Checked       = serialMainConfig.IsAutoLink1;
            chkAutoLinkSerial2.Checked       = serialMainConfig.IsAutoLink2;
            comboSerial1Encode.SelectedIndex = serialMainConfig.SerialEncode1;
            comboSerial2Encode.SelectedIndex = serialMainConfig.SerialEncode2;

            SelectComboText(cbBaudRate1, serialMainConfig.ConfigCom1.BaudRate.ToString());
            SelectComboText(cbBaudRate2, serialMainConfig.ConfigCom2.BaudRate.ToString());
            SelectComboText(cbDataBits1, serialMainConfig.ConfigCom1.DataBits.ToString());
            SelectComboText(cbDataBits2, serialMainConfig.ConfigCom2.DataBits.ToString());
            SelectComboText(cbStop1, serialMainConfig.ConfigCom1.StopBits.ToString());
            SelectComboText(cbStop2, serialMainConfig.ConfigCom2.StopBits.ToString());
            SelectComboText(cbParity1, serialMainConfig.ConfigCom1.Parity.ToString());
            SelectComboText(cbParity2, serialMainConfig.ConfigCom2.Parity.ToString());
        }