예제 #1
0
 /// <summary>
 /// 加载所有配置
 /// </summary>
 private void LoadConfig()
 {
     try
     {
         _nSpace        = Convert.ToInt32(ConfigurationManager.AppSettings["NSpace"]);
         _aSpace        = Convert.ToInt32(ConfigurationManager.AppSettings["ASpace"]);
         _uploadInteval = Convert.ToInt32(ConfigurationManager.AppSettings["UploadInteval"]);
         _uploadLimit   = Convert.ToInt32(ConfigurationManager.AppSettings["UploadLimit"]);
         _logSaveDays   = Convert.ToInt32(ConfigurationManager.AppSettings["LogSaveDays"]);
         _uploadClient  = new WRUpload.ColdChainServer();
         AppendLogText("欢迎使用惊尘物流冷链数据上报系统,正在初始化...");
         _relationList = AiInfoServer.GetAllAiRelation();
         this.Invoke(new MethodInvoker(delegate
         {
             dgvUploadTime.DataSource = AiInfoServer.GetAllUploadTime();
             nudNSpace.Value          = _nSpace;
             nudASpace.Value          = _aSpace;
             nudUploadInteval.Value   = _uploadInteval;
             nudUploadLimit.Value     = _uploadLimit;
             gbUploadConfig.Enabled   = true;
             btnEnd.Enabled           = false;
         }));
         AppendLogText(string.Format("初始化成功,您现在就可以绑定探头或者开始上报了", _logSavePath, _logSaveDays));
         AppendLogText(string.Format("日志保存路径[{0}] 日志保存天数[{1}]", _logSavePath, _logSaveDays));
     }
     catch (Exception ex)
     {
         AppendLogText("加载配置失败,请检查配置文件,错误信息:" + ex.Message);
         MessageBox.Show("错误:" + ex.Message, "加载配置失败,请检查配置文件", MessageBoxButtons.OK, MessageBoxIcon.Error);
         btnAppConfig_Click(null, null);
     }
 }
예제 #2
0
        private void btnBind_Click(object sender, EventArgs e)
        {
            FrmBindPort frm = new FrmBindPort();

            frm.ShowDialog();
            dgvUploadTime.DataSource = AiInfoServer.GetAllUploadTime();
            AppendLogText("打开绑定探头界面,重新加载上报进度");
        }