示例#1
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (this.checkBox1.Checked)
     {
         Kuozhan.putxmlstring(datasize.tanchuangid.ToString(), "st0");
     }
     else
     {
         Kuozhan.putxmlstring("a", "st0");
     }
 }
示例#2
0
文件: sysset.cs 项目: skyclub66/HMI
        private void savecodemessage(string key, codemessagetype m1)
        {
            string path = string.Concat(new string[]
            {
                m1.allen.ToString(),
                "-",
                m1.keyword.ToString(),
                "-",
                m1.comshow.ToString(),
                "-",
                m1.mouseshow.ToString()
            });

            Kuozhan.putxmlstring(path, key);
        }
示例#3
0
文件: Comuser.cs 项目: skyclub66/HMI
        private int lianji(TextBox text1, string portname, int bo, bool islaodmessage_, bool qiangzhi, bool iscrc)
        {
            this.islaodmessage = islaodmessage_;
            List <int> list = new List <int>();

            list.Clear();
            this.lcoms.Clear();
            if (bo == 0 && this.Oldbo > 0)
            {
                list.Add(this.Oldbo);
            }
            if ((portname == "" || portname.Contains("自动搜索".Language())) && this.Oldcom != "")
            {
                this.lcoms.Add(this.Oldcom);
            }
            if (bo == 0)
            {
                foreach (int current in this.Bot)
                {
                    list.Add(current);
                }
            }
            else
            {
                list.Add(bo);
            }
            if (portname == "" || portname.Contains("自动搜索".Language()))
            {
                try
                {
                    string[] portNames = SerialPort.GetPortNames();
                    string[] array     = portNames;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string item = array[i];
                        this.lcoms.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    MessageOpen.Show("获取计算机COM口列表失败!\r\n错误信息:".Language() + ex.Message);
                }
            }
            else
            {
                this.lcoms.Add(portname);
            }
            int result;

            foreach (string current2 in this.lcoms)
            {
                Win32.timeBeginPeriod(1);
                for (int j = 0; j < list.Count; j++)
                {
                    if (this.State == 2)
                    {
                        this.comclose();
                        text1.Text = "联机失败".Language() + "\r\n";
                        result     = 0;
                        return(result);
                    }
                    text1.Text = string.Concat(new string[]
                    {
                        "尝试联机".Language(),
                        current2,
                        ":",
                        list[j].ToString(),
                        "\r\n"
                    });
                    this.comclose();
                    if (this.comopen(current2, list[j]))
                    {
                        this.Cleargetbuff();
                        this.Doyanshi(400);
                        this.com1.sendstring_End("00", iscrc, null);
                        this.com1.sendstring_End("connect", iscrc, null);
                        int yanshi = 1800000 / list[j] + 50;
                        this.Doyanshi(yanshi);
                        int num = this.Getcomstr();
                        if (num == 1)
                        {
                            string text2 = "S" + this.gujianver.ToString();
                            this.botelv = list[j];
                            string text3 = "none";
                            if (this.touch == 0)
                            {
                                text3 = "不带触摸".Language();
                            }
                            if (this.touch == 1)
                            {
                                text3 = "电阻式触摸".Language();
                            }
                            if (this.touch == 2)
                            {
                                text3 = "电容式触摸".Language();
                            }
                            text1.Text = string.Concat(new string[]
                            {
                                "联机成功!串口号:".Language(),
                                current2,
                                ",设备当前波特率:".Language(),
                                this.botelv.ToString(),
                                ",",
                                "设备型号:".Language(),
                                this.xinghao,
                                "(",
                                text3,
                                ")",
                                ",固件版本:".Language(),
                                text2,
                                ",",
                                "设备序列号:".Language(),
                                this.FlashIDstring,
                                ",CPUID:",
                                this.cpuchip.ToString(),
                                ",",
                                "Flash容量:".Language(),
                                this.FlashSize.ToString(),
                                "(",
                                (this.FlashSize / 1024 / 1024).ToString(),
                                "MB)\r\n"
                            });
                            this.com1.sendstring_End("runmod=2", iscrc, null);
                            this.jiance(yanshi, qiangzhi, iscrc);
                            this.com1.sendstring_End("runmod=0", iscrc, null);
                            this.Cleargetbuff();
                            Kuozhan.putxmlstring(list[j].ToString(), "oldbo_");
                            Kuozhan.putxmlstring(current2, "oldcom_");
                            this.Oldbo  = list[j];
                            this.Oldcom = current2;
                            result      = 1;
                            return(result);
                        }
                        if (num == 2)
                        {
                            text1.Text = "进入设备固件恢复!".Language() + "\r\n";
                            result     = 2;
                            return(result);
                        }
                        if (num == 3)
                        {
                            result = 3;
                            return(result);
                        }
                    }
                }
            }
            text1.Text = "联机失败".Language() + "\r\n";
            result     = 0;
            return(result);
        }