示例#1
0
文件: MenuItem.cs 项目: 3dsoft/Kiosk
        public MenuItem(Project1.Models.MenuItem menuItem)
        {
            this.menuItem = menuItem;

            InitializeComponent();

            string filename = "http://localhost:11799" + menuItem.ImagePath;

            pictureBox1.Image = GetImageFromPicPath(filename);
            label1.Text       = menuItem.Name;
            label2.Text       = menuItem.Price.ToString("C");
        }
示例#2
0
        private void Mi_MenuSelected(object sender, Models.MenuItem mm)
        {
            Panel pn = new Panel();

            pn.Size = new Size(220, 230);
            MenuItem mi = new MenuItem(mm);

            mi.isMenuList      = false;
            mi.RemoveFromCart += Mi_RemoveFromCart;
            pn.Name            = "cart" + mm.Id.ToString();
            pn.Controls.Add(mi);
            flowLayoutPanel2.Controls.Add(pn);

            flowLayoutPanel2.HorizontalScroll.Value = flowLayoutPanel2.HorizontalScroll.Maximum;

            flowLayoutPanel1.PerformLayout();

            lblTotal.Text = receipt.GetTotalPrice().ToString("C");
        }
示例#3
0
        private void Mi_RemoveFromCart(object sender, Models.MenuItem menuItem)
        {
            //flowLayoutPanel2.Controls.Remove(((MenuItem)flowLayoutPanel2.Controls["cart" + menuItem.Id.ToString()]));

            Control selectedControl = new Control();

            foreach (Control control in flowLayoutPanel2.Controls)
            {
                if (control.Name == "cart" + menuItem.Id.ToString())
                {
                    selectedControl = control;
                    break;
                }
            }

            if (selectedControl != null && selectedControl.Name == "cart" + menuItem.Id.ToString())
            {
                flowLayoutPanel2.Controls.Remove(selectedControl);
            }

            lblTotal.Text = receipt.GetTotalPrice().ToString("C");
        }
示例#4
0
文件: Receipt.cs 项目: 3dsoft/Kiosk
 public void RemoveReceipt(MenuItem menuItem)
 {
     menuItems.Remove(menuItem);
 }
示例#5
0
文件: Receipt.cs 项目: 3dsoft/Kiosk
 public void AddReceipt(MenuItem menuItem)
 {
     menuItems.Add(menuItem);
 }