From a67ca743c675a492fed4c1ee27f22c899498d020 Mon Sep 17 00:00:00 2001 From: DelphyAlmond Date: Mon, 17 Jun 2024 09:44:23 +0400 Subject: [PATCH] result --- .../CollectionGenericObj/AbstractCompany.cs | 12 ++++++++++-- .../CollectionGenericObj/ShipSharingService.cs | 13 +++++++++---- .../DrawningSamples/DrawningShipCompare.cs | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ProjectCruiser/CollectionGenericObj/AbstractCompany.cs b/ProjectCruiser/CollectionGenericObj/AbstractCompany.cs index 7af6814..61a2e77 100644 --- a/ProjectCruiser/CollectionGenericObj/AbstractCompany.cs +++ b/ProjectCruiser/CollectionGenericObj/AbstractCompany.cs @@ -60,8 +60,16 @@ public abstract class AbstractCompany for (int i = 0; i < (_collection?.Count ?? 0); i++) { - DrawningBase? obj = _collection?.GetItem(i); - obj?.DrawTransport(graphics); + // try + // { + + DrawningBase? obj = _collection?.GetItem(i); + obj?.DrawTransport(graphics); + + // } catch (Exception ex) + // { + // Console.WriteLine(ex.Message); + // } } return bitmap; diff --git a/ProjectCruiser/CollectionGenericObj/ShipSharingService.cs b/ProjectCruiser/CollectionGenericObj/ShipSharingService.cs index 1fa2de7..f971261 100644 --- a/ProjectCruiser/CollectionGenericObj/ShipSharingService.cs +++ b/ProjectCruiser/CollectionGenericObj/ShipSharingService.cs @@ -53,12 +53,17 @@ public class ShipSharingService : AbstractCompany int newX = fromBorder + 2; for (int j = 0; j < MaxInRow; j++) { - // TRY / CATCH [?] - _collection.GetItem(index_collection).SetPictureSize( - _pictureWidth, _pictureHeight); + try + { + _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; if (index_collection < border) diff --git a/ProjectCruiser/DrawningSamples/DrawningShipCompare.cs b/ProjectCruiser/DrawningSamples/DrawningShipCompare.cs index cb7a8a4..ca396a9 100644 --- a/ProjectCruiser/DrawningSamples/DrawningShipCompare.cs +++ b/ProjectCruiser/DrawningSamples/DrawningShipCompare.cs @@ -7,12 +7,12 @@ public class DrawningShipCompare : IComparer { if (x == null || x.EntityTransport == null) { - return -1; + return 1; } if (y == null || y.EntityTransport == null) { - return 1; + return -1; } if (x.GetType().Name != y.GetType().Name)