Exemplo n.º 1
0
        void UpdateVisuals()
        {
            //Set all to red by deault;
            foreach (Control c in carPark.Controls)
            {
                c.BackColor = Color.Green;
            }

            //Display all full spaces as green.
            try
            {
                List <SpaceSensor> spaces = carParks.getAvailableSpaces();
                foreach (SpaceSensor s in spaces)
                {
                    foreach (Control c in carPark.Controls)
                    {
                        if (c is PictureBox)
                        {
                            if (s.getID() == Int32.Parse(c.Name))
                            {
                                c.BackColor = Color.Red;
                            }
                        }
                    }
                }
            }
            catch { };
        }