This commit is contained in:
Inna Pruidze 2024-06-17 09:44:23 +04:00
parent 7fc6a50c1b
commit a67ca743c6
3 changed files with 21 additions and 8 deletions

View File

@ -60,8 +60,16 @@ public abstract class AbstractCompany
for (int i = 0; i < (_collection?.Count ?? 0); i++) for (int i = 0; i < (_collection?.Count ?? 0); i++)
{ {
DrawningBase? obj = _collection?.GetItem(i); // try
obj?.DrawTransport(graphics); // {
DrawningBase? obj = _collection?.GetItem(i);
obj?.DrawTransport(graphics);
// } catch (Exception ex)
// {
// Console.WriteLine(ex.Message);
// }
} }
return bitmap; return bitmap;

View File

@ -53,12 +53,17 @@ public class ShipSharingService : AbstractCompany
int newX = fromBorder + 2; int newX = fromBorder + 2;
for (int j = 0; j < MaxInRow; j++) for (int j = 0; j < MaxInRow; j++)
{ {
// TRY / CATCH [?] try
_collection.GetItem(index_collection).SetPictureSize( {
_pictureWidth, _pictureHeight); _collection.GetItem(index_collection).SetPictureSize(
_pictureWidth, _pictureHeight);
_collection.GetItem(index_collection).SetPosition(newX, newY); _collection.GetItem(index_collection).SetPosition(newX, newY);
} catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
newX += _placeSizeWidth + between + 2; newX += _placeSizeWidth + between + 2;
if (index_collection < border) if (index_collection < border)

View File

@ -7,12 +7,12 @@ public class DrawningShipCompare : IComparer<DrawningBase?>
{ {
if (x == null || x.EntityTransport == null) if (x == null || x.EntityTransport == null)
{ {
return -1; return 1;
} }
if (y == null || y.EntityTransport == null) if (y == null || y.EntityTransport == null)
{ {
return 1; return -1;
} }
if (x.GetType().Name != y.GetType().Name) if (x.GetType().Name != y.GetType().Name)