зафиксировать
This commit is contained in:
parent
7c4cf25b53
commit
646780ae8a
@ -74,11 +74,11 @@ namespace ProjectBoat_bae.DrawningObjects
|
||||
// Установка позиции
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0 || x + _boatWidth > _pictureWidth)
|
||||
if (x < 0 || x + _boatWidth > _pictureWidth + 90)
|
||||
{
|
||||
x = Math.Max(0, _pictureWidth - _boatWidth);
|
||||
}
|
||||
if (y < 0 || y + _boatHeight > _pictureHeight)
|
||||
if (y < 0 || y + _boatHeight > _pictureHeight + 60)
|
||||
{
|
||||
y = Math.Max(0, _pictureHeight - _boatHeight);
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ namespace ProjectBoat_bae.DrawningObjects
|
||||
if (EntityBoat != null)
|
||||
{
|
||||
EntityBoat = new EntityMotorBoat(speed, weight, bodyColor,
|
||||
additionalColor, body, wing);
|
||||
|
||||
additionalColor, body, wing);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,15 +60,6 @@ namespace ProjectBoat_bae
|
||||
private void ButtonAddObject_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
//{
|
||||
// MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
// MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// return;
|
||||
//}
|
||||
//_storage.AddSet(textBoxStorageName.Text);
|
||||
//ReloadObjects();
|
||||
//_logger.LogInformation($"Added set: {textBoxStorageName.Text}");
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Input not complete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
@ -82,21 +73,7 @@ namespace ProjectBoat_bae
|
||||
// Удаление набора
|
||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (listBoxStorages.SelectedIndex == -1)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
//{
|
||||
// MessageBox.Show("Не всё заполнено", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// _logger.LogWarning("Неудачная попытка. Коллекция не добавлена, не все данные заполнены");
|
||||
// return;
|
||||
//}
|
||||
//_storage.AddSet(textBoxStorageName.Text);
|
||||
//ReloadObjects();
|
||||
|
||||
//_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
||||
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
@ -114,19 +91,6 @@ namespace ProjectBoat_bae
|
||||
// Добавление объекта в набор
|
||||
private void ButtonAddBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (listBoxStorages.SelectedIndex == -1)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
//if (obj == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//FormBoatConfig formPlaneConfig = new FormBoatConfig();
|
||||
//formPlaneConfig.AddEvent(AddBoat);
|
||||
//formPlaneConfig.Show();
|
||||
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
@ -144,23 +108,7 @@ namespace ProjectBoat_bae
|
||||
|
||||
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();
|
||||
// _logger.LogInformation($"Добавлен объект {obj}");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MessageBox.Show("Не удалось добавить объект");
|
||||
//}
|
||||
|
||||
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
@ -190,45 +138,6 @@ namespace ProjectBoat_bae
|
||||
private void ButtonRemoveBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//if (listBoxStorages.SelectedIndex == -1)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
//if (obj == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//if (MessageBox.Show("Удалить объект?", "Удалить", MessageBoxButtons.YesNo,
|
||||
// MessageBoxIcon.Question) == DialogResult.No)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//try
|
||||
//{
|
||||
// int pos = Convert.ToInt32(textBoxBoat.Text);
|
||||
// if (obj - pos != null)
|
||||
// {
|
||||
// MessageBox.Show("Объект удален");
|
||||
// pictureBoxCollection.Image = obj.ShowBoats();
|
||||
// _logger.LogInformation($"лодка удалена из набора {listBoxStorages.SelectedItem.ToString()}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MessageBox.Show("Объект не удален");
|
||||
// _logger.LogWarning($"лодка не удалена из набора {listBoxStorages.SelectedItem.ToString()}");
|
||||
// }
|
||||
//}
|
||||
//catch (BoatNotFoundException ex)
|
||||
//{
|
||||
// MessageBox.Show(ex.Message);
|
||||
// _logger.LogWarning($"BoatNotFound: {ex.Message} in set {listBoxStorages.SelectedItem.ToString()}");
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// MessageBox.Show("Объекта нет");
|
||||
// _logger.LogWarning("Not input");
|
||||
//}
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
@ -273,17 +182,6 @@ namespace ProjectBoat_bae
|
||||
// Обновление
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (listBoxStorages.SelectedIndex == -1)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
//string.Empty];
|
||||
//if (obj == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//pictureBoxCollection.Image = obj.ShowBoats();
|
||||
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
@ -300,8 +198,6 @@ namespace ProjectBoat_bae
|
||||
//Выбор набора
|
||||
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
//pictureBoxCollection.Image =
|
||||
//_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowBoats();
|
||||
pictureBoxCollection.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowBoats();
|
||||
}
|
||||
|
@ -45,11 +45,10 @@ namespace ProjectBoat_bae.Generics
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//return (bool)collect._collection.Insert(obj);
|
||||
return collect._collection.Insert(obj, new DrawingBoatEqutables());
|
||||
}
|
||||
|
||||
// Перегрузка оператора вычитанияreturn collect._collection.Insert(obj, new DrawingPlaneEqutables());
|
||||
// Перегрузка оператора вычитания
|
||||
public static T? operator -(BoatsGenericCollection<T, U> collect, int
|
||||
pos)
|
||||
{
|
||||
|
@ -14,9 +14,8 @@ namespace ProjectBoat_bae.Generics
|
||||
{
|
||||
internal class BoatsGenericStorage
|
||||
{
|
||||
//readonly Dictionary<string, BoatsGenericCollection<Drawningboat, DrawningObjectBoat>> _boatStorages;
|
||||
readonly Dictionary<string, BoatsGenericCollection<Drawningboat, DrawningObjectBoat>> _boatStorages;
|
||||
// public List<string> Keys => _boatStorages.Keys.ToList();
|
||||
|
||||
public List<string> Keys => _boatStorages.Keys.ToList();
|
||||
|
||||
private readonly int _pictureWidth;
|
||||
@ -29,8 +28,7 @@ namespace ProjectBoat_bae.Generics
|
||||
}
|
||||
public void AddSet(string name)
|
||||
{
|
||||
//if (_boatStorages.ContainsKey(name)) return;
|
||||
//_boatStorages[name] = new BoatsGenericCollection<Drawningboat, DrawningObjectBoat>(_pictureWidth, _pictureHeight);
|
||||
|
||||
if (_boatStorages.ContainsKey(name)) return;
|
||||
_boatStorages[name] = new BoatsGenericCollection<Drawningboat, DrawningObjectBoat>(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
|
@ -25,20 +25,6 @@ namespace ProjectBoat_bae.Generics
|
||||
_places = new List<T?>(_maxCount);
|
||||
}
|
||||
|
||||
//public bool Insert(T boat)
|
||||
//{
|
||||
// return Insert(boat, 0);
|
||||
//}
|
||||
//public bool Insert(T boat, int position)
|
||||
//{
|
||||
// if (position < 0 || position >= _maxCount)
|
||||
// return false;
|
||||
|
||||
// if (Count >= _maxCount)
|
||||
// return false;
|
||||
// _places.Insert(0, boat);
|
||||
// return true;
|
||||
//}
|
||||
public bool Insert(T boat, IEqualityComparer<T?>? equal = null)
|
||||
{
|
||||
if (equal != null)
|
||||
@ -74,31 +60,6 @@ namespace ProjectBoat_bae.Generics
|
||||
return true;
|
||||
}
|
||||
|
||||
//public bool Remove(int position)
|
||||
//{
|
||||
// if (position < 0 || position > _maxCount)
|
||||
// return false;
|
||||
// if (position >= Count)
|
||||
// return false;
|
||||
// _places.RemoveAt(position);
|
||||
// return true;
|
||||
//}
|
||||
//public T? this[int position]
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (position < 0 || position > _maxCount)
|
||||
// return null;
|
||||
// return _places[position];
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// if (position < 0 || position > _maxCount)
|
||||
// return;
|
||||
// _places[position] = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position >= Count || position < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user