PIbd-14 Pruidze_I.K. LabWork08 Simple #15

Closed
Delphy wants to merge 3 commits from Lab8 into Lab7
3 changed files with 21 additions and 8 deletions
Showing only changes of commit a67ca743c6 - Show all commits

View File

@ -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;

View File

@ -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)

View File

@ -7,12 +7,12 @@ public class DrawningShipCompare : IComparer<DrawningBase?>
{
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)