public void InitConfig() { weight_nodes.Clear(); XElement cfgNode = pkg_confs.Current; _curr_cfg.FromElement(cfgNode); foreach (string wnode in cfgNode.Element("WNodes").Value.ToString().Split(new char[] { ',' })) { weight_nodes.Add(byte.Parse(wnode)); } vib_addr = byte.Parse(cfgNode.Element("VNode").Value.ToString()); bot_addr = byte.Parse(cfgNode.Element("BNode").Value.ToString()); nc = new NodeCombination(this); }
public void Init(ProdClickHandler h, bool CanDelete) { this.phandler = h; this.wrapPanel1.Children.Clear(); PackerConfig pcfg = new PackerConfig(); foreach (string id in curr_packer.pkg_confs.Keys) { pcfg.FromElement(curr_packer.pkg_confs[id]); FileInfo fi; if (File.Exists(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + pcfg.product_desc + ".jpg")) { fi = new FileInfo(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + pcfg.product_desc + ".jpg"); } else { fi = new FileInfo(ProdNum.baseDir + "\\prodpic\\default.jpg"); } imglist[id] = fi.FullName; Label n = new Label(); ControlTemplate ct = this.FindResource("imgBtn") as ControlTemplate; n.Template = ct; n.Name = "ID" + id; //Product num: Pru n.Content = String.Format("{0}:{1}\n{2}:{3}\n{4}:{5}\n{6}:{7}\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.Click += ImageSelected; n.ApplyTemplate(); Rectangle rectimg = ct.FindName("ImageRect", n) as Rectangle; rectimg.Name = "Rt" + id; Button delBtn = ct.FindName("DelBtn", n) as Button; delBtn.Name = "De" + id; rectimg.MouseLeftButtonUp += ImageRect_MouseLeftButtonUp; delBtn.Click += Delbtn_Click; if (!CanDelete) { delBtn.Visibility = Visibility.Hidden; } ImageBrush ib = ct.FindName("ImageFill", n) as ImageBrush; ib.ImageSource = new BitmapImage(new Uri(fi.FullName)); this.wrapPanel1.Children.Add(n); } this.Show(); }
public void Init(ProdClickHandler h,bool CanDelete) { this.phandler = h; this.wrapPanel1.Children.Clear(); PackerConfig pcfg = new PackerConfig(); foreach (string id in curr_packer.pkg_confs.Keys) { pcfg.FromElement(curr_packer.pkg_confs[id]); FileInfo fi; if (File.Exists(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + pcfg.product_desc + ".jpg")) { fi = new FileInfo(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + pcfg.product_desc + ".jpg"); } else { fi = new FileInfo(ProdNum.baseDir + "\\prodpic\\default.jpg"); } imglist[id] = fi.FullName; Label n = new Label(); ControlTemplate ct = this.FindResource("imgBtn") as ControlTemplate; n.Template = ct; n.Name = "ID" + id; //Product num: Pru n.Content = String.Format("{0}:{1}\n{2}:{3}\n{4}:{5}\n{6}:{7}\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.Click += ImageSelected; n.ApplyTemplate(); Rectangle rectimg = ct.FindName("ImageRect", n) as Rectangle; rectimg.Name = "Rt" + id; Button delBtn = ct.FindName("DelBtn", n) as Button; delBtn.Name = "De" + id; rectimg.MouseLeftButtonUp += ImageRect_MouseLeftButtonUp; delBtn.Click += Delbtn_Click; if (!CanDelete) delBtn.Visibility = Visibility.Hidden; ImageBrush ib = ct.FindName("ImageFill", n) as ImageBrush; ib.ImageSource = new BitmapImage(new Uri(fi.FullName)); this.wrapPanel1.Children.Add(n); } this.Show(); }
//load all the configuration and update the UI, //packer and sub node will share the same configuration name public void LoadConfig(string cfgname) { foreach (WeighNode n in this.weight_node) { n.LoadCurrentConfig(cfgname); } XElement cfgNode = all_conf.LoadConfig(cfgname); vib_node.LoadCurrentConfig(cfgname); //load the configuration of packer settings sys_cfg.FromElement(cfgNode); vib_node.FromElement(cfgNode); if (pack_node is BottomPackNode) { pack_node.FromElement(cfgNode); pack_node.LoadCurrentConfig(cfgname); } }