From b96720079294aac48d585a2325e3896302ab4850 Mon Sep 17 00:00:00 2001 From: sqdselo <147947144+sqdselo@users.noreply.github.com> Date: Mon, 1 Apr 2024 01:15:33 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82?= =?UTF-8?q?=D0=BE=D1=87=D0=BD=D0=BE=20=D0=B2=D1=81=D1=91=20=D0=B3=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=BE.=20=D0=9B=D0=B0=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{CarSharingService.cs => Garage.cs} | 23 +++++++++---------- .../HoistingCrane/FormCarCollection.cs | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) rename HoistingCrane/HoistingCrane/CollectionGenericObjects/{CarSharingService.cs => Garage.cs} (70%) diff --git a/HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs b/HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs similarity index 70% rename from HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs rename to HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs index 44f0e37..e2da629 100644 --- a/HoistingCrane/HoistingCrane/CollectionGenericObjects/CarSharingService.cs +++ b/HoistingCrane/HoistingCrane/CollectionGenericObjects/Garage.cs @@ -1,15 +1,14 @@ using HoistingCrane.Drawning; using System; +using System.Collections.Specialized; namespace HoistingCrane.CollectionGenericObjects { - public class CarSharingService : AbstractCompany + public class Garage : AbstractCompany { - public CarSharingService(int picWidth, int picHeight, ICollectionGenericObjects array) : base(picWidth, picHeight, array) + public Garage(int picWidth, int picHeight, ICollectionGenericObjects array) : base(picWidth, picHeight, array) { } - - protected override void DrawBackgound(Graphics g) { int width = pictureWidth / _placeSizeWidth; @@ -30,25 +29,25 @@ namespace HoistingCrane.CollectionGenericObjects int countWidth = pictureWidth / _placeSizeWidth; int countHeight = pictureHeight / _placeSizeHeight; - int currentPosWidth = 0; - int currentPosHeight = 0; + int currentPosWidth = countWidth - 1; + int currentPosHeight = countHeight - 1; for (int i = 0; i < (arr?.Count ?? 0); i++) { if (arr?.Get(i) != null) { arr?.Get(i)?.SetPictureSize(pictureWidth, pictureHeight); - arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, currentPosHeight * _placeSizeHeight + 15); + arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, _placeSizeHeight * currentPosHeight + 15); } - if (currentPosWidth < countWidth-1) - currentPosWidth++; + if (currentPosWidth > 0) + currentPosWidth--; else { - currentPosWidth = 0; - currentPosHeight++; + currentPosWidth = countWidth - 1; + currentPosHeight--; } - if (currentPosHeight > countHeight - 1) + if (currentPosHeight < 0) { break; } diff --git a/HoistingCrane/HoistingCrane/FormCarCollection.cs b/HoistingCrane/HoistingCrane/FormCarCollection.cs index 5c6c1ad..7175e29 100644 --- a/HoistingCrane/HoistingCrane/FormCarCollection.cs +++ b/HoistingCrane/HoistingCrane/FormCarCollection.cs @@ -25,7 +25,7 @@ namespace HoistingCrane switch (comboBoxSelectorCompany.Text) { case "Хранилище": - _company = new CarSharingService(pictureBox.Width, pictureBox.Height, new MassivGenericObjects()); + _company = new Garage(pictureBox.Width, pictureBox.Height, new MassivGenericObjects()); break; } }