public void RefreshRunNodeUI() //node ui update at run time { lbl_status.Content = ""; foreach (UIPacker pk in currentApp().packers) { foreach (byte naddr in pk.weight_nodes) { string param = "wei_node" + naddr.ToString(); Label lb = this.FindName(param) as Label; Button btn = this.FindName(param.Replace("wei_node", "bucket")) as Button; byte n = (byte)(RunMode.StringToId(param)); NodeAgent agent = pk.agent; double wt = agent.weight(n); if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT) { lb.Content = agent.weight(n).ToString("F1"); } if (agent.GetStatus(n) == NodeStatus.ST_LOST || agent.GetStatus(n) == NodeStatus.ST_DISABLED) { btn.Template = this.FindResource("WeightBarError") as ControlTemplate; btn.ApplyTemplate(); } string err = agent.GetErrors(n); if (err != "" && AlertWnd.b_turnon_alert && AlertWnd.b_show_alert) { lbl_status.Content = n.ToString() + ":" + StringResource.str(err.Substring(0, err.IndexOf(';'))) + "\n"; } } if (pk.status == PackerStatus.RUNNING) { lbl_speed.Content = pk.speed.ToString(); lbl_lastweight.Content = pk.last_pack_weight.ToString("F1"); lbl_totalpack.Content = pk.total_packs.ToString(); RefreshVibUI(); } } if (lbl_status.Content.ToString() == "") { lbl_status.Content = StringResource.str("normal"); lbl_status.Foreground = Brushes.Green; } else { lbl_status.Foreground = Brushes.Red; if (AlertWnd.b_turnon_alert && AlertWnd.b_stop_onalert && (curr_packer.status == PackerStatus.RUNNING)) { btn_start_click(null, null); } } }