Example #1
0
        private void HitCombineNodeUI(CombineEventArgs ce)
        {
            foreach (byte naddr in Program.packers[ce.packer_id].weight_nodes)
            {
                byte n = naddr;

                double wt = NodeMaster.GetWeight(n);
                if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                    runPan1.SetText(n, NodeMaster.GetWeight(n).ToString("F1"), false);
                else
                {
                    if (wt > WeighNode.MAX_VALID_WEIGHT && wt < 65537)
                    {
                        runPan1.SetText(n, "ERR", false);
                        runPan1.SetStatus("weightnode", n, PanStatus.ERROR, false);
                    }
                }
                if (!ce.release_addrs.Contains(n))
                {
                    if (NodeMaster.GetStatus(n) == NodeStatus.ST_LOST || NodeMaster.GetStatus(n) == NodeStatus.ST_DISABLED)
                    {
                        runPan1.SetStatus("weightbar", n, PanStatus.DISBALED, false);
                    }
                    else
                    {
                        if (n != curr_packer.vib_addr)
                        {
                            runPan1.SetStatus("weightbar", n, PanStatus.IDLE, false);
                        }
                    }
                    continue;
                }

                if (NodeMaster.GetStatus(n) == NodeStatus.ST_LOST || NodeMaster.GetStatus(n) == NodeStatus.ST_DISABLED)
                {
                    runPan1.SetStatus("weightbar", n, PanStatus.DISBALED,false);
                }else{
                    if (n != curr_packer.vib_addr)
                    {
                        if (ce.release_addrs.Contains(n))
                        {
                            runPan1.SetStatus("weightbar", n, PanStatus.RELEASE,false);
                        }
                        else
                        {
                            runPan1.SetStatus("weightbar", n, PanStatus.IDLE,false);
                        }
                     }
                }
            }
            UIPacker p = curr_packer;
            if (p.status == PackerStatus.RUNNING)
            {
                lbl_speed.Text = p.speed.ToString();
                lbl_lastweight.Text = p.last_pack_weight.ToString("F1");
                lbl_totalpack.Text = p.total_sim_packs.ToString();
                lbl_totalweights.Text = p.total_sim_weights.ToString("F1");
            }
        }
Example #2
0
        //update UI when a packer is hitted
        public void CombineNodeUI(CombineEventArgs ce)
        {
            foreach (byte naddr in Program.packers[ce.packer_id].weight_nodes)
            {
                string param = "wei_node" + naddr.ToString();

                //update weight first
                double wt = -100000;
                for (int i = 0; i < ce.release_addrs.Length; i++)
                {
                    if (ce.release_addrs[i] == naddr)
                    {
                        wt = ce.release_wts[i];
                        break;
                    }
                }

                if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                    runPan1.SetText(naddr,wt.ToString("F1"),false);

                //update status display
                if (NodeMaster.GetStatus(naddr) == NodeStatus.ST_LOST || NodeMaster.GetStatus(naddr) == NodeStatus.ST_DISABLED)
                {
                    runPan1.SetStatus("weightbar",naddr,PanStatus.DISBALED,false);
                }
                else if (naddr != curr_packer.vib_addr)
                {
                    if (ce.release_addrs.Contains(naddr))
                        runPan1.SetStatus("weightbar",naddr,PanStatus.RELEASE,false);
                    else
                        runPan1.SetStatus("weightbar", naddr,PanStatus.IDLE,false);
                }
            }
            //Update speed information
            UIPacker p = Program.packers[ce.packer_id];
            if (p.status == PackerStatus.RUNNING)
            {
                lbl_speed.Text = p.speed.ToString();
                lbl_lastweight.Text = p.last_pack_weight.ToString("F1");
                lbl_totalpack.Text = p.total_packs.ToString();
                RefreshVibUI();
            }
        }