устранение конфликтов
This commit is contained in:
parent
aa09b6df1f
commit
ec4a056798
141
HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs
Normal file
141
HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HoistingCrane
|
||||
{
|
||||
public partial class FormMapWithSetHoistingCrane : Form
|
||||
{
|
||||
|
||||
private MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap> _mapHoistingCraneCollectionGeneric;
|
||||
|
||||
public FormMapWithSetHoistingCrane()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
AbstractMap map = null;
|
||||
switch (comboBoxSelectorMap.Text)
|
||||
{
|
||||
case "Первая карта":
|
||||
map = new SimpleMap();
|
||||
break;
|
||||
case "Вторая карта":
|
||||
map = new SecondMap();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
if (map != null)
|
||||
{
|
||||
_mapHoistingCraneCollectionGeneric = new MapWithSetHoistingCraneGeneric<DrawingObjectHoistingCrane, AbstractMap>(
|
||||
pictureBox.Width, pictureBox.Height, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
_mapHoistingCraneCollectionGeneric = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAddHoistingCrane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mapHoistingCraneCollectionGeneric == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormHoistingCrane form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane);
|
||||
if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_mapHoistingCraneCollectionGeneric - pos == null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mapHoistingCraneCollectionGeneric == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet();
|
||||
}
|
||||
|
||||
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mapHoistingCraneCollectionGeneric == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowOnMap();
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mapHoistingCraneCollectionGeneric == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
Direction enums = Direction.None;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
enums = Direction.Up;
|
||||
break;
|
||||
case "buttonDown":
|
||||
enums = Direction.Down;
|
||||
break;
|
||||
case "buttonLeft":
|
||||
enums = Direction.Left;
|
||||
break;
|
||||
case "buttonRight":
|
||||
enums = Direction.Right;
|
||||
break;
|
||||
}
|
||||
pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums);
|
||||
}
|
||||
|
||||
private void pictureBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user