Exemplo n.º 1
0
        public void Init(ProdClickHandler h, bool CanDelete)
        {
            this.phandler = h;
            PackerConfig pcfg = new PackerConfig();

            totalNum = 0;
            idlist.Clear();
            imglist.Clear();
            foreach (string id in curr_packer.pkg_confs.Keys)
            {
                totalNum++;
                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");
                }
                idlist.Add(id);
                imglist.Add(fi.Name.Remove(fi.Name.Length - 4, 4).Replace(' ', '_'));

                bReadOnly = !CanDelete;
            }
            UpdateDisplay();
            this.Show();
        }
Exemplo n.º 2
0
        public void Init(ProdClickHandler h, bool CanDelete)
        {
            this.phandler = h;
            PackerConfig pcfg = new PackerConfig();
            totalNum = 0;
            idlist.Clear();
            imglist.Clear();
            foreach (string id in curr_packer.pkg_confs.Keys)
            {
                totalNum++;
                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");
                }
                idlist.Add(id);
                imglist.Add(fi.Name.Remove(fi.Name.Length - 4, 4).Replace(' ', '_'));

                bReadOnly = !CanDelete;
            }
            UpdateDisplay();
            this.Show();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 public void Init(ProdClickHandler h)
 {
     this.phandler = h;
     this.Show();
     UpdateDisplay();
 }
Exemplo n.º 6
0
 public void Init(ProdClickHandler h)
 {
     this.phandler = h;
     this.Show();
 }
Exemplo n.º 7
0
 public void Init(ProdClickHandler h)
 {
     this.phandler = h;
     this.Show();
     UpdateDisplay();
 }
Exemplo n.º 8
0
 public void Init(ProdClickHandler h)
 {
     this.phandler = h;
     this.Show();
 }