Пример #1
0
        private void up_Click(object sender, EventArgs e)  // floor 0 button
        {
            if (lift_status == 0)
            {
                if (PictureBox.Top > 0)
                {
                    Floor0Doors.Start();            // Open and close floor 0 doors
                }
                label.Text = "0";
            }
            else if (lift_status == 1)
            {
                if (PictureBox.Top <= 300)
                {
                    if ((panel4.Width >= 138) && (panel5.Width <= 150))
                    {
                        lift_status = 0;

                        LiftDown.Start();       // lift goes down
                        FloorOneDoors.Stop();   // stop timer1 door
                        direction = "Lift went down";
                    }

                    label.Text = "0";

                    Level1.BackColor = Color.AliceBlue;
                    Level0.BackColor = Color.AliceBlue;
                    SaveEvent();    // function call of a method that saves event to the database
                }
            }
        }
Пример #2
0
        private void Level0_Click(object sender, EventArgs e)           // button 0
        {
            if (PictureBox.Top < 300)
            {
                if ((panel4.Width >= 138) && (panel5.Width <= 150))
                {
                    LiftDown.Start();           // lift goes down
                    lift_status = 0;
                    FloorOneDoors.Stop();       // stop timer for floor 1
                    direction = "Lift went down";
                }

                label.Text       = "0";
                Level0.BackColor = Color.Red;
                Level1.BackColor = Color.AliceBlue;

                SaveEvent();        // function call of a method that saves event to the database
            }
        }