Exemplo n.º 1
0
        //refresh all strings
        public void InitDisplay()
        {
            new_prd.Text = "+";

            run_amp_label.Text     = StringResource.str("grp_amp");
            cb_autoamp.Text        = StringResource.str("auto_amp");
            title_lastweight.Text  = StringResource.str("lastweight");
            title_speed.Text       = StringResource.str("speed");
            title_totalpack.Text   = StringResource.str("totalpack");
            sub_amp_label.Text     = StringResource.str("sub_amp");
            sub_freq_label.Text    = StringResource.str("sub_freq");
            sub_time_label.Text    = StringResource.str("sub_time");
            motor_speed_label.Text = StringResource.str("motor_speed");
            col_dtime_label.Text   = StringResource.str("col_dtime");
            col_otime_label.Text   = StringResource.str("col_otime");
            openwei_label.Text     = StringResource.str("openwei");
            wei_dtime_label.Text   = StringResource.str("wei_dtime");
            wei_otime_label.Text   = StringResource.str("wei_otime");

            lbl_run_freq.Text     = StringResource.str("grp_freq");
            lbl_node.Text         = StringResource.str("bucketsetting");
            lbl_desc.Text         = StringResource.str("product_desc");
            lbl_filter.Text       = StringResource.str("sub_filter");
            lbl_group.Text        = StringResource.str("product_config");
            lbl_prd_no.Text       = StringResource.str("product_no");
            lbl_run_time.Text     = StringResource.str("grp_time");
            lbl_summary.Text      = StringResource.str("totalweight");
            grp_dvar_label.Text   = StringResource.str("grp_dvar");
            grp_uvar_label.Text   = StringResource.str("grp_uvar");
            grp_target_label.Text = StringResource.str("target");
            btn_trial.Text        = StringResource.str("cmd_run");
            btn_empty.Text        = StringResource.str("cmd_empty");
            btn_fill.Text         = StringResource.str("cmd_fill");
            btn_mainvib.Text      = StringResource.str("cmd_mainvib");
            btn_pack.Text         = StringResource.str("cmd_pack");
            btn_pass.Text         = StringResource.str("cmd_pass");
            btn_save.Text         = StringResource.str("cmd_save");
            btn_selectall.Text    = StringResource.str("cmd_selectall");
            btn_sub_applyall.Text = StringResource.str("subcfg_applyall");
            btn_zero.Text         = StringResource.str("cmd_zero");
        }
Exemplo n.º 2
0
        private void sub_applyall()
        {
            UIPacker pack = curr_packer;

            byte cn = (byte)curr_node_index;

            bool star = true;

            foreach (byte n in curr_packer.weight_nodes)
            {
                foreach (string reg in apply_regs.Distinct())
                {
                    if (NodeMaster.GetStatus(n) == NodeStatus.ST_LOST)
                    {
                        continue;
                    }
                    if (NodeMaster.GetStatus(n) == NodeStatus.ST_DISABLED)
                    {
                        continue;
                    }

                    if (n == cn)
                    {
                        continue;
                    }
                    UInt32 val = NodeMaster.GetNodeReg(cn, reg);
                    NodeMaster.SetNodeReg(n, new string[] { reg }, new UInt32[] { val });

                    if (star)
                    {
                        txt_oper.Text = StringResource.str("modifying") + " " + n.ToString() + "*";
                    }
                    else
                    {
                        txt_oper.Text = StringResource.str("modifying") + " " + n.ToString();
                    }
                    star = !star;
                }
            }
            apply_regs.Clear();
        }
Exemplo n.º 3
0
        private void ToggleStartStop()
        {
            if (curr_packer.status == PackerStatus.RUNNING)
            {
                curr_packer.StopRun();
                this.btn_trial.Text = StringResource.str("cmd_run");
                uiTimer.Enabled     = false;
                uiTimer.Interval    = 100;
                uiTimer.Enabled     = true;
            }
            else
            {
                curr_packer.bSimulate = true;
                uiTimer.Enabled       = false;
                uiTimer.Interval      = 10;
                uiTimer.Enabled       = true;

                curr_packer.StartRun();
                this.btn_trial.Text = StringResource.str("sall_stop");
            }
        }
