diff --git a/Tank/Tank/FormTank.Designer.cs b/Tank/Tank/FormTank.Designer.cs index 0f9e611..4a148c0 100644 --- a/Tank/Tank/FormTank.Designer.cs +++ b/Tank/Tank/FormTank.Designer.cs @@ -173,7 +173,6 @@ Margin = new Padding(3, 4, 3, 4); Name = "FormTank"; Text = "FormTank"; - Load += FormTank_Load; ((System.ComponentModel.ISupportInitialize)pictureBoxTank).EndInit(); ResumeLayout(false); } diff --git a/Tank/Tank/FormTank.cs b/Tank/Tank/FormTank.cs index 8d1fe16..aae6222 100644 --- a/Tank/Tank/FormTank.cs +++ b/Tank/Tank/FormTank.cs @@ -128,10 +128,5 @@ namespace Tank SelectedTank = _Tank; DialogResult = DialogResult.OK; } - - private void FormTank_Load(object sender, EventArgs e) - { - - } } } \ No newline at end of file diff --git a/Tank/Tank/CollectionsFrame.Designer.cs b/Tank/Tank/FormTanksCollections.Designer.cs similarity index 99% rename from Tank/Tank/CollectionsFrame.Designer.cs rename to Tank/Tank/FormTanksCollections.Designer.cs index d58dea0..d93389d 100644 --- a/Tank/Tank/CollectionsFrame.Designer.cs +++ b/Tank/Tank/FormTanksCollections.Designer.cs @@ -1,6 +1,6 @@ namespace Tank { - partial class CollectionsFrame + partial class FormTanksCollections { /// /// Required designer variable. diff --git a/Tank/Tank/CollectionsFrame.cs b/Tank/Tank/FormTanksCollections.cs similarity index 95% rename from Tank/Tank/CollectionsFrame.cs rename to Tank/Tank/FormTanksCollections.cs index 4a206ff..4aef8b2 100644 --- a/Tank/Tank/CollectionsFrame.cs +++ b/Tank/Tank/FormTanksCollections.cs @@ -13,11 +13,11 @@ using System.Windows.Forms; namespace Tank { - public partial class CollectionsFrame : Form + public partial class FormTanksCollections : Form { private readonly TanksGenericCollection _tanks; - public CollectionsFrame() + public FormTanksCollections() { InitializeComponent(); _tanks = new TanksGenericCollection(DrawTank.Width, DrawTank.Height); diff --git a/Tank/Tank/CollectionsFrame.resx b/Tank/Tank/FormTanksCollections.resx similarity index 100% rename from Tank/Tank/CollectionsFrame.resx rename to Tank/Tank/FormTanksCollections.resx diff --git a/Tank/Tank/Program.cs b/Tank/Tank/Program.cs index be056fe..afa7dde 100644 --- a/Tank/Tank/Program.cs +++ b/Tank/Tank/Program.cs @@ -11,7 +11,7 @@ namespace Tank // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new CollectionsFrame()); + Application.Run(new FormTanksCollections()); } } } \ No newline at end of file diff --git a/Tank/Tank/SetGeneric.cs b/Tank/Tank/SetGeneric.cs index 445a11b..cf12286 100644 --- a/Tank/Tank/SetGeneric.cs +++ b/Tank/Tank/SetGeneric.cs @@ -44,14 +44,14 @@ namespace Tank } // Добавление объекта в набор на конкретную позицию - public int Insert(T tank, int position) + public bool Insert(T tank, int position) { if (position < 0 || position >= Count) - return -1; + return false; if (_places[position] == null) { _places[position] = tank; - return position; + return true; } int index = -1; for(int i = position; i < Count; i++) @@ -62,13 +62,13 @@ namespace Tank } } if (index < 0) - return -1; + return false; for(int i = index; index > position; i--) { _places[i] = _places[i - 1]; } _places[position] = tank; - return position; + return true; } // Удаление объекта из набора с конкретной позиции diff --git a/Tank/Tank/TanksGenericCollection.cs b/Tank/Tank/TanksGenericCollection.cs index f1d5b0c..1eddea4 100644 --- a/Tank/Tank/TanksGenericCollection.cs +++ b/Tank/Tank/TanksGenericCollection.cs @@ -99,7 +99,7 @@ namespace Tank.Generics DrawArmoVehicle? tank = _collection.Get(i); if (tank == null) continue; - tank.SetPosition(i % width * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight); + tank.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight); tank.DrawTransport(g); } }