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 } } }
private void down_Click(object sender, EventArgs e) // floor 1 { if (lift_status == 0) { if (PictureBox.Top > 0) { lift_status = 1; LiftUp.Start(); // lift goes up if it was in floor 0 direction = "Lift went up"; } SaveEvent(); // function call of a method that saves event to the database } else if (lift_status == 1) { if (PictureBox.Top <= 300) { if ((panel4.Width >= 138) && (panel5.Width <= 150)) { Floor1Doors.Start(); // stop the timers for floor 1 doors FloorOneDoors.Stop(); } label.Text = "1"; Level1.BackColor = Color.AliceBlue; Level0.BackColor = Color.AliceBlue; } } }
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 } }