Example #1
0
 private void place_click(object sender, EventArgs e)
 {
     if (areaEntity != null)
     {
         areaEntity.DrawArea(this.grpArea);
         RobotEntity.Clear();
         int robotXCoor = int.Parse(txtRobotXCoor.Text);
         int robotYCoor = areaEntity.ySize - int.Parse(txtRobotYCoor.Text);
         if (robotXCoor < 0 || robotYCoor < 0)
         {
             MessageBox.Show("Alan ölçüleri 0 dan büyük bir değer olmalıdır.");
             return;
         }
         else if (robotXCoor > areaEntity.xSize || robotYCoor > areaEntity.ySize)
         {
             MessageBox.Show("Robot koordinatı alan içerisinde olmalıdır.");
             return;
         }
         else
         {
             Directions direction = (Directions)Enum.Parse(typeof(Directions), cbxDirection.SelectedItem.ToString());
             robotEntity = RobotEntity.CreateInstance(robotXCoor, robotYCoor, direction);
         }
     }
     else
     {
         MessageBox.Show("Alanı oluşturun.");
     }
 }