Esempio n. 1
0
        public TableModel(JToken tableTokenJson, Ratio ratioX, Ratio ratioY, int id, ListBox list)
        {
            this.List    = list;
            this.Reciept = new Reciept();
            //this.Reciept.AddItem(new Item() { ID = 0,Name="Bere",Quantity=19,Price=13.2 });
            this.Id     = id;
            this.RatioX = ratioX;
            this.RatioY = ratioY;
            string tablecoordinates = tableTokenJson.ToString().Split('"')[1];

            if (tablecoordinates.Split(':').Length > 1)
            {
                this.Location = new Point(ratioX.PixelsFromMeters(Convert.ToDouble(tablecoordinates.Split(':')[1])), ratioY.PixelsFromMeters(Convert.ToDouble(tablecoordinates.Split(':')[0])));
                this.Height   = this.RatioY.PixelsFromMeters(0.5);
                this.Width    = this.RatioX.PixelsFromMeters(0.5);
                MiddlePoint   = new Point(this.Location.X + this.Width / 4, this.Location.Y + this.Height / 4);
                int i = 1;
                foreach (var chairToken in tableTokenJson.Children().Children <JToken>())
                {
                    ChairModel chair = new ChairModel(chairToken.ToString(), this.MiddlePoint, ratioX, ratioY, i++);
                    scaune.Add(chair);
                }
            }
            else
            {
                throw new Exception("The table needs coordinates aswell");
            }
        }
Esempio n. 2
0
        public Chair(ChairModel model) : base()
        {
            try
            {
                this.model    = model;
                base.Location = new System.Drawing.Point(model.X, model.Y);
                //base.BackColor = Color.Green;
                base.Height = model.RatioY.PixelsFromMeters(0.3);
                base.Width  = model.RatioX.PixelsFromMeters(0.3);
                Bitmap imagine = new Bitmap("Scaun.png");
                imagine.MakeTransparent();
                imagine.MakeTransparent(Color.Black);

                base.Image = Util.ResizeBitmap(imagine, this.Width, this.Height);

                base.Visible     = true;
                this.MouseClick += Chair_MouseClick;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Nu avem acces la Scaun.png because:" + ex.Message);
            }
        }