예제 #1
0
        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;
        }
예제 #2
0
        private void button_Func_Click(object sender, EventArgs e)
        {
            if (func_op == eFunc_OP.EKEY)
            {
                func_op            = eFunc_OP.CMDLIST;
                button_Run.Enabled = true;
            }
            else if (func_op == eFunc_OP.CMDLIST)
            {
                func_op            = eFunc_OP.NULL;
                button_Run.Enabled = false;
            }
            else
            {
                func_op            = eFunc_OP.EKEY;
                button_Run.Enabled = true;
            }

            Update_Func_OP_State();
        }