Example #1
0
		private void button1_Click_1(object sender, EventArgs e)
		{
			if (listBoxLevels.SelectedIndex > -1)
			{ //Прежде чем забрать машину, надо выбирать с какого уровня будем забирать
				string level = listBoxLevels.Items[listBoxLevels.SelectedIndex].ToString();
				if (maskedTextBox1.Text != "")
				{
					try
					{
						ITechnique plane = parking.GetPlaneInParking(Convert.ToInt32(maskedTextBox1.Text));
						Bitmap bmp = new Bitmap(pictureBox2.Width, pictureBox2.Height);
						Graphics gr = Graphics.FromImage(bmp);
						plane.setPosition(0, 0);
						plane.drawBombardir(gr);
						pictureBox2.Image = bmp;
						Draw();
						log.Info("Забрали с места: " + Convert.ToInt32(maskedTextBox1.Text));
					}
					catch (ParkingIndexOutOfRangeException ex)
					{
						MessageBox.Show(ex.Message, "Неверный номер",
							MessageBoxButtons.OK, MessageBoxIcon.Error);
					}
					catch (Exception ex)
					{
						MessageBox.Show(ex.Message, "Общая ошибка",
							MessageBoxButtons.OK, MessageBoxIcon.Error);
					}
				}
			}
		}
Example #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (maskedTextBox1.Text != "")
            {
                var plane = parking.GetPlaneInParking(Convert.ToInt32(maskedTextBox1.Text));

                Bitmap   bmp = new Bitmap(pictureBox2.Width, pictureBox2.Height);
                Graphics gr  = Graphics.FromImage(bmp);
                plane.setPosition(0, 0);
                plane.drawBombardir(gr);
                pictureBox2.Image = bmp;
                Draw();
            }
        }