Compare commits
8 Commits
52b3bc2a87
...
ccc5ae5227
Author | SHA1 | Date | |
---|---|---|---|
|
ccc5ae5227 | ||
|
242fad7ac8 | ||
|
68f321a652 | ||
1cd23e10d7 | |||
ea6a49ba00 | |||
|
d1ad010777 | ||
|
a50b38a592 | ||
|
d4ccb9c74a |
@ -31,7 +31,7 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
{
|
||||
get
|
||||
{
|
||||
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth);
|
||||
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth)-3;
|
||||
}
|
||||
}
|
||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)
|
||||
|
@ -39,12 +39,9 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
public T? Get(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
if(position >= 0 && position < _maxCount)
|
||||
{
|
||||
if (position >= Count || position < 0) return null;
|
||||
return list[position];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int Insert(T obj)
|
||||
@ -70,10 +67,7 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
}
|
||||
list.Insert(position, obj);
|
||||
return position;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
|
@ -17,11 +17,18 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
Array.Resize(ref arr, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr = new T?[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position >= 0 && position < arr.Length)
|
||||
@ -32,16 +39,9 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (arr[i] == null)
|
||||
{
|
||||
return Insert(obj, 0);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
|
@ -25,8 +25,6 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
/// <param name="collectionType">тип коллекции</param>
|
||||
public void AddCollection(string name, CollectionType collectionType)
|
||||
{
|
||||
// TODO проверка, что name не пустой и нет в словаре записи с таким ключом
|
||||
// TODO Прописать логику для добавления
|
||||
if (!string.IsNullOrEmpty(name) && !Keys.Contains(name))
|
||||
{
|
||||
if(collectionType == CollectionType.Massive)
|
||||
@ -45,13 +43,9 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
/// <param name="name">Название коллекции</param>
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
// TODO Прописать логику для удаления коллекции
|
||||
|
||||
if(Keys.Contains(name))
|
||||
{
|
||||
if (dict.ContainsKey(name))
|
||||
dict.Remove(name);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Доступ к коллекции
|
||||
/// </summary>
|
||||
@ -61,14 +55,9 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO Продумать логику получения объекта
|
||||
if (dict.TryGetValue(name, out ICollectionGenericObjects<T>? result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
if (name == null || !dict.ContainsKey(name)) { return null; }
|
||||
return dict[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ public class EntityHoistingCrane : EntityTrackedVehicle
|
||||
/// <summary>
|
||||
/// Дополнительный цвет объекта
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; protected set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Наличие противовеса
|
||||
/// </summary>
|
||||
public bool Counterweight { get; protected set; }
|
||||
public bool Counterweight { get; private set; }
|
||||
/// <summary>
|
||||
/// Наличие платформы
|
||||
/// </summary>
|
||||
public bool Platform { get; protected set; }
|
||||
public bool Platform { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Метод задачи параметров
|
||||
@ -38,4 +38,8 @@ public class EntityHoistingCrane : EntityTrackedVehicle
|
||||
|
||||
}
|
||||
|
||||
public void SetAdditionalColor(Color newColor)
|
||||
{
|
||||
AdditionalColor = newColor;
|
||||
}
|
||||
}
|
@ -9,19 +9,19 @@
|
||||
/// <summary>
|
||||
/// Скорость, которой обладает объект
|
||||
/// </summary>
|
||||
public int Speed { get; protected set; }
|
||||
public int Speed { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Вес, которым обладает объект
|
||||
/// </summary>
|
||||
public double Weight { get; protected set; }
|
||||
public double Weight { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет объекта
|
||||
/// </summary>
|
||||
public Color BodyColor { get; protected set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -44,6 +44,10 @@
|
||||
this.BodyColor = BodyColor;
|
||||
}
|
||||
|
||||
public void SetBodyColor(Color newBodyColor)
|
||||
{
|
||||
BodyColor = newBodyColor;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -29,39 +29,35 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
buttonCreateCompany = new Button();
|
||||
panelStorage = new Panel();
|
||||
buttonDeleteCollection = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMassive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
buttonGoToChek = new Button();
|
||||
buttonRefresh = new Button();
|
||||
buttonDeleteCar = new Button();
|
||||
maskedTextBox = new MaskedTextBox();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
buttonCreateTrackedVehicle = new Button();
|
||||
buttonCreateHoistingCrane = new Button();
|
||||
pictureBox = new PictureBox();
|
||||
panelStorage = new Panel();
|
||||
labelCollectionName = new Label();
|
||||
textBoxCollectionName = new TextBox();
|
||||
radioButtonMassive = new RadioButton();
|
||||
radioButtonList = new RadioButton();
|
||||
buttonCollectionAdd = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonDeleteCollection = new Button();
|
||||
buttonCreateCompany = new Button();
|
||||
panelCompanyTool = new Panel();
|
||||
groupBoxTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
panelCompanyTool.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(panelCompanyTool);
|
||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Controls.Add(buttonGoToChek);
|
||||
groupBoxTools.Controls.Add(buttonRefresh);
|
||||
groupBoxTools.Controls.Add(buttonDeleteCar);
|
||||
groupBoxTools.Controls.Add(maskedTextBox);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Controls.Add(buttonCreateTrackedVehicle);
|
||||
groupBoxTools.Controls.Add(buttonCreateHoistingCrane);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(763, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
@ -70,90 +66,15 @@
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// buttonGoToChek
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToChek.Location = new Point(12, 440);
|
||||
buttonGoToChek.Name = "buttonGoToChek";
|
||||
buttonGoToChek.Size = new Size(192, 24);
|
||||
buttonGoToChek.TabIndex = 6;
|
||||
buttonGoToChek.Text = "Передать на тесты";
|
||||
buttonGoToChek.UseVisualStyleBackColor = true;
|
||||
buttonGoToChek.Click += buttonGoToChek_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(12, 470);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(192, 27);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonDeleteCar
|
||||
//
|
||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonDeleteCar.Location = new Point(12, 411);
|
||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
||||
buttonDeleteCar.Size = new Size(192, 23);
|
||||
buttonDeleteCar.TabIndex = 4;
|
||||
buttonDeleteCar.Text = "Удалить автомобиль";
|
||||
buttonDeleteCar.UseVisualStyleBackColor = true;
|
||||
buttonDeleteCar.Click += buttonDeleteCar_Click;
|
||||
//
|
||||
// maskedTextBox
|
||||
//
|
||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
maskedTextBox.Location = new Point(12, 382);
|
||||
maskedTextBox.Mask = "00";
|
||||
maskedTextBox.Name = "maskedTextBox";
|
||||
maskedTextBox.Size = new Size(192, 23);
|
||||
maskedTextBox.TabIndex = 3;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(12, 266);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(192, 23);
|
||||
comboBoxSelectorCompany.TabIndex = 2;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
|
||||
//
|
||||
// buttonCreateTrackedVehicle
|
||||
//
|
||||
buttonCreateTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCreateTrackedVehicle.Location = new Point(12, 352);
|
||||
buttonCreateTrackedVehicle.Name = "buttonCreateTrackedVehicle";
|
||||
buttonCreateTrackedVehicle.Size = new Size(192, 24);
|
||||
buttonCreateTrackedVehicle.TabIndex = 1;
|
||||
buttonCreateTrackedVehicle.Text = "Добавить гусеничную машину";
|
||||
buttonCreateTrackedVehicle.UseVisualStyleBackColor = true;
|
||||
buttonCreateTrackedVehicle.Click += buttonCreateTrackedVehicle_Click;
|
||||
//
|
||||
// buttonCreateHoistingCrane
|
||||
//
|
||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCreateHoistingCrane.Location = new Point(12, 324);
|
||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
||||
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
||||
buttonCreateHoistingCrane.TabIndex = 0;
|
||||
buttonCreateHoistingCrane.Text = "Добавить подъемный кран";
|
||||
buttonCreateHoistingCrane.UseVisualStyleBackColor = true;
|
||||
buttonCreateHoistingCrane.Click += buttonCreateHoistingCrane_Click;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(763, 509);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
buttonCreateCompany.Location = new Point(12, 295);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(192, 23);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
||||
//
|
||||
// panelStorage
|
||||
//
|
||||
@ -170,32 +91,34 @@
|
||||
panelStorage.Size = new Size(204, 229);
|
||||
panelStorage.TabIndex = 7;
|
||||
//
|
||||
// labelCollectionName
|
||||
// buttonDeleteCollection
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(35, 0);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(135, 15);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции:";
|
||||
buttonDeleteCollection.Location = new Point(9, 199);
|
||||
buttonDeleteCollection.Name = "buttonDeleteCollection";
|
||||
buttonDeleteCollection.Size = new Size(192, 27);
|
||||
buttonDeleteCollection.TabIndex = 6;
|
||||
buttonDeleteCollection.Text = "Удалить коллекцию";
|
||||
buttonDeleteCollection.UseVisualStyleBackColor = true;
|
||||
buttonDeleteCollection.Click += buttonDeleteCollection_Click;
|
||||
//
|
||||
// textBoxCollectionName
|
||||
// listBoxCollection
|
||||
//
|
||||
textBoxCollectionName.Location = new Point(9, 18);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(192, 23);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 15;
|
||||
listBoxCollection.Location = new Point(9, 118);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(192, 79);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// radioButtonMassive
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(18, 56);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(69, 19);
|
||||
radioButtonMassive.TabIndex = 2;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Location = new Point(9, 81);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(192, 23);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Click += buttonCollectionAdd_Click;
|
||||
//
|
||||
// radioButtonList
|
||||
//
|
||||
@ -208,44 +131,119 @@
|
||||
radioButtonList.Text = "Список";
|
||||
radioButtonList.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
// radioButtonMassive
|
||||
//
|
||||
buttonCollectionAdd.Location = new Point(9, 81);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(192, 23);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Click += buttonCollectionAdd_Click;
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(18, 56);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(69, 19);
|
||||
radioButtonMassive.TabIndex = 2;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// listBoxCollection
|
||||
// textBoxCollectionName
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 15;
|
||||
listBoxCollection.Location = new Point(9, 118);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(192, 79);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
textBoxCollectionName.Location = new Point(9, 18);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(192, 23);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// buttonDeleteCollection
|
||||
// labelCollectionName
|
||||
//
|
||||
buttonDeleteCollection.Location = new Point(9, 199);
|
||||
buttonDeleteCollection.Name = "buttonDeleteCollection";
|
||||
buttonDeleteCollection.Size = new Size(192, 27);
|
||||
buttonDeleteCollection.TabIndex = 6;
|
||||
buttonDeleteCollection.Text = "Удалить коллекцию";
|
||||
buttonDeleteCollection.UseVisualStyleBackColor = true;
|
||||
buttonDeleteCollection.Click += buttonDeleteCollection_Click;
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(35, 0);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(135, 15);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции:";
|
||||
//
|
||||
// buttonCreateCompany
|
||||
// buttonGoToChek
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(12, 295);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(192, 23);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToChek.Location = new Point(9, 99);
|
||||
buttonGoToChek.Name = "buttonGoToChek";
|
||||
buttonGoToChek.Size = new Size(192, 24);
|
||||
buttonGoToChek.TabIndex = 6;
|
||||
buttonGoToChek.Text = "Передать на тесты";
|
||||
buttonGoToChek.UseVisualStyleBackColor = true;
|
||||
buttonGoToChek.Click += buttonGoToChek_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(9, 129);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(192, 27);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonDeleteCar
|
||||
//
|
||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonDeleteCar.Location = new Point(9, 70);
|
||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
||||
buttonDeleteCar.Size = new Size(192, 23);
|
||||
buttonDeleteCar.TabIndex = 4;
|
||||
buttonDeleteCar.Text = "Удалить автомобиль";
|
||||
buttonDeleteCar.UseVisualStyleBackColor = true;
|
||||
buttonDeleteCar.Click += buttonDeleteCar_Click;
|
||||
//
|
||||
// maskedTextBox
|
||||
//
|
||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
maskedTextBox.Location = new Point(9, 41);
|
||||
maskedTextBox.Mask = "00";
|
||||
maskedTextBox.Name = "maskedTextBox";
|
||||
maskedTextBox.Size = new Size(192, 23);
|
||||
maskedTextBox.TabIndex = 3;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(12, 266);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(192, 23);
|
||||
comboBoxSelectorCompany.TabIndex = 2;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// buttonCreateHoistingCrane
|
||||
//
|
||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCreateHoistingCrane.Location = new Point(9, 13);
|
||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
||||
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
||||
buttonCreateHoistingCrane.TabIndex = 0;
|
||||
buttonCreateHoistingCrane.Text = "Добавить транспорт";
|
||||
buttonCreateHoistingCrane.UseVisualStyleBackColor = true;
|
||||
buttonCreateHoistingCrane.Click += buttonCreateHoistingCrane_Click;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(763, 509);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// panelCompanyTool
|
||||
//
|
||||
panelCompanyTool.Anchor = AnchorStyles.None;
|
||||
panelCompanyTool.Controls.Add(buttonCreateHoistingCrane);
|
||||
panelCompanyTool.Controls.Add(maskedTextBox);
|
||||
panelCompanyTool.Controls.Add(buttonRefresh);
|
||||
panelCompanyTool.Controls.Add(buttonGoToChek);
|
||||
panelCompanyTool.Controls.Add(buttonDeleteCar);
|
||||
panelCompanyTool.Location = new Point(6, 324);
|
||||
panelCompanyTool.Name = "panelCompanyTool";
|
||||
panelCompanyTool.Size = new Size(204, 185);
|
||||
panelCompanyTool.TabIndex = 8;
|
||||
//
|
||||
// FormCarCollection
|
||||
//
|
||||
@ -257,10 +255,11 @@
|
||||
Name = "FormCarCollection";
|
||||
Text = "FormCarCollections";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
groupBoxTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
panelStorage.ResumeLayout(false);
|
||||
panelStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
panelCompanyTool.ResumeLayout(false);
|
||||
panelCompanyTool.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -268,7 +267,6 @@
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private Button buttonCreateHoistingCrane;
|
||||
private Button buttonCreateTrackedVehicle;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonDeleteCar;
|
||||
@ -284,5 +282,6 @@
|
||||
private Button buttonDeleteCollection;
|
||||
private ListBox listBoxCollection;
|
||||
private Button buttonCollectionAdd;
|
||||
private Panel panelCompanyTool;
|
||||
}
|
||||
}
|
@ -21,19 +21,12 @@ namespace HoistingCrane
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageCollection = new();
|
||||
panelCompanyTool.Enabled = false;
|
||||
}
|
||||
|
||||
private void comboBoxSelectorCompany_SelectedIndexChanged_1(object sender, EventArgs e)
|
||||
private void comboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new Garage(pictureBox.Width, pictureBox.Height, new MassivGenericObjects<DrawningTrackedVehicle>());
|
||||
break;
|
||||
panelCompanyTool.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
DrawningTrackedVehicle drawning;
|
||||
@ -41,7 +34,6 @@ namespace HoistingCrane
|
||||
Random rand = new();
|
||||
switch (type)
|
||||
{
|
||||
|
||||
case nameof(DrawningHoistingCrane):
|
||||
drawning = new DrawningHoistingCrane(rand.Next(100, 300), rand.Next(1000, 3000), GetColor(rand), GetColor(rand), true, true);
|
||||
break;
|
||||
@ -62,7 +54,6 @@ namespace HoistingCrane
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
private static Color GetColor(Random random)
|
||||
{
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
@ -73,14 +64,29 @@ namespace HoistingCrane
|
||||
}
|
||||
return color;
|
||||
}
|
||||
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormCarConfig form = new();
|
||||
form.Show();
|
||||
form.AddEvent(SetCar);
|
||||
}
|
||||
private void SetCar(DrawningTrackedVehicle drawningTrackedVehicle)
|
||||
{
|
||||
if (_company == null || drawningTrackedVehicle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningHoistingCrane));
|
||||
|
||||
|
||||
private void buttonCreateTrackedVehicle_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrackedVehicle));
|
||||
|
||||
if (_company + drawningTrackedVehicle != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDeleteCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -104,13 +110,11 @@ namespace HoistingCrane
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null) return;
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
private void buttonGoToChek_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null) return;
|
||||
@ -128,7 +132,6 @@ namespace HoistingCrane
|
||||
SetCar = car
|
||||
};
|
||||
form.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -146,7 +149,6 @@ namespace HoistingCrane
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCollectionAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||
@ -168,25 +170,18 @@ namespace HoistingCrane
|
||||
collectionType);
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
|
||||
private void buttonDeleteCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
// TODO прописать логику удаления элемента из коллекции
|
||||
// нужно убедиться, что есть выбранная коллекция
|
||||
// спросить у пользователя через MessageBox, что он подтверждает, что хочет удалить запись
|
||||
// удалить и обновить ListBox
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return;
|
||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||
RerfreshListBoxItems();
|
||||
|
||||
}
|
||||
|
||||
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
@ -206,7 +201,7 @@ namespace HoistingCrane
|
||||
_company = new Garage(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
panelStorage.Enabled = true;
|
||||
panelCompanyTool.Enabled = true;
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
}
|
||||
|
358
HoistingCrane/HoistingCrane/FormCarConfig.Designer.cs
generated
Normal file
358
HoistingCrane/HoistingCrane/FormCarConfig.Designer.cs
generated
Normal file
@ -0,0 +1,358 @@
|
||||
namespace HoistingCrane
|
||||
{
|
||||
partial class FormCarConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxConfig = new GroupBox();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelColorPurple = new Panel();
|
||||
panelColorYellow = new Panel();
|
||||
panelColorGray = new Panel();
|
||||
panelColorGreen = new Panel();
|
||||
panelColorWhite = new Panel();
|
||||
panelColorBlue = new Panel();
|
||||
panelColorBlack = new Panel();
|
||||
panelColorRed = new Panel();
|
||||
checkBoxPlatform = new CheckBox();
|
||||
checkBoxCounterweight = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
labelSpeed = new Label();
|
||||
labelModifiedObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
panel = new Panel();
|
||||
labelAdditionalColor = new Label();
|
||||
labelBodyColor = new Label();
|
||||
pictureBoxObject = new PictureBox();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
groupBoxConfig.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxConfig
|
||||
//
|
||||
groupBoxConfig.Controls.Add(groupBoxColors);
|
||||
groupBoxConfig.Controls.Add(checkBoxPlatform);
|
||||
groupBoxConfig.Controls.Add(checkBoxCounterweight);
|
||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxConfig.Controls.Add(labelWeight);
|
||||
groupBoxConfig.Controls.Add(labelSpeed);
|
||||
groupBoxConfig.Controls.Add(labelModifiedObject);
|
||||
groupBoxConfig.Controls.Add(labelSimpleObject);
|
||||
groupBoxConfig.Dock = DockStyle.Left;
|
||||
groupBoxConfig.Location = new Point(0, 0);
|
||||
groupBoxConfig.Name = "groupBoxConfig";
|
||||
groupBoxConfig.Size = new Size(514, 207);
|
||||
groupBoxConfig.TabIndex = 0;
|
||||
groupBoxConfig.TabStop = false;
|
||||
groupBoxConfig.Text = "Параметры";
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelColorPurple);
|
||||
groupBoxColors.Controls.Add(panelColorYellow);
|
||||
groupBoxColors.Controls.Add(panelColorGray);
|
||||
groupBoxColors.Controls.Add(panelColorGreen);
|
||||
groupBoxColors.Controls.Add(panelColorWhite);
|
||||
groupBoxColors.Controls.Add(panelColorBlue);
|
||||
groupBoxColors.Controls.Add(panelColorBlack);
|
||||
groupBoxColors.Controls.Add(panelColorRed);
|
||||
groupBoxColors.Location = new Point(283, 26);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Size = new Size(210, 114);
|
||||
groupBoxColors.TabIndex = 8;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвет";
|
||||
//
|
||||
// panelColorPurple
|
||||
//
|
||||
panelColorPurple.BackColor = Color.Purple;
|
||||
panelColorPurple.Location = new Point(168, 68);
|
||||
panelColorPurple.Name = "panelColorPurple";
|
||||
panelColorPurple.Size = new Size(36, 35);
|
||||
panelColorPurple.TabIndex = 7;
|
||||
//
|
||||
// panelColorYellow
|
||||
//
|
||||
panelColorYellow.BackColor = Color.Yellow;
|
||||
panelColorYellow.Location = new Point(168, 22);
|
||||
panelColorYellow.Name = "panelColorYellow";
|
||||
panelColorYellow.Size = new Size(36, 35);
|
||||
panelColorYellow.TabIndex = 3;
|
||||
//
|
||||
// panelColorGray
|
||||
//
|
||||
panelColorGray.BackColor = Color.Gray;
|
||||
panelColorGray.Location = new Point(114, 68);
|
||||
panelColorGray.Name = "panelColorGray";
|
||||
panelColorGray.Size = new Size(36, 35);
|
||||
panelColorGray.TabIndex = 6;
|
||||
//
|
||||
// panelColorGreen
|
||||
//
|
||||
panelColorGreen.BackColor = Color.Green;
|
||||
panelColorGreen.Location = new Point(114, 22);
|
||||
panelColorGreen.Name = "panelColorGreen";
|
||||
panelColorGreen.Size = new Size(36, 35);
|
||||
panelColorGreen.TabIndex = 2;
|
||||
//
|
||||
// panelColorWhite
|
||||
//
|
||||
panelColorWhite.BackColor = Color.White;
|
||||
panelColorWhite.Location = new Point(61, 68);
|
||||
panelColorWhite.Name = "panelColorWhite";
|
||||
panelColorWhite.Size = new Size(36, 35);
|
||||
panelColorWhite.TabIndex = 5;
|
||||
//
|
||||
// panelColorBlue
|
||||
//
|
||||
panelColorBlue.BackColor = Color.Blue;
|
||||
panelColorBlue.Location = new Point(61, 22);
|
||||
panelColorBlue.Name = "panelColorBlue";
|
||||
panelColorBlue.Size = new Size(36, 35);
|
||||
panelColorBlue.TabIndex = 1;
|
||||
//
|
||||
// panelColorBlack
|
||||
//
|
||||
panelColorBlack.BackColor = Color.Black;
|
||||
panelColorBlack.Location = new Point(6, 68);
|
||||
panelColorBlack.Name = "panelColorBlack";
|
||||
panelColorBlack.Size = new Size(36, 35);
|
||||
panelColorBlack.TabIndex = 4;
|
||||
//
|
||||
// panelColorRed
|
||||
//
|
||||
panelColorRed.BackColor = Color.Red;
|
||||
panelColorRed.Location = new Point(6, 22);
|
||||
panelColorRed.Name = "panelColorRed";
|
||||
panelColorRed.Size = new Size(36, 35);
|
||||
panelColorRed.TabIndex = 0;
|
||||
panelColorRed.MouseDown += panel_MouseDown;
|
||||
//
|
||||
// checkBoxPlatform
|
||||
//
|
||||
checkBoxPlatform.AutoSize = true;
|
||||
checkBoxPlatform.Location = new Point(6, 135);
|
||||
checkBoxPlatform.Name = "checkBoxPlatform";
|
||||
checkBoxPlatform.Size = new Size(144, 19);
|
||||
checkBoxPlatform.TabIndex = 7;
|
||||
checkBoxPlatform.Text = "Наличие платформы";
|
||||
checkBoxPlatform.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxCounterweight
|
||||
//
|
||||
checkBoxCounterweight.AutoSize = true;
|
||||
checkBoxCounterweight.Location = new Point(6, 110);
|
||||
checkBoxCounterweight.Name = "checkBoxCounterweight";
|
||||
checkBoxCounterweight.Size = new Size(148, 19);
|
||||
checkBoxCounterweight.TabIndex = 6;
|
||||
checkBoxCounterweight.Text = "Наличие противовеса";
|
||||
checkBoxCounterweight.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(72, 66);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(120, 23);
|
||||
numericUpDownWeight.TabIndex = 5;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(72, 31);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(120, 23);
|
||||
numericUpDownSpeed.TabIndex = 4;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(6, 68);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(26, 15);
|
||||
labelWeight.TabIndex = 3;
|
||||
labelWeight.Text = "Вес";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(6, 33);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(59, 15);
|
||||
labelSpeed.TabIndex = 2;
|
||||
labelSpeed.Text = "Скорость";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(139, 173);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(114, 31);
|
||||
labelModifiedObject.TabIndex = 1;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(6, 172);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(114, 31);
|
||||
labelSimpleObject.TabIndex = 0;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.AllowDrop = true;
|
||||
panel.Controls.Add(labelAdditionalColor);
|
||||
panel.Controls.Add(labelBodyColor);
|
||||
panel.Controls.Add(pictureBoxObject);
|
||||
panel.Location = new Point(545, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(216, 167);
|
||||
panel.TabIndex = 1;
|
||||
panel.DragDrop += panel_DragDrop;
|
||||
panel.DragEnter += panel_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(116, 9);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(97, 31);
|
||||
labelAdditionalColor.TabIndex = 10;
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
||||
//
|
||||
// labelBodyColor
|
||||
//
|
||||
labelBodyColor.AllowDrop = true;
|
||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBodyColor.Location = new Point(3, 9);
|
||||
labelBodyColor.Name = "labelBodyColor";
|
||||
labelBodyColor.Size = new Size(97, 31);
|
||||
labelBodyColor.TabIndex = 9;
|
||||
labelBodyColor.Text = "Цвет";
|
||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelBodyColor.DragDrop += labelBodyColor_DragDrop;
|
||||
labelBodyColor.DragEnter += labelBodyColor_DragEnter;
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(3, 43);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(210, 121);
|
||||
pictureBoxObject.TabIndex = 0;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(545, 172);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(91, 34);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(670, 173);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(91, 35);
|
||||
buttonCancel.TabIndex = 2;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormCarConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(777, 207);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(panel);
|
||||
Controls.Add(groupBoxConfig);
|
||||
Name = "FormCarConfig";
|
||||
Text = "FormCarConfig";
|
||||
groupBoxConfig.ResumeLayout(false);
|
||||
groupBoxConfig.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxConfig;
|
||||
private Label labelModifiedObject;
|
||||
private Label labelSimpleObject;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelWeight;
|
||||
private Label labelSpeed;
|
||||
private CheckBox checkBoxPlatform;
|
||||
private CheckBox checkBoxCounterweight;
|
||||
private GroupBox groupBoxColors;
|
||||
private Panel panelColorPurple;
|
||||
private Panel panelColorYellow;
|
||||
private Panel panelColorGray;
|
||||
private Panel panelColorGreen;
|
||||
private Panel panelColorWhite;
|
||||
private Panel panelColorBlue;
|
||||
private Panel panelColorBlack;
|
||||
private Panel panelColorRed;
|
||||
private Panel panel;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Label labelAdditionalColor;
|
||||
private Label labelBodyColor;
|
||||
}
|
||||
}
|
183
HoistingCrane/HoistingCrane/FormCarConfig.cs
Normal file
183
HoistingCrane/HoistingCrane/FormCarConfig.cs
Normal file
@ -0,0 +1,183 @@
|
||||
using HoistingCrane.CollectionGenericObjects;
|
||||
using HoistingCrane.Drawning;
|
||||
using HoistingCrane.Entities;
|
||||
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;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
||||
|
||||
namespace HoistingCrane
|
||||
{
|
||||
public partial class FormCarConfig : Form
|
||||
{
|
||||
private DrawningTrackedVehicle? drawningTrackedVehicle;
|
||||
private event Action<DrawningTrackedVehicle>? _carDelegate;
|
||||
public FormCarConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelColorRed.MouseDown += panel_MouseDown;
|
||||
panelColorBlue.MouseDown += panel_MouseDown;
|
||||
panelColorGreen.MouseDown += panel_MouseDown;
|
||||
panelColorYellow.MouseDown += panel_MouseDown;
|
||||
panelColorBlack.MouseDown += panel_MouseDown;
|
||||
panelColorWhite.MouseDown += panel_MouseDown;
|
||||
panelColorGray.MouseDown += panel_MouseDown;
|
||||
panelColorPurple.MouseDown += panel_MouseDown;
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// Привязка метода к событию
|
||||
/// </summary>
|
||||
/// <param name="carDelegate"></param>
|
||||
public void AddEvent(Action<DrawningTrackedVehicle> carDelegate)
|
||||
{
|
||||
if (carDelegate == null)
|
||||
{
|
||||
_carDelegate = carDelegate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_carDelegate += carDelegate;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовка объекта
|
||||
/// </summary>
|
||||
private void DrawObject()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
drawningTrackedVehicle?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
drawningTrackedVehicle?.SetPosition(25, 25);
|
||||
drawningTrackedVehicle?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Label
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
/// <summary>
|
||||
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void panel_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
/// <summary>
|
||||
/// Действия при приеме перетаскиваемой информации
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void panel_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
drawningTrackedVehicle = new DrawningTrackedVehicle((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
drawningTrackedVehicle = new DrawningHoistingCrane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCounterweight.Checked,
|
||||
checkBoxPlatform.Checked);
|
||||
break;
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Panel
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void panel_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.White, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
/// <summary>
|
||||
/// Передача объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (drawningTrackedVehicle != null)
|
||||
{
|
||||
_carDelegate?.Invoke(drawningTrackedVehicle);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка основным цветом
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (drawningTrackedVehicle == null)
|
||||
return;
|
||||
drawningTrackedVehicle.EntityTrackedVehicle?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawObject();
|
||||
}
|
||||
/// <summary>
|
||||
/// Передача основного цвета
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка основным цветом
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (drawningTrackedVehicle?.EntityTrackedVehicle is EntityHoistingCrane entityHoistingCrane)
|
||||
{
|
||||
entityHoistingCrane.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
/// <summary>
|
||||
/// Передача дополнительного цвета
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (drawningTrackedVehicle is DrawningHoistingCrane)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
120
HoistingCrane/HoistingCrane/FormCarConfig.resx
Normal file
120
HoistingCrane/HoistingCrane/FormCarConfig.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user