public FillingCupProgressBarControl()
 {
     InitializeComponent();
     groupBox1.Text            = ResourceLoadHelper.GetLocalString("Queue");
     fillingCupIndicator.Value = 0;
     _fillColor = fillingCupIndicator.ForeColor;
     if (fillingCupIndicator.SkinImage == null)
     {
         if ((fillingCupIndicator.SkinImage = ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName(DrinkType.None))) == null)
         {
             fillingCupIndicator.SkinExceptRectangleForProgressBar = new Rectangle(15, 36, 52, 105);
         }
         else
         {
             fillingCupIndicator.SkinExceptRectangleForProgressBar = fillingCupIndicator.DisplayRectangle;
         }
     }
     queueImages.Images.Add(ResourceLoadHelper.GetBlankImage(new Size(66, 66), Color.Empty));
     queueImages.Images.Add(ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName(DrinkType.Tea)) ?? ResourceLoadHelper.GetBlankImage(new Size(66, 66), Color.Empty));
     queueImages.Images.Add(ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName(DrinkType.Coffee)) ?? ResourceLoadHelper.GetBlankImage(new Size(66, 66), Color.Empty));
     queueImages.Images.Add(ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName(DrinkType.Juice)) ?? ResourceLoadHelper.GetBlankImage(new Size(66, 66), Color.Empty));
     _flashingCup.NextOperation   += NextOperation;
     _flashingCup.FillCupComplete += FillCupComplete;
     _flashingCup.HideCup         += HideCup;
     _flashingCup.ShowCup         += ShowCup;
     _flashingCup.FillCupProgress += FillCupProgress;
 }
        private void taskQueue_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            Rectangle rect = e.Bounds;

            e.Graphics.FillRectangle(new SolidBrush(e.Item.BackColor), rect);
            e.Graphics.DrawImage(ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName((DrinkType)e.Item.ImageIndex)), rect);
            if (e.Item.Index == 0)
            {
                Pen pen = new Pen(taskQueue.ForeColor, 2);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                rect.Inflate(-1, -1);
                e.Graphics.DrawRectangle(pen, rect);
            }
        }
示例#3
0
 public void RefreshGoods(Dictionary <Guid, Product> drinks)
 {
     descriptionToolTips.RemoveAll();
     if (drinks.Any() && (_buttons == null))
     {
         _buttons = drinks.Values.ToDictionary(x => x.id, y => new Button()
         {
             Size = new Size(94, 94), Font = new Font(Font, FontStyle.Bold), TextAlign = ContentAlignment.TopRight, ForeColor = y.parsedColor.R + y.parsedColor.G + y.parsedColor.B > 381 ? Color.Black : Color.White, BackColor = y.parsedColor, BackgroundImageLayout = ImageLayout.Stretch, BackgroundImage = y.type == DrinkType.None ? null : ResourceLoadHelper.GetImage(ResourceLoadHelper.GetImageName(y.type))
         });
         foreach (KeyValuePair <Guid, Button> btn in _buttons)
         {
             _goodsButtonHandlers.Add(btn.Key, (s, e) => { if (Purchase != null)
                                                           {
                                                               Purchase(btn.Key);
                                                           }
                                      });
             btn.Value.Click += _goodsButtonHandlers[btn.Key];
         }
         flowLayoutPanel1.Controls.AddRange(_buttons.Values.ToArray());
     }
     else
     {
         if (_buttons == null)
         {
             return;
         }
         List <Guid> delete = _buttons.Keys.Except(drinks.Keys).ToList();
         foreach (Guid guid in delete)
         {
             _buttons[guid].Click -= _goodsButtonHandlers[guid];
             flowLayoutPanel1.Controls.Remove(_buttons[guid]);
             _buttons.Remove(guid);
         }
     }
     if (_buttons.Any())
     {
         foreach (Product drink in drinks.Values)
         {
             _buttons[drink.id].Text = drink.quantity.ToString();
             descriptionToolTips.SetToolTip(_buttons[drink.id], string.Format(ResourceLoadHelper.GetLocalString("GoodsDescription"), ResourceLoadHelper.GetLocalName(drink.locals), drink.price, drink.quantity));
         }
     }
 }