Exemplo n.º 4
0
        private void ReleaseAction(byte[] addrs, double weight)
        {
            string log = weight.ToString("F2") + "\t";

            log = weight.ToString("F2") + "\t";

            foreach (byte n in addrs)
            {
                log = log + String.Format("({0}){1}\t", n, NodeMaster.GetWeight(n));

                while (true)
                {
                    try
                    {
                        NodeMaster.Action(new byte[] { n }, "flag_release");
                        break;
                    }
                    catch
                    {
                        Program.MsgShow(StringResource.str("tryagain"));
                    }
                }
            }
            NodeMaster.HitMatch(addrs);
            StringResource.dolog(log);

            onepack o = new onepack();

            o.bucket    = new byte[5];
            o.bucket[1] = o.bucket[2] = o.bucket[3] = o.bucket[4] = o.bucket[0] = (byte)0;
            int i = 0;

            foreach (byte n in addrs)
            {
                o.bucket[i++] = n;
            }
            o.time   = DateTime.Now;
            o.weight = weight;
            packer.AddNewPack(o);
        }
Exemplo n.º 5
0
        public void UpdateDisplay()
        {
            btn_allempty.Text = StringResource.str("all_empty");
            btn_allzero.Text  = StringResource.str("all_zero");
            btn_config.Text   = StringResource.str("config");
            btn_allstart.Text = StringResource.str("all_start");

            title_operator.Text   = StringResource.str("operator");
            title_lastweight.Text = StringResource.str("lastweight");
            title_speed.Text      = StringResource.str("speed");
            title_totalpack.Text  = StringResource.str("totalpack");

            lbl_alert1.Text       = StringResource.str("alert_solved");
            lbl_alert2.Text       = StringResource.str("alert_force");
            lbl_alert3.Text       = StringResource.str("alert_disable");
            lbl_alert4.Text       = StringResource.str("alert_quit");
            lbl_alert.Text        = StringResource.str("alert_select");
            grp_dvar_label.Text   = StringResource.str("grp_dvar");
            grp_uvar_label.Text   = StringResource.str("grp_uvar");
            grp_lbl_prd_no.Text   = StringResource.str("product_no");
            grp_target_label.Text = StringResource.str("grp_target");
        }
Exemplo n.º 6
0
        public void RefreshNodeUI()
        {
            UIPacker p = curr_packer;

            lbl_status.Text = "";
            foreach (byte n in p.weight_nodes)
            {
                UpdateNodeUI(n);
            }
            runPan1.ReDraw();
            if (lbl_status.Text.ToString() != "")
            {
                lbl_status.ForeColor = Color.Red;
                return;
            }
            lbl_status.ForeColor = Color.Green;
            RefreshVibUI();
            if (lbl_status.Text.ToString() == "")
            {
                lbl_status.Text = StringResource.str("normal");
            }
        }
Exemplo n.º 7
0
        private void UpdateOne(SchemeItem2 n, int startpos)
        {
            if (startpos >= totalNum)
            {
                n.Visible = false;
                return;
            }
            n.Visible = true;

            PackerConfig pcfg = new PackerConfig();

            pcfg.FromElement(curr_packer.pkg_confs[idlist[startpos]]);

            n.Product = imglist[startpos];
            n.Text    = String.Format("{0}:{1}\r\n{2}:{3}\r\n{4}:{5}\r\n{6}:{7}\r\n{8}:{9}",
                                      StringResource.str("product_no"), pcfg.product_no,
                                      StringResource.str("product_desc"), pcfg.product_desc,
                                      StringResource.str("grp_target"), pcfg.target,
                                      StringResource.str("grp_uvar"), pcfg.upper_var,
                                      StringResource.str("grp_dvar"), pcfg.lower_var
                                      );
            n.Id = idlist[startpos];
        }
Exemplo n.º 8
0
 public void UpdateDisplay()
 {
     intf_lb_pulse_width.Text      = StringResource.str("intf_lb_pulse_width");
     intf_lb_output_fmt_label.Text = StringResource.str("intf_lb_output_fmt");
     intf_lb_input_fmt_label.Text  = StringResource.str("intf_lb_input_fmt");
     intf_lb_feed_times_label.Text = StringResource.str("intf_lb_feed_times");
     label11.Text              = StringResource.str("packsetting");
     btn_run.Text              = StringResource.str("runonce");
     intf_ckb_mem.Text         = StringResource.str("intf_ckb_mem");
     intf_handshake.Text       = StringResource.str("intf_handshake");
     intf_ckb_delay_label.Text = StringResource.str("intf_ckb_delay");
     intf_output_trigger.Items.Clear();
     intf_output_trigger.Items.Add(StringResource.str("intftrig1"));
     intf_output_trigger.Items.Add(StringResource.str("intftrig2"));
     intf_output_trigger.Items.Add(StringResource.str("intftrig3"));
     intf_output_trigger.Items.Add(StringResource.str("intftrig4"));
     intf_input_trigger.Items.Clear();
     intf_input_trigger.Items.Add(StringResource.str("intftrig1"));
     intf_input_trigger.Items.Add(StringResource.str("intftrig2"));
     intf_input_trigger.Items.Add(StringResource.str("intftrig3"));
     intf_input_trigger.Items.Add(StringResource.str("intftrig4"));
     UpdateData();
 }
Exemplo n.º 9
0
        public void UpdateNodeUI(byte n)
        {
            UIPacker pack = curr_packer;

            //display the variable based on current setting
            string err = NodeMaster.GetErrors(n);
            double wt  = -1000;
            string ct  = "";

            if (err == "")
            {
                wt = NodeMaster.GetWeight(n);
                ct = wt.ToString("F1");
                runPan1.SetStatus("passbar", n, PanStatus.IDLE, false);
            }
            else
            {
                if (AlertWnd.b_show_alert && AlertWnd.b_turnon_alert)
                {
                    runPan1.SetStatus("passbar", n, PanStatus.ERROR, false);
                    lbl_status.Text = StringResource.str(err.Substring(0, err.IndexOf(';'))) + "\n";
                    runPan1.SetText(n, StringResource.str(err.Substring(0, err.IndexOf(';'))), false);
                }
            }
            if (NodeMaster.GetStatus(n) == NodeStatus.ST_LOST || NodeMaster.GetStatus(n) == NodeStatus.ST_DISABLED)
            {
                runPan1.SetStatus("weightbar", n, PanStatus.DISBALED, false);
            }
            if (NodeMaster.GetStatus(n) == NodeStatus.ST_IDLE)
            {
                runPan1.SetStatus("weightbar", n, PanStatus.IDLE, false);
            }
            if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
            {
                runPan1.SetText(n, ct, false);
            }
        }
Exemplo n.º 10
0
        private void title_speed_MouseLeftButtonUp(object sender, EventArgs e)
        {
            if (ts_pwd == null)
            {
                ts_pwd = new TimeSpan(DateTime.Now.Ticks);
                return;
            }
            title_cnt++;
            if (title_cnt < 5)
            {
                return;
            }

            TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
            TimeSpan ts  = ts2.Subtract((TimeSpan)ts_pwd).Duration();

            if (ts.TotalSeconds < 6)
            {
                Reset();
                Program.MsgShow(StringResource.str("pwd_restore_done"));
            }
            title_cnt = 0;
            ts_pwd    = null;
        }
Exemplo n.º 11
0
 private void btn_entersys_Click(object sender, EventArgs e)
 {
     Program.kbdwnd.Init(StringResource.str("enter_system"), "entersys", true, KbdData);
 }
Exemplo n.º 12
0
        public void KbdData(string param, string data)
        {
            try
            {
                UIPacker pack = curr_packer;
                if (param == "newtime")
                {
                    if (!Regex.IsMatch(newdate, "^\\d\\d\\d\\d\\d\\d\\d\\d$"))
                    {
                        return;
                    }

                    if (!Regex.IsMatch(data, "^\\d\\d\\d\\d\\d\\d$"))
                    {
                        return;
                    }
                    SystemTime time = new SystemTime();
                    time.wYear        = Convert.ToUInt16(newdate.Substring(0, 4));
                    time.wMonth       = Convert.ToUInt16(newdate.Substring(4, 2));
                    time.wDay         = Convert.ToUInt16(newdate.Substring(6, 2));
                    time.wHour        = Convert.ToUInt16(data.Substring(0, 2));
                    time.wMinute      = Convert.ToUInt16(data.Substring(2, 2));
                    time.wSecond      = Convert.ToUInt16(data.Substring(4, 2));
                    time.wMiliseconds = 0;
                    SetLocalTime(ref time);
                }

                if (param == "newdate")
                {
                    newdate  = data;
                    lastcall = "newtime";
                    return;
                }
                if (param == "run_uvar")
                {
                    pack.curr_cfg.upper_var = double.Parse(data);
                    pack.SaveCurrentConfig(4);
                }
                if (param == "run_dvar")
                {
                    pack.curr_cfg.lower_var = double.Parse(data);
                    pack.SaveCurrentConfig(4);
                }
                if (param == "run_target")
                {
                    pack.curr_cfg.target = Double.Parse(data);
                    pack.UpdateEachNodeTarget();
                    pack.SaveCurrentConfig(1 + 4);
                }
                if (param == "run_operator")
                {
                    Program.oper = data;
                    pack.SaveCurrentConfig(4);
                }
                if (param == "singlemode")
                {
                    if (Password.compare_pwd("user", data))
                    {
                        while (lastcall != "")
                        {
                            this.uiTimer_Tick(null, null);
                        }
                        Program.SwitchTo("configmenu");
                        return;
                    }
                    else
                    {
                        Program.MsgShow(StringResource.str("invalid_pwd"));
                    }
                }
                UpdateSysConfigUI();
            }
            catch (System.Exception e)
            {
                Program.MsgShow("Invalid Parameter");
                return;
            }
        }
Exemplo n.º 13
0
        private static bool tmlock = false; //lock for timer handler
        void uiTimer_Tick(object sender, EventArgs e)
        {
            if (Program.topwnd != "runmode")
            {
                return;
            }
            lbl_datetime.Text = DateTime.Now.ToLongDateString() + "  " + DateTime.Now.ToLongTimeString();

            if (tmlock)
            {
                return;
            }
            tmlock = true;

            UIPacker p = curr_packer;

            if (lastcall != "")
            {
                if (lastcall == "newtime")
                {
                    lastcall = "";
                    Program.kbdwnd.Init(StringResource.str("enter_newtime"), "newtime", false, KbdData);
                }
                if (lastcall == "StartStop")
                {
                    ToggleStartStop();
                    lbl_status.Text = StringResource.str("normal");
                    lastcall        = "";
                }
                if (lastcall == "UpdatePrdNo")
                {
                    p.LoadPackConfig(p.curr_cfg.product_no, false);
                    UpdateSysConfigUI();
                    Thread.Sleep(2000);
                    lastcall = "";
                }
                txt_oper.Visible = false;
                tmlock           = false;
                return;
            }
            else
            {
                curr_packer.nc.Step();
                if ((NodeCombination.phase == 40) || (NodeCombination.phase == 30))
                {
                    idlehit++;
                }
                else
                {
                    idlehit = 0;
                }
            }
            if (NodeCombination.q_hits.Count > 0)
            {
                while ((NodeCombination.q_hits.Count > 0))
                {
                    CombineNodeUI(NodeCombination.q_hits.Dequeue());
                }
                tmlock = false;
                return;
            }
            if (p.status != PackerStatus.RUNNING)
            {
                RefreshNodeUI();
            }
            else
            {
                if ((NodeCombination.phase == 50) || (idlehit > 10))
                {
                    idlehit = 0;
                    RefreshRunNodeUI();
                }
            }
            tmlock = false;
        }
Exemplo n.º 14
0
 private void btnClr_Click(object sender, EventArgs e)
 {
     curr_packer.total_packs = 0;
     Program.MsgShow(StringResource.str("done"));
 }
Exemplo n.º 15
0
        public void UpdateDisplay(bool refresh)
        {
            RectButton btn;

            if (b_lockon)
            {
                btn_entersys.SetStyle(Color.Gray, MyButtonType.roundGradientButton);
                btn_locksys.Text = StringResource.str("lockon");
            }
            else
            {
                btn_locksys.SetStyle(Color.LightGreen, MyButtonType.roundGradientButton);
                btn_locksys.Text = StringResource.str("locksystem");
            }
            for (Byte i = 1; i < 18; i++)
            {
                if (i < 17)
                {
                    btn = IdToButton(i.ToString());
                }
                else
                {
                    btn = IdToButton("36");
                }

                if ((NodeMaster.GetErrors(i) != "") || (NodeMaster.GetStatus(i) == NodeStatus.ST_LOST))
                {
                    btn.SetStyle(Color.Gray, MyButtonType.roundButton);
                }
                else
                {
                    if (i == curr_sel || all_sel)
                    {
                        btn.SetStyle(Color.DarkGreen, MyButtonType.round2Button);
                    }
                    else
                    {
                        btn.SetStyle(Color.DarkGreen, MyButtonType.roundButton);
                    }
                }
                btn.Visible = true;
                continue;
            }

            btn_cali0.Text       = StringResource.str("cmd_cali0");
            btn_cali1.Text       = StringResource.str("cmd_cali1");
            btn_cali2.Text       = StringResource.str("cmd_cali2");
            btn_cali3.Text       = StringResource.str("cmd_cali3");
            btn_cali4.Text       = StringResource.str("cmd_cali4");
            btn_cali5.Text       = StringResource.str("cmd_cali5");
            btn_cali6.Text       = StringResource.str("cmd_cali6");
            btn_cali7.Text       = StringResource.str("cmd_cali7");
            btn_cali8.Text       = StringResource.str("cmd_cali8");
            btn_cali9.Text       = StringResource.str("cmd_cali9");
            btn_cali10.Text      = StringResource.str("cmd_cali10");
            btnSave.Text         = StringResource.str("cmd_save");
            btn_empty.Text       = StringResource.str("cmd_empty");
            btn_refreshaddr.Text = StringResource.str("refresh");
            btn_selectall.Text   = StringResource.str("cmd_selectall");
            lbl_title.Text       = StringResource.str("engineerpage");
            lbl_seladdr.Text     = StringResource.str("seladdr");
            lbl_reg.Text         = StringResource.str("setregs");
            btn_changeaddr.Text  = StringResource.str("changeaddr");
            btn_updatefw.Text    = StringResource.str("updatefw");
            btn_refreshaddr.Text = StringResource.str("refresh");
            btn_locksys.Text     = StringResource.str("locksystem");
            btn_entersys.Text    = StringResource.str("entersystem");
            btn_language.Text    = StringResource.str("language");
            btn_refreshreg.Text  = StringResource.str("refresh");
        }
Exemplo n.º 16
0
 private void btn_pack_uvar_Click(object sender, EventArgs e)
 {
     Program.kbdwnd.Init(StringResource.str("enter_uvar"), "uvar", false, KbdData);
 }
Exemplo n.º 17
0
        public void PackerBoot()
        {
            try
            {
                UpdateMessage("App Version: " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\r\n");
                //search for nodes
                //UpdateMessage(StringResource.str("search_newnode"));
//                NodeMaster.SearchNode(byte.Parse(Program.curr_cfg.Element("def_addr").Value));

                boot_ok = 0;
                int tryfound;
                //check the availability of each board
                foreach (UIPacker pk in Program.packers)
                {
                    foreach (byte n in pk.weight_nodes)
                    {
                        if ((n % 4) == 3)
                        {
                            UpdateMessage("\r\n");
                        }
                        tryfound = 3;
                        while (!NodeMaster.SearchNode(n) && (tryfound > 0))
                        {
                            Thread.Sleep(500);
                            tryfound--;
                        }
                        if (tryfound <= 0)
                        {
                            UpdateMessage(StringResource.str("search_node") + n + StringResource.str("fail") + "\t\t");
                            Program.engwnd.btn_updatefw_Click(null, null);
                        }
                        else
                        {
                            boot_ok++;
                            UpdateMessage(n + ": ver " + NodeMaster.GetNodeReg(n, "fw_rev_uw").ToString() + "\t\t");
                        }
                    }
                    byte nvib = pk.vib_addr;
                    tryfound = 3;
                    while ((!NodeMaster.SearchNode(nvib)) && (tryfound > 0))
                    {
                        Thread.Sleep(500);
                        tryfound--;
                    }
                    if (tryfound <= 0)
                    {
                        UpdateMessage(StringResource.str("search_node") + nvib + StringResource.str("fail") + "\t\t");
                    }
                    else
                    {
                        boot_ok++;
                        UpdateMessage(nvib + ": ver " + NodeMaster.GetNodeReg(nvib, "fw_rev_uw").ToString() + "\t\t");
                    }
                    Thread.Sleep(2000);
                    if (boot_ok > 0)
                    {
                        //load config for node
                        UpdateMessage("\r\n" + StringResource.str("init_nodereg"));
                        //todo
                        pk.LoadPackConfig(pk.pkg_confs.cfg_name, true);
                        NodeMaster.Action(new byte[] { pk.vib_addr }, "intf");
                        NodeMaster.Action(pk.wn_addrs, "stop");
                        NodeMaster.Action(new byte[] { pk.vib_addr }, "stop");
                    }
                }
            }
            catch (Exception ex)
            {
                UpdateMessage(ex.Message);
                boot_ok = 0;
                Thread.Sleep(3000);
            }
        }
Exemplo n.º 18
0
 private void pwd_GotFocus(object sender, EventArgs e)
 {
     btn_modify.Focus();
     Program.kbdwnd.Init(StringResource.str("enter_singlemode_pwd"), (sender as Control).Name, true, KbdData);
 }
Exemplo n.º 19
0
 private void btn_restore_Click(object sender, EventArgs e)
 {
     RunModeWnd.Reset();
     Program.MsgShow(StringResource.str("pwd_restore_done"));
     btn_return_Click(sender, e);
 }
Exemplo n.º 20
0
        static public void SwitchTo(string mode)
        {
            if (mode == "history")
            {
                topwnd = mode;
                histwnd.BringToFront();
                histwnd.Show();
                histwnd.UpdateDisplay();
                histwnd.UpdateList();

                return;
            }
            if (mode == "alert")
            {
                topwnd = mode;
                alertwnd.BringToFront();
                alertwnd.Show();
                alertwnd.UpdateUI();
                return;
            }
            if (mode == "bottom")
            {
                topwnd = mode;
                bottomwnd.BringToFront();
                bottomwnd.UpdateDisplay();
                bottomwnd.Show();
                return;
            }
            if (mode == "password")
            {
                topwnd = mode;
                pwdwnd.UpdateDisplay();
                pwdwnd.Show();
                pwdwnd.BringToFront();
                return;
            }
            if (mode == "engineer")
            {
                topwnd = mode;
                engwnd.InitDisplay();
                engwnd.Show();
                engwnd.BringToFront();
                return;
            }

            /*
             * singlewnd.Hide();
             * histwnd.Hide();
             * runwnd.Hide();
             * alertwnd.Hide();
             * bottomwnd.Hide();
             * pwdwnd.Hide();
             * engwnd.Hide();
             * kbdwnd.Hide();
             * configwnd.Hide();
             */
            if (mode == "configmenu")
            {
                topwnd = mode;
                configwnd.BringToFront();
                configwnd.Show();
                configwnd.UpdateDisplay();
                return;
            }
            if (mode == "product")
            {
                mode = "singlemode";
            }
            if (mode == "runmode")
            {
                topwnd = mode;
                runwnd.BringToFront();
                runwnd.Show();
                if (runwnd.btn_allstart.Visible == false)
                {
                    Program.MsgShow(StringResource.str("license"));
                }
                runwnd.UpdateSysConfigUI();

                return;
            }
            if (mode == "singlemode")
            {
                topwnd = mode;
                singlewnd.BringToFront();
                singlewnd.Show();
                singlewnd.UpdateUI();
                return;
            }
        }
Exemplo n.º 21
0
 private void node_reg(string regname)
 {
     btn_ret.Focus();
     Program.kbdwnd.Init(StringResource.str("enter_" + regname), regname, false, KbdData);
 }
Exemplo n.º 22
0
        private void calibrate(string calreg)
        {
            if (curr_sel == -1)
            {
                return;
            }
            Byte i = Convert.ToByte(curr_sel);

            if (calreg == "cali0")
            {
                if (curr_sel >= 0 && NodeMaster.GetStatus(i) != NodeStatus.ST_LOST)
                {
                    Program.MsgShow(StringResource.str("put_empty"));

                    NodeMaster.RefreshNodeReg(i, new string[] { "cs_mtrl" });
                    UInt32 val = NodeMaster.GetNodeReg(i, "cs_mtrl");
                    if ((val <= WeighNode.MAX_VALID_WEIGHT) && (val > 0))
                    {
                        NodeMaster.SetNodeReg(i, new string[] { "cs_zero" }, new UInt32[] { val });
                        NodeMaster.Action(new byte[] { i }, "flash");
                        Program.MsgShow(StringResource.str("calidone"));
                        label3_MouseLeftButtonUp(null, null);
                    }
                    else
                    {
                        Program.MsgShow(StringResource.str("tryagain"));
                    }
                }
            }
            if (calreg == "empty")
            {
                if (curr_sel >= 0)
                {
                    NodeMaster.Action(new byte[] { i }, "empty");
                }
                return;
            }
            if (calreg == "cali1")
            {
                KbdData(calreg, "20");
            }
            if (calreg == "cali2")
            {
                KbdData(calreg, "50");
            }
            if (calreg == "cali3")
            {
                KbdData(calreg, "100");
            }
            if (calreg == "cali4")
            {
                KbdData(calreg, "200");
            }
            if (calreg == "cali5")
            {
                KbdData(calreg, "300");
            }
            if (calreg == "cali6")
            {
                KbdData(calreg, "400");
            }
            if (calreg == "cali7")
            {
                KbdData(calreg, "500");
            }
            if (calreg == "cali8")
            {
                KbdData(calreg, "700");
            }
            if (calreg == "cali9")
            {
                KbdData(calreg, "900");
            }
            if (calreg == "cali10")
            {
                KbdData(calreg, "1000");
            }
        }
Exemplo n.º 23
0
        public void KbdData(string param, string data)
        {
            XElement cfg = Program.curr_cfg;

            if (param == "entersys")
            {
                if (Password.compare_pwd("admin", data))
                {
                    Process app = new Process();
                    app.StartInfo.FileName  = "Explorer.exe";
                    app.StartInfo.Arguments = "";
                    app.Start();
                    Thread.Sleep(2000);
                    Program.kbdwnd.Hide();
//                    Type shellType = Type.GetTypeFromProgID("Shell.Application");
//                    object shellObject = System.Activator.CreateInstance(shellType);
//                    shellType.InvokeMember("ToggleDesktop", System.Reflection.BindingFlags.InvokeMethod, null, shellObject, null);
                }

                return;
            }
            if (param == "quitlock")
            {
                if (Password.compare_pwd("lock", data))
                {
                    b_lockon = false;
                    Password.set_pwd("lock", "0");
                    b_lockon = false;
                    Program.runwnd.Disable(true);
                    Program.singlewnd.Disable(true);
                    UpdateDisplay(true);
                }
            }
            if (param == "enterlock")
            {
                //App should expire after desired packer number reached , data is the actual packer count
                Password.set_pwd("lock_on", data);
                DeleteRegist("lock_on");
                WTRegedit("lock_on", data);
                Password.set_pwd("lock", data);
                Program.SaveAppConfig();
                b_lockon = true;
                UpdateDisplay(false);
            }
            if (param.IndexOf("reg_") == 0)
            {
                SubNode n = null;
                if (curr_sel == -1)
                {
                    return;
                }
                Byte i = Convert.ToByte(curr_sel);
                NodeMaster.SetNodeReg(i, new string[] { param.Remove(0, 4) }, new UInt32[] { UInt32.Parse(data) });

                btn_refreshreg_Click(null, null);
            }
            if (param.IndexOf("chgnd_") == 0)
            {
                Byte oldaddr = Byte.Parse(param.Remove(0, 6));
                Byte newaddr = Byte.Parse(data);
                NodeMaster.ChangeAddress(oldaddr, newaddr);
            }
            if (param != "cali0" && (param.IndexOf("cali") == 0)) //cali1 to cali10
            {
                string msg = StringResource.str("put_poise") + "(" + data + StringResource.str("gram") + ")";

                Program.MsgShow(msg);
                int i = RunModeWnd.StringToId(param) - 1;
                if (curr_sel >= 0)
                {
                    NodeMaster.RefreshNodeReg((byte)curr_sel, new string[] { "cs_mtrl" });
                    UInt32 cs_mtrl_val = NodeMaster.GetNodeReg((byte)curr_sel, "cs_mtrl");
                    if (cs_mtrl_val <= WeighNode.MAX_VALID_WEIGHT)
                    {
                        if (i < 5)
                        {
                            NodeMaster.SetNodeReg((byte)curr_sel, new string[] { "poise_weight_gram" + i.ToString() }, new UInt32[] { cs_mtrl_val });
                        }
                        else
                        {
                            NodeMaster.SetNodeReg((byte)curr_sel, new string[] { "cs_poise" + (i - 5).ToString() }, new UInt32[] { cs_mtrl_val });
                        }
                        NodeMaster.Action(new byte[] { (byte)curr_sel }, "flash");
                        Program.MsgShow(StringResource.str("calidone"));
                        label3_MouseLeftButtonUp(null, null);
                        return;
                    }
                    Program.MsgShow(StringResource.str("tryagain"));
                }
                return;
            }
        }
Exemplo n.º 24
0
        public kbdWnd()
        {
            InitializeComponent();
            this.BackColor = SingleModeWnd.bgWindow;
            btn_backspace.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_clr.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_quit.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_ok.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num0.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num1.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num2.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num3.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num4.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num5.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num6.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num7.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num8.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_num9.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_numN.SetStyle(Color.Beige, MyButtonType.round2Button);
            btn_numP.SetStyle(Color.Beige, MyButtonType.round2Button);

            roundRect1.SetStyle(Color.Beige, MyButtonType.roundRect);

            btn_backspace.ValidClick += new EventHandler(btn_backspace_Click);
            btn_clr.ValidClick       += new EventHandler(btn_clr_Click);
            btn_quit.ValidClick      += new EventHandler(btn_quit_Click);
            btn_ok.ValidClick        += new EventHandler(btn_ok_Click);
            btn_num0.ValidClick      += new EventHandler(btn_num0_Click);
            btn_num1.ValidClick      += new EventHandler(btn_num1_Click);
            btn_num2.ValidClick      += new EventHandler(btn_num2_Click);
            btn_num3.ValidClick      += new EventHandler(btn_num3_Click);
            btn_num4.ValidClick      += new EventHandler(btn_num4_Click);
            btn_num5.ValidClick      += new EventHandler(btn_num5_Click);
            btn_num6.ValidClick      += new EventHandler(btn_num6_Click);
            btn_num7.ValidClick      += new EventHandler(btn_num7_Click);
            btn_num8.ValidClick      += new EventHandler(btn_num8_Click);
            btn_num9.ValidClick      += new EventHandler(btn_num9_Click);
            btn_numN.ValidClick      += new EventHandler(btn_numN_Click);
            btn_numP.ValidClick      += new EventHandler(btn_numP_Click);
            this.panel1.BackColor     = SingleModeWnd.bgWindow;
            btn_backspace.Text        = StringResource.str("backspace");
            btn_clr.Text              = StringResource.str("clr");
            btn_quit.Text             = StringResource.str("quit");
            btn_ok.Text   = StringResource.str("ok");
            btn_num0.Text = "0";
            btn_num1.Text = "1";
            btn_num2.Text = "2";
            btn_num3.Text = "3";
            btn_num4.Text = "4";
            btn_num5.Text = "5";
            btn_num6.Text = "6";
            btn_num7.Text = "7";
            btn_num8.Text = "8";
            btn_num9.Text = "9";
            btn_numN.Text = "-";
            btn_numP.Text = ".";
            data          = new StringBuilder("", 10);
            note          = "Note";
            TopMost       = true;
            password      = false;
            Hide();
        }
Exemplo n.º 25
0
 private void ShowStatus(string msg)
 {
     txt_oper.Text    = StringResource.str(msg);
     txt_oper.Visible = true;
 }
Exemplo n.º 26
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     NodeMaster.SetNodeReg((byte)curr_sel, new string[] { "flag_enable" }, new UInt32[] { 14 });
     Program.MsgShow(StringResource.str("done"));
 }
Exemplo n.º 27
0
 private void new_prd_Click(object sender, EventArgs e)
 {
     Program.kbdwnd.Init(StringResource.str("input_newprdno"), "", false, new_prd_no_input);
 }
Exemplo n.º 28
0
        public void UpdateDataGrid(object sender, EventArgs e)
        {
            SetConnection();
            sql_con.Open();

            sql_cmd = sql_con.CreateCommand();
            string   cols        = "select start_date, end_date, operator, product_no, product_desc, target, upper_var, lower_var, weight, pack_num from  mains ";
            DateTime s_dt        = mc_starttime.SelectionStart;
            DateTime e_dt        = mc_endtime.SelectionEnd;
            string   CommandText = cols + String.Format("where start_date>='{0}-{1}-{2} 00:00:00' and end_date<='{3}-{4}-{5} 23:59:59'",
                                                        s_dt.Year, s_dt.Month.ToString("D2"), s_dt.Day.ToString("D2"), e_dt.Year, e_dt.Month.ToString("D2"), e_dt.Day.ToString("D2"));

            if (lb_oper.SelectedIndex >= 0 && lb_oper.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and operator='{0}'", lb_oper.SelectedItem.ToString());
            }
            if (lb_prod.SelectedIndex >= 0 && lb_prod.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and product_desc='{0}'", lb_prod.SelectedItem.ToString());
            }
            if (lb_prodno.SelectedIndex >= 0 && lb_prodno.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and product_no='{0}'", lb_prodno.SelectedItem.ToString());
            }

            DB = new SQLiteDataAdapter(CommandText, sql_con);
            DS.Reset();
            DB.Fill(DS);
            DT = DS.Tables[0];
            double total_sum  = 0;
            UInt32 total_pack = 0;

            foreach (DataRow dr in DT.Rows)
            {
                total_pack += UInt32.Parse(dr["pack_num"].ToString());
                total_sum  += Double.Parse(dr["weight"].ToString());
            }
            this.dataGridView1.DataSource = DT;

            /*tofix
             * foreach (DataGridViewColumn dcol in dataGridView1.Columns)
             * {
             *  dcol.HeaderText = StringResource.str(dcol.Name);
             *  dcol.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
             *
             * }*/
            this.lbl_summary.Text = String.Format("{0}:{1}{6} , {2}:{3} , {4}:{5}{6}", StringResource.str("totalweight"), total_sum.ToString("F1"),
                                                  StringResource.str("totalpacknum"), total_pack.ToString(), StringResource.str("avgweight"), (total_pack == 0 ? "0" :(total_sum / total_pack).ToString("F1")), StringResource.str("gram"));
            sql_con.Close();
        }