private void FormMain_Load(object sender, EventArgs e) { this.Text = "KMouse Git" + _VersionGit.ToString(); textBox_eKey.Enabled = false; textBox_eKey.Text = Properties.Settings.Default.eKey_string; com.ControlModule_Init(comboBox_COMNumber, comboBox_COMBaudrate, comboBox_COMCheckBit, comboBox_COMDataBit, comboBox_COMStopBit); com.Init(mdbs); bool res = com.Open(); if (res == true) { button_COMOpen.Text = "COM is opened"; button_COMOpen.ForeColor = System.Drawing.Color.Green; //comboBox_COMBaudrate.Enabled = false; comboBox_COMCheckBit.Enabled = false; comboBox_COMDataBit.Enabled = false; comboBox_COMNumber.Enabled = false; comboBox_COMStopBit.Enabled = false; } kq.Init(queue_message); mdbs.Init(kq, com.serialport, queue_message, Action_UpdateModbussState, Delegate_ModbusCallBack_Identify, Delegate_ModbusCallBack_Click, Delegate_ModbusCallBack_Speed); mdbs.echo_en = checkBox_ShowTxt.Checked; }
private void FormMain_Load(object sender, EventArgs e) { string fullPath = this.GetType().Assembly.Location; string exe_name = System.IO.Path.GetFileName(fullPath);//文件名 “Default.aspx” int dot_index = exe_name.IndexOf("."); exe_name = exe_name.Substring(0, dot_index); Param.path_ini_file = ".\\" + exe_name + ".ini"; this.Text = "KMouse Git" + Param._VersionGit.ToString() + "[" + Param.path_ini_file + "]"; Param.LoadIniParameter(); button_BatPath.Text = "Bat: " + Param.ini.bat_path_string; textBox_EKey.Text = Param.ini.eKey_String; textBox_Cycle.Text = Param.ini.cmdlist_cycle.ToString(); textBox_Cmdlist.Text = Param.ini.cmdlist_string; func_op = (eFunc_OP)Param.ini.func_op; com.ControlModule_Init(comboBox_COMNumber, comboBox_COMBaudrate, comboBox_COMCheckBit, comboBox_COMDataBit, comboBox_COMStopBit); com.Init(mdbs); if (Param.ini.com_is_open == true) { bool res = com.Open(); if (res == true) { SetComStatus(res); } } kq.Init(queue_message); mdbs.Init(kq, com.serialport, queue_message, Delegate_ModbusCallBack_Identify, Delegate_ModbusCallBack_Click, Delegate_ModbusCallBack_Speed); mdbs.echo_en = checkBox_ShowUart.Checked; Update_Func_OP_State(); button_Space.Focus(); cmd_list.Init(button_Run, textBox_Cmdlist, textBox_Point, mdbs, this); cmd_list.BatCall(textBox_ComRec, com.serialport); cmd_list.cycle_total = int.Parse(textBox_Cycle.Text); ini_bak = Param.ini; }