示例#1
0
        private void btn_updatefw_Click(object sender, EventArgs e)
        {
            if (lb_addrfrom.SelectedIndex < 0)
            {
                Program.MsgShow(GetText("select_addrfrom"));
                return;
            }

            this.Invoke(new VoidHandler(this.hidebtn));
            string ret = "";

            foreach (byte i in nodemap.Keys)
            {
                if (lb_addrfrom.SelectedIndex == 0 || i == nodelist[lb_addrfrom.SelectedIndex])
                {
                    progressBar_fw.Visible = true;
                    progressBar_fw.Minimum = 0;
                    progressBar_fw.Maximum = (int)(fwlen / 128);
                    curr_sel = i;
                    bootloader bl = new bootloader(nodemap[i]);
                    ret = bl.download(fwprogress, fwpath);
                    if (ret != "")
                    {
                        break;
                    }
                }
            }
            btn_updatefw.Visible   = true;
            progressBar_fw.Visible = true;
            Thread.Sleep(1000);
            UpdateAllNodeStatus();
            if (ret == "")
            {
                Program.MsgShow(GetText("success"));
            }
            else
            {
                Program.MsgShow(GetText("fail"));
            }
        }
示例#2
0
        private void btn_updatefw_Click(object sender, EventArgs e)
        {
            if(lb_addrfrom.SelectedIndex < 0)
            {
                Program.MsgShow(GetText("select_addrfrom"));
                return;
            }

            this.Invoke(new VoidHandler(this.hidebtn));
            string ret = "";
            foreach (byte i in nodemap.Keys)
            {
                if (lb_addrfrom.SelectedIndex == 0 || i == nodelist[lb_addrfrom.SelectedIndex])
                {
                    progressBar_fw.Visible = true;
                    progressBar_fw.Minimum = 0;
                    progressBar_fw.Maximum = (int)(fwlen / 128);
                    curr_sel = i;
                    bootloader bl = new bootloader(nodemap[i]);
                    ret = bl.download(fwprogress,fwpath);
                    if (ret != "")
                        break;
                }
            }
            btn_updatefw.Visible = true;
            progressBar_fw.Visible = true;
            Thread.Sleep(1000);
            UpdateAllNodeStatus();
            if (ret == "")
                Program.MsgShow(GetText("success"));
            else
                Program.MsgShow(GetText("fail"));
            
        }