From 854c7ea1b61ac39f5714688ddc3cb9f740895cda Mon Sep 17 00:00:00 2001 From: GokaPek <109132407+GokaPek@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:01:29 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BD=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormSPAUCollection.Designer.cs | 2 +- .../FormSPAUCollection.cs | 14 +++++++++++--- .../SelfPropelledArtilleryUnit/SetGeneric.cs | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.Designer.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.Designer.cs index 689a1dd..f2322bf 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.Designer.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.Designer.cs @@ -115,11 +115,11 @@ // listBoxStorages.FormattingEnabled = true; listBoxStorages.ItemHeight = 20; - listBoxStorages.Items.AddRange(new object[] { "Ans", "Second", "Dry", "Quadro" }); listBoxStorages.Location = new Point(18, 87); listBoxStorages.Name = "listBoxStorages"; listBoxStorages.Size = new Size(143, 64); listBoxStorages.TabIndex = 7; + listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged; // // ButtonDelObject // diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.cs index 45f2ba6..beac829 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSPAUCollection.cs @@ -62,12 +62,12 @@ namespace SelfPropelledArtilleryUnit /// private void ButtonAddObject_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(listBoxStorages.Text)) + if (string.IsNullOrEmpty(textBoxStorageName.Text)) { MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - _storage.AddSet(listBoxStorages.Text); + _storage.AddSet(textBoxStorageName.Text); ReloadObjects(); } @@ -76,10 +76,16 @@ namespace SelfPropelledArtilleryUnit /// /// /// - private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e) + + private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e) { pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowSPAUs(); } + /// + /// Удаление набора + /// + /// + /// private void ButtonDelObject_Click(object sender, EventArgs e) { @@ -188,5 +194,7 @@ namespace SelfPropelledArtilleryUnit } pictureBoxCollection.Image = obj.ShowSPAUs(); } + + } } diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/SetGeneric.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/SetGeneric.cs index 85aef92..f07b832 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/SetGeneric.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/SetGeneric.cs @@ -1,4 +1,6 @@ -using System; +using SelfPropelledArtilleryUnit.DrawningObjects; +using SelfPropelledArtilleryUnit.MovementStrategy; +using System; using System.Collections.Generic; using System.Configuration; using System.Linq;