Третья лабораторная работа
This commit is contained in:
parent
00ab8a92f2
commit
7e5430cf3d
@ -47,76 +47,6 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||||
this.SuspendLayout();
|
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
|
// groupBoxTools
|
||||||
//
|
//
|
||||||
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
||||||
|
@ -12,26 +12,6 @@ namespace HoistingCrane
|
|||||||
{
|
{
|
||||||
public partial class FormMapWithSetHoistingCrane : Form
|
public partial class FormMapWithSetHoistingCrane : Form
|
||||||
{
|
{
|
||||||
/// Словарь для выпадающего списка
|
|
||||||
/// </summary>
|
|
||||||
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
|
|
||||||
{
|
|
||||||
{ "Простая карта", new SimpleMap() },
|
|
||||||
{ "Вторая карта", new SecondMap() },
|
|
||||||
};
|
|
||||||
/// <summary>
|
|
||||||
/// Объект от коллекции карт
|
|
||||||
/// </summary>
|
|
||||||
/// Логер
|
|
||||||
/// </summary>
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
/// <summary>
|
|
||||||
private readonly MapsCollection _mapsCollection;
|
|
||||||
/// <summary>
|
|
||||||
public FormMapWithSetHoistingCrane(ILogger<FormMapWithSetHoistingCrane> logger)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
|
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
|
||||||
|
|
||||||
@ -51,7 +31,6 @@ namespace HoistingCrane
|
|||||||
case "Вторая карта":
|
case "Вторая карта":
|
||||||
map = new SecondMap();
|
map = new SecondMap();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (map != null)
|
if (map != null)
|
||||||
{
|
{
|
||||||
@ -63,32 +42,6 @@ namespace HoistingCrane
|
|||||||
_mapHoistingCraneCollectionGeneric = null;
|
_mapHoistingCraneCollectionGeneric = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Добавление карты
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
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)
|
private void ButtonAddHoistingCrane_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user