finish
This commit is contained in:
parent
5e46d4770d
commit
6ead7f2b69
@ -40,7 +40,7 @@ public abstract class AbstractCompany
|
||||
/// <summary>
|
||||
/// Вычисление максимального количества элементов, который можно разместить в окне
|
||||
/// </summary>
|
||||
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
|
||||
private int GetMaxCount => (_pictureWidth / _placeSizeWidth) * (_pictureHeight / _placeSizeHeight);
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
@ -62,9 +62,9 @@ public abstract class AbstractCompany
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="boat">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningAirPlane boat)
|
||||
public static int operator +(AbstractCompany company, DrawningAirPlane airPlane)
|
||||
{
|
||||
return company._collection?.Insert(boat) ?? -1;
|
||||
return company._collection?.Insert(airPlane) ?? -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -100,10 +100,15 @@ public abstract class AbstractCompany
|
||||
|
||||
SetObjectsPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
DrawningAirPlane? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
throw new CollectionOverflowException(Count);
|
||||
_collection.Insert(position, obj);
|
||||
return position;
|
||||
|
||||
}
|
||||
|
||||
public T Remove(int position)
|
||||
|
@ -201,7 +201,6 @@ public class StorageCollection<T>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_storages.Add(record[0], collection);
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ using System.Windows.Forms;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using AirBomber.Exceptions;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
namespace AirBomber;
|
||||
|
||||
public partial class FormAirPlaneCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
@ -24,7 +24,7 @@ namespace AirBomber
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
private AbstractCompany? _company;
|
||||
private AbstractCompany? _company = null;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
@ -35,6 +35,8 @@ namespace AirBomber
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageCollection = new();
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Форма загрузилась");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -345,4 +347,3 @@ namespace AirBomber
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user