Загрузил(а) файлы в 'AircraftCarrier/AircraftCarrier'

This commit is contained in:
Daniya_Youdakova 2022-12-15 22:46:54 +04:00
parent 1468070ed2
commit 57a167173d
2 changed files with 214 additions and 73 deletions

View File

@ -30,82 +30,152 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.buttonLeft = new System.Windows.Forms.Button(); this.groupBoxMaps = new System.Windows.Forms.GroupBox();
this.buttonDown = new System.Windows.Forms.Button(); this.listBoxMaps = new System.Windows.Forms.ListBox();
this.buttonUp = new System.Windows.Forms.Button(); this.buttonDeleteMap = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button(); this.buttonAddMap = new System.Windows.Forms.Button();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.buttonShowOnMap = new System.Windows.Forms.Button(); this.buttonShowOnMap = new System.Windows.Forms.Button();
this.buttonShowStorage = new System.Windows.Forms.Button(); this.buttonShowStorage = new System.Windows.Forms.Button();
this.buttonRemoveAircraftCarrier = new System.Windows.Forms.Button(); this.buttonRemoveAircraftCarrier = new System.Windows.Forms.Button();
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox(); this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
this.buttonAddAircraftCarrier = new System.Windows.Forms.Button(); this.buttonAddAircraftCarrier = new System.Windows.Forms.Button();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.pictureBox = new System.Windows.Forms.PictureBox(); this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBoxMaps.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.buttonLeft); this.groupBox1.Controls.Add(this.groupBoxMaps);
this.groupBox1.Controls.Add(this.buttonDown); this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.buttonUp); this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.buttonRight); this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.buttonShowOnMap); this.groupBox1.Controls.Add(this.buttonShowOnMap);
this.groupBox1.Controls.Add(this.buttonShowStorage); this.groupBox1.Controls.Add(this.buttonShowStorage);
this.groupBox1.Controls.Add(this.buttonRemoveAircraftCarrier); this.groupBox1.Controls.Add(this.buttonRemoveAircraftCarrier);
this.groupBox1.Controls.Add(this.maskedTextBoxPosition); this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
this.groupBox1.Controls.Add(this.buttonAddAircraftCarrier); this.groupBox1.Controls.Add(this.buttonAddAircraftCarrier);
this.groupBox1.Controls.Add(this.comboBoxSelectorMap);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox1.Location = new System.Drawing.Point(550, 0); this.groupBox1.Location = new System.Drawing.Point(593, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(250, 450); this.groupBox1.Size = new System.Drawing.Size(250, 519);
this.groupBox1.TabIndex = 0; this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Инструменты"; this.groupBox1.Text = "Инструменты";
// //
// buttonLeft // groupBoxMaps
// //
//this.buttonLeft.BackgroundImage = global::AircraftCarrier.Properties.Resources.Left; this.groupBoxMaps.Controls.Add(this.listBoxMaps);
this.buttonLeft.Location = new System.Drawing.Point(61, 402); this.groupBoxMaps.Controls.Add(this.buttonDeleteMap);
this.buttonLeft.Name = "buttonLeft"; this.groupBoxMaps.Controls.Add(this.buttonAddMap);
this.buttonLeft.Size = new System.Drawing.Size(30, 30); this.groupBoxMaps.Controls.Add(this.textBoxNewMapName);
this.buttonLeft.TabIndex = 11; this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap);
this.buttonLeft.UseVisualStyleBackColor = true; this.groupBoxMaps.Location = new System.Drawing.Point(6, 29);
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click); this.groupBoxMaps.Name = "groupBoxMaps";
this.groupBoxMaps.Size = new System.Drawing.Size(232, 239);
this.groupBoxMaps.TabIndex = 12;
this.groupBoxMaps.TabStop = false;
this.groupBoxMaps.Text = "Карты";
//this.groupBoxMaps.Enter += new System.EventHandler(this.groupBoxMaps_Enter);
// //
// buttonDown // listBoxMaps
// //
//this.buttonDown.BackgroundImage = global::AircraftCarrier.Properties.Resources.Down; this.listBoxMaps.FormattingEnabled = true;
this.buttonDown.Location = new System.Drawing.Point(97, 402); this.listBoxMaps.ItemHeight = 20;
this.buttonDown.Name = "buttonDown"; this.listBoxMaps.Location = new System.Drawing.Point(19, 137);
this.buttonDown.Size = new System.Drawing.Size(30, 30); this.listBoxMaps.Name = "listBoxMaps";
this.buttonDown.TabIndex = 10; this.listBoxMaps.Size = new System.Drawing.Size(184, 64);
this.buttonDown.UseVisualStyleBackColor = true; this.listBoxMaps.TabIndex = 3;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
// //
// buttonUp // buttonDeleteMap
// //
this.buttonUp.Location = new System.Drawing.Point(97, 366); this.buttonDeleteMap.Location = new System.Drawing.Point(19, 208);
this.buttonUp.Name = "buttonUp"; this.buttonDeleteMap.Name = "buttonDeleteMap";
this.buttonUp.Size = new System.Drawing.Size(30, 30); this.buttonDeleteMap.Size = new System.Drawing.Size(184, 29);
this.buttonUp.TabIndex = 9; this.buttonDeleteMap.TabIndex = 2;
this.buttonUp.UseVisualStyleBackColor = true; this.buttonDeleteMap.Text = "Удалить карту";
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); this.buttonDeleteMap.UseVisualStyleBackColor = true;
this.buttonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
// //
// buttonRight // buttonAddMap
// //
this.buttonRight.Location = new System.Drawing.Point(133, 402); this.buttonAddMap.Location = new System.Drawing.Point(19, 102);
this.buttonRight.Name = "buttonRight"; this.buttonAddMap.Name = "buttonAddMap";
this.buttonRight.Size = new System.Drawing.Size(30, 30); this.buttonAddMap.Size = new System.Drawing.Size(184, 29);
this.buttonRight.TabIndex = 8; this.buttonAddMap.TabIndex = 1;
this.buttonRight.UseVisualStyleBackColor = true; this.buttonAddMap.Text = "Добавить карту";
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click); this.buttonAddMap.UseVisualStyleBackColor = true;
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(19, 26);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(184, 27);
this.textBoxNewMapName.TabIndex = 0;
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Сложная карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(19, 68);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(184, 28);
this.comboBoxSelectorMap.TabIndex = 0;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
this.comboBoxSelectorMap.Click += new System.EventHandler(this.ButtonMove_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(71, 483);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(30, 30);
this.button1.TabIndex = 11;
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.ButtonMove_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(107, 483);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(30, 30);
this.button4.TabIndex = 10;
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.ButtonMove_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(107, 447);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(30, 30);
this.button3.TabIndex = 9;
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.ButtonMove_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(143, 483);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(30, 30);
this.button2.TabIndex = 8;
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.ButtonMove_Click);
// //
// buttonShowOnMap // buttonShowOnMap
// //
this.buttonShowOnMap.Location = new System.Drawing.Point(25, 321); this.buttonShowOnMap.Location = new System.Drawing.Point(25, 412);
this.buttonShowOnMap.Name = "buttonShowOnMap"; this.buttonShowOnMap.Name = "buttonShowOnMap";
this.buttonShowOnMap.Size = new System.Drawing.Size(184, 29); this.buttonShowOnMap.Size = new System.Drawing.Size(184, 29);
this.buttonShowOnMap.TabIndex = 6; this.buttonShowOnMap.TabIndex = 6;
@ -115,7 +185,7 @@
// //
// buttonShowStorage // buttonShowStorage
// //
this.buttonShowStorage.Location = new System.Drawing.Point(25, 280); this.buttonShowStorage.Location = new System.Drawing.Point(25, 377);
this.buttonShowStorage.Name = "buttonShowStorage"; this.buttonShowStorage.Name = "buttonShowStorage";
this.buttonShowStorage.Size = new System.Drawing.Size(184, 29); this.buttonShowStorage.Size = new System.Drawing.Size(184, 29);
this.buttonShowStorage.TabIndex = 5; this.buttonShowStorage.TabIndex = 5;
@ -125,7 +195,7 @@
// //
// buttonRemoveAircraftCarrier // buttonRemoveAircraftCarrier
// //
this.buttonRemoveAircraftCarrier.Location = new System.Drawing.Point(25, 230); this.buttonRemoveAircraftCarrier.Location = new System.Drawing.Point(25, 342);
this.buttonRemoveAircraftCarrier.Name = "buttonRemoveAircraftCarrier"; this.buttonRemoveAircraftCarrier.Name = "buttonRemoveAircraftCarrier";
this.buttonRemoveAircraftCarrier.Size = new System.Drawing.Size(184, 29); this.buttonRemoveAircraftCarrier.Size = new System.Drawing.Size(184, 29);
this.buttonRemoveAircraftCarrier.TabIndex = 4; this.buttonRemoveAircraftCarrier.TabIndex = 4;
@ -135,7 +205,7 @@
// //
// maskedTextBoxPosition // maskedTextBoxPosition
// //
this.maskedTextBoxPosition.Location = new System.Drawing.Point(25, 168); this.maskedTextBoxPosition.Location = new System.Drawing.Point(25, 309);
this.maskedTextBoxPosition.Mask = "00"; this.maskedTextBoxPosition.Mask = "00";
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition"; this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(184, 27); this.maskedTextBoxPosition.Size = new System.Drawing.Size(184, 27);
@ -143,7 +213,7 @@
// //
// buttonAddAircraftCarrier // buttonAddAircraftCarrier
// //
this.buttonAddAircraftCarrier.Location = new System.Drawing.Point(25, 110); this.buttonAddAircraftCarrier.Location = new System.Drawing.Point(25, 274);
this.buttonAddAircraftCarrier.Name = "buttonAddAircraftCarrier"; this.buttonAddAircraftCarrier.Name = "buttonAddAircraftCarrier";
this.buttonAddAircraftCarrier.Size = new System.Drawing.Size(184, 29); this.buttonAddAircraftCarrier.Size = new System.Drawing.Size(184, 29);
this.buttonAddAircraftCarrier.TabIndex = 2; this.buttonAddAircraftCarrier.TabIndex = 2;
@ -151,25 +221,12 @@
this.buttonAddAircraftCarrier.UseVisualStyleBackColor = true; this.buttonAddAircraftCarrier.UseVisualStyleBackColor = true;
this.buttonAddAircraftCarrier.Click += new System.EventHandler(this.ButtonAddAircraftCarrier_Click); this.buttonAddAircraftCarrier.Click += new System.EventHandler(this.ButtonAddAircraftCarrier_Click);
// //
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Сложная карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(25, 61);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(184, 28);
this.comboBoxSelectorMap.TabIndex = 0;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
this.comboBoxSelectorMap.Click += new System.EventHandler(this.ButtonMove_Click);
//
// pictureBox // pictureBox
// //
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0); this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Name = "pictureBox"; this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(550, 450); this.pictureBox.Size = new System.Drawing.Size(593, 519);
this.pictureBox.TabIndex = 1; this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false; this.pictureBox.TabStop = false;
//this.pictureBox.Click += new System.EventHandler(this.pictureBox1_Click); //this.pictureBox.Click += new System.EventHandler(this.pictureBox1_Click);
@ -178,13 +235,15 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(843, 519);
this.Controls.Add(this.pictureBox); this.Controls.Add(this.pictureBox);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "FormMapWithSetAircraftCarriers"; this.Name = "FormMapWithSetAircraftCarriers";
this.Text = "Карта с набором объектов"; this.Text = "Карта с набором объектов";
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBoxMaps.ResumeLayout(false);
this.groupBoxMaps.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -193,10 +252,10 @@
#endregion #endregion
private GroupBox groupBox1; private GroupBox groupBox1;
private Button buttonLeft; private Button button1;
private Button buttonDown; private Button button4;
private Button buttonUp; private Button button3;
private Button buttonRight; private Button button2;
private Button buttonShowOnMap; private Button buttonShowOnMap;
private Button buttonShowStorage; private Button buttonShowStorage;
private Button buttonRemoveAircraftCarrier; private Button buttonRemoveAircraftCarrier;
@ -204,5 +263,10 @@
private Button buttonAddAircraftCarrier; private Button buttonAddAircraftCarrier;
private ComboBox comboBoxSelectorMap; private ComboBox comboBoxSelectorMap;
private PictureBox pictureBox; private PictureBox pictureBox;
private GroupBox groupBoxMaps;
private ListBox listBoxMaps;
private Button buttonDeleteMap;
private Button buttonAddMap;
private TextBox textBoxNewMapName;
} }
} }

View File

@ -18,9 +18,79 @@ _mapAircraftCarriersCollectionGeneric;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
{
{ "Простая карта", new SimpleMap() },
{ "Сложная карта", new ComplexMap() }
};
private readonly MapsCollection _mapsCollection;
public FormMapWithSetAircraftCarriers() public FormMapWithSetAircraftCarriers()
{ {
InitializeComponent(); InitializeComponent();
_mapsCollection = new MapsCollection(pictureBox.Width,
pictureBox.Height);
comboBoxSelectorMap.Items.Clear();
foreach (var elem in _mapsDict)
{
comboBoxSelectorMap.Items.Add(elem.Key);
}
}
private void ReloadMaps()
{
int index = listBoxMaps.SelectedIndex;
listBoxMaps.Items.Clear();
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
{
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
}
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >=
listBoxMaps.Items.Count))
{
listBoxMaps.SelectedIndex = 0;
}
else if (listBoxMaps.Items.Count > 0 && index > -1 && index <
listBoxMaps.Items.Count)
{
listBoxMaps.SelectedIndex = index;
}
}
private void ButtonAddMap_Click(object sender, EventArgs e)
{
if (comboBoxSelectorMap.SelectedIndex == -1 ||
string.IsNullOrEmpty(textBoxNewMapName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
{
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
_mapsCollection.AddMap(textBoxNewMapName.Text,
_mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
}
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBox.Image =
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
private void ButtonDeleteMap_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?",
"Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ??
string.Empty);
ReloadMaps();
}
} }
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
{ {
@ -47,7 +117,7 @@ _mapAircraftCarriersCollectionGeneric;
} }
private void ButtonAddAircraftCarrier_Click(object sender, EventArgs e) private void ButtonAddAircraftCarrier_Click(object sender, EventArgs e)
{ {
if (_mapAircraftCarriersCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
@ -55,10 +125,12 @@ _mapAircraftCarriersCollectionGeneric;
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
DrawningObjectAircraftCarrier aircraftcarrier = new(form.SelectedAircraftCarrier); DrawningObjectAircraftCarrier aircraftcarrier = new(form.SelectedAircraftCarrier);
if ((_mapAircraftCarriersCollectionGeneric + aircraftcarrier) != -1) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ??
string.Empty] + aircraftcarrier != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowSet(); pictureBox.Image =
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
} }
else else
{ {
@ -68,6 +140,10 @@ _mapAircraftCarriersCollectionGeneric;
} }
private void buttonRemoveAircraftCarrier_Click(object sender, EventArgs e) private void buttonRemoveAircraftCarrier_Click(object sender, EventArgs e)
{ {
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
{ {
return; return;
@ -78,7 +154,8 @@ _mapAircraftCarriersCollectionGeneric;
return; return;
} }
int pos = Convert.ToInt32(maskedTextBoxPosition.Text); int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_mapAircraftCarriersCollectionGeneric - pos != null) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ??
string.Empty] - pos != null)
{ {
MessageBox.Show("Объект удален"); MessageBox.Show("Объект удален");
pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowSet(); pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowSet();
@ -90,7 +167,7 @@ _mapAircraftCarriersCollectionGeneric;
} }
private void buttonShowStorage_Click(object sender, EventArgs e) private void buttonShowStorage_Click(object sender, EventArgs e)
{ {
if (_mapAircraftCarriersCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
@ -98,7 +175,7 @@ _mapAircraftCarriersCollectionGeneric;
} }
private void buttonShowOnMap_Click(object sender, EventArgs e) private void buttonShowOnMap_Click(object sender, EventArgs e)
{ {
if (_mapAircraftCarriersCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
@ -106,7 +183,7 @@ _mapAircraftCarriersCollectionGeneric;
} }
private void ButtonMove_Click(object sender, EventArgs e) private void ButtonMove_Click(object sender, EventArgs e)
{ {
if (_mapAircraftCarriersCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }