예제 #1
0
        //event for mouseclick on lighting units to display information about the wanted unit
        //also functions as a second method of checking the checkboxes when choosing addresses
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            l.Location = new Point(0, _buttons[2].Location.Y - _buttonHeight * 2);
            l.AutoSize = true;
            Point LocalMousePosition = SimulationRoom.PointToClient(Cursor.Position);

            foreach (var VARIABLE in light)
            {
                if (VARIABLE.x <= LocalMousePosition.X + 10 && VARIABLE.x >= LocalMousePosition.X - 10 &&
                    VARIABLE.y <= LocalMousePosition.Y + 10 && VARIABLE.y >= LocalMousePosition.Y - 10)
                {
                    l.Text = "Current Ligting Unit: " + VARIABLE.Address;
                    LightingUnit Current = DALIController.FindUnitWithAddress(VARIABLE.Address);
                    InfoScreen.ChangeCurrentLightingUnit(Current);
                    if (CheckBoxes[VARIABLE.Address].Checked == false)
                    {
                        CheckBoxes[VARIABLE.Address].Checked = true;
                    }
                    else if (CheckBoxes[VARIABLE.Address].Checked == true)
                    {
                        CheckBoxes[VARIABLE.Address].Checked = false;
                    }
                }
            }
        }