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