diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs index 5c24eb2..554be16 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs @@ -47,76 +47,6 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // - // groupBoxMaps - // - this.groupBoxMaps.Controls.Add(this.buttonDeleteMap); - this.groupBoxMaps.Controls.Add(this.listBoxMaps); - this.groupBoxMaps.Controls.Add(this.buttonAddMap); - this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap); - this.groupBoxMaps.Controls.Add(this.textBoxNewMapName); - this.groupBoxMaps.Location = new System.Drawing.Point(13, 28); - this.groupBoxMaps.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.groupBoxMaps.Name = "groupBoxMaps"; - this.groupBoxMaps.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.groupBoxMaps.Size = new System.Drawing.Size(229, 326); - this.groupBoxMaps.TabIndex = 11; - this.groupBoxMaps.TabStop = false; - this.groupBoxMaps.Text = "Карты"; - // - // buttonDeleteMap - // - this.buttonDeleteMap.Location = new System.Drawing.Point(7, 271); - this.buttonDeleteMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.buttonDeleteMap.Name = "buttonDeleteMap"; - this.buttonDeleteMap.Size = new System.Drawing.Size(200, 47); - this.buttonDeleteMap.TabIndex = 5; - this.buttonDeleteMap.Text = "Удалить карту"; - this.buttonDeleteMap.UseVisualStyleBackColor = true; - this.buttonDeleteMap.Click += new System.EventHandler(this.buttonDeleteMap_Click); - // - // listBoxMaps - // - this.listBoxMaps.FormattingEnabled = true; - this.listBoxMaps.ItemHeight = 20; - this.listBoxMaps.Location = new System.Drawing.Point(7, 157); - this.listBoxMaps.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.listBoxMaps.Name = "listBoxMaps"; - this.listBoxMaps.Size = new System.Drawing.Size(199, 104); - this.listBoxMaps.TabIndex = 4; - this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged); - // - // buttonAddMap - // - this.buttonAddMap.Location = new System.Drawing.Point(7, 107); - this.buttonAddMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.buttonAddMap.Name = "buttonAddMap"; - this.buttonAddMap.Size = new System.Drawing.Size(200, 43); - this.buttonAddMap.TabIndex = 3; - this.buttonAddMap.Text = "Добавить карту"; - this.buttonAddMap.UseVisualStyleBackColor = true; - this.buttonAddMap.Click += new System.EventHandler(this.buttonAddMap_Click_1); - // - // 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(7, 68); - this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; - this.comboBoxSelectorMap.Size = new System.Drawing.Size(200, 28); - this.comboBoxSelectorMap.TabIndex = 0; - // - // textBoxNewMapName - // - this.textBoxNewMapName.Location = new System.Drawing.Point(7, 29); - this.textBoxNewMapName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.textBoxNewMapName.Name = "textBoxNewMapName"; - this.textBoxNewMapName.Size = new System.Drawing.Size(200, 27); - this.textBoxNewMapName.TabIndex = 0; - // // groupBoxTools // this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition); diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 05cd7a1..8784862 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -12,26 +12,6 @@ namespace HoistingCrane { public partial class FormMapWithSetHoistingCrane : Form { - /// Словарь для выпадающего списка - /// - private readonly Dictionary _mapsDict = new() - { - { "Простая карта", new SimpleMap() }, - { "Вторая карта", new SecondMap() }, - }; - /// - /// Объект от коллекции карт - /// - /// Логер - /// - private readonly ILogger _logger; - /// - private readonly MapsCollection _mapsCollection; - /// - public FormMapWithSetHoistingCrane(ILogger logger) - { - InitializeComponent(); - } private MapWithSetHoistingCraneGeneric _mapHoistingCraneCollectionGeneric; @@ -51,7 +31,6 @@ namespace HoistingCrane case "Вторая карта": map = new SecondMap(); break; - } if (map != null) { @@ -63,32 +42,6 @@ namespace HoistingCrane _mapHoistingCraneCollectionGeneric = null; } } - /// - /// Добавление карты - /// - /// - /// - private void buttonAddMap_Click_1(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(); - _logger.LogInformation($"Добавлена карта {textBoxNewMapName.Text}"); - } - private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e) - { - pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); - _logger.LogInformation($"Переход на карту {listBoxMaps.SelectedItem?.ToString()}"); - } private void ButtonAddHoistingCrane_Click(object sender, EventArgs e) {