зафиксировать
This commit is contained in:
parent
4025edbc31
commit
857e61b773
@ -91,14 +91,25 @@ namespace ProjectBoat_bae
|
||||
// ?? string.Empty);
|
||||
// ReloadObjects();
|
||||
// }
|
||||
string name = listBoxStorages.SelectedItem.ToString() ?? string.Empty;
|
||||
if (MessageBox.Show($"Удалить объект {name}?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
_storage.DelSet(name);
|
||||
ReloadObjects();
|
||||
_logger.LogInformation($"Deleted set: {name}");
|
||||
MessageBox.Show("Не всё заполнено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_logger.LogWarning("Неудачная попытка. Коллекция не добавлена, не все данные заполнены");
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
|
||||
_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
||||
|
||||
//string name = listBoxStorages.SelectedItem.ToString() ?? string.Empty;
|
||||
//if (MessageBox.Show($"Удалить объект {name}?", "Удаление",
|
||||
//MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
//{
|
||||
// _storage.DelSet(name);
|
||||
// ReloadObjects();
|
||||
// _logger.LogInformation($"Deleted set: {name}");
|
||||
//}
|
||||
}
|
||||
|
||||
// Добавление объекта в набор
|
||||
@ -124,57 +135,30 @@ namespace ProjectBoat_bae
|
||||
//formPlaneConfig.AddEvent(AddBoat);
|
||||
//formPlaneConfig.Show();
|
||||
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Всё заполнено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_logger.LogWarning("Неудачная попытка. Коллекция не добавлена, не все данные заполнены");
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
|
||||
_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
||||
FormBoatConfig formPlaneConfig = new FormBoatConfig();
|
||||
formPlaneConfig.AddEvent(AddBoat);
|
||||
formPlaneConfig.Show();
|
||||
}
|
||||
|
||||
private void AddBoat(Drawningboat boat)
|
||||
{
|
||||
//boat._pictureWidth = pictureBoxCollection.Width;
|
||||
//boat._pictureHeight = pictureBoxCollection.Height;
|
||||
//if (listBoxStorages.SelectedIndex == -1) return;
|
||||
//var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
//if (obj == null) return;
|
||||
|
||||
//if (obj + boat)
|
||||
//{
|
||||
// MessageBox.Show("Объект добавлен");
|
||||
// pictureBoxCollection.Image = obj.ShowBoats();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MessageBox.Show("Не удалось добавить объект");
|
||||
//}
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
boat._pictureWidth = pictureBoxCollection.Width;
|
||||
boat._pictureHeight = pictureBoxCollection.Height;
|
||||
if (listBoxStorages.SelectedIndex == -1) return;
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
if (obj == null) return;
|
||||
|
||||
if (obj + boat)
|
||||
{
|
||||
_logger.LogWarning("Добавление пустого объекта");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_ = obj + boat;
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
_logger.LogInformation($"boat added in set{listBoxStorages.SelectedItem.ToString()}");
|
||||
_logger.LogInformation($"Добавлен объект {obj}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
_logger.LogWarning($"boat not added in set{listBoxStorages.SelectedItem.ToString()}");
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//удаление объекта
|
||||
|
Loading…
x
Reference in New Issue
Block a user