commit finally
This commit is contained in:
parent
ee9cf0f9d6
commit
5e8622d38d
@ -52,13 +52,13 @@ namespace AirBomber.DrawningObjects
|
|||||||
}
|
}
|
||||||
public void SetPosition(int x, int y)
|
public void SetPosition(int x, int y)
|
||||||
{
|
{
|
||||||
if (_startPosX + _PlaneWidth > _pictureWidth)
|
if (x < 0 || x + _PlaneWidth > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX = _pictureWidth - _PlaneWidth;
|
x = _pictureWidth - _PlaneWidth;
|
||||||
}
|
}
|
||||||
if (_startPosY + _PlaneHeight > 740)
|
if (y < 0 || y + _PlaneWidth > _pictureHeight)
|
||||||
{
|
{
|
||||||
_startPosY = 740 - _PlaneHeight;
|
y = _pictureHeight - _PlaneWidth;
|
||||||
}
|
}
|
||||||
_startPosX = x;
|
_startPosX = x;
|
||||||
_startPosY = y;
|
_startPosY = y;
|
||||||
|
@ -80,6 +80,11 @@ namespace AirBomber
|
|||||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||||
_logger.LogInformation($"Добавлен объект в набор {listBoxStorages.SelectedItem.ToString()}");
|
_logger.LogInformation($"Добавлен объект в набор {listBoxStorages.SelectedItem.ToString()}");
|
||||||
}
|
}
|
||||||
|
catch (ArgumentException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Такой объект уже существует");
|
||||||
|
_logger.LogWarning($"{ex.Message} в наборе {listBoxStorages.SelectedItem.ToString()}");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
Loading…
Reference in New Issue
Block a user