pibd-12 Tangatarov.I.A. LabWork04 Base #17
@ -39,11 +39,8 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
public T? Get(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
if(position >= 0 && position < _maxCount)
|
||||
{
|
||||
return list[position];
|
||||
}
|
||||
return null;
|
||||
if (position >= Count || position < 0) return null;
|
||||
return list[position];
|
||||
}
|
||||
|
||||
|
||||
@ -69,11 +66,8 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
return -1;
|
||||
}
|
||||
list.Insert(position, obj);
|
||||
return position;
|
||||
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
|
@ -69,6 +69,7 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,75 +29,118 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
buttonGoToChek = new Button();
|
||||
panelCompanyTool = new Panel();
|
||||
buttonCreateCompany = new Button();
|
||||
buttonRefresh = new Button();
|
||||
buttonGoToChek = new Button();
|
||||
buttonCreateHoistingCrane = new Button();
|
||||
buttonCreateTrackedVehicle = 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();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMassive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
panelCompanyTool.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||
groupBoxTools.Controls.Add(panelCompanyTool);
|
||||
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.Location = new Point(759, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(210, 509);
|
||||
groupBoxTools.Size = new Size(214, 509);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// buttonGoToChek
|
||||
// panelCompanyTool
|
||||
//
|
||||
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;
|
||||
panelCompanyTool.Anchor = AnchorStyles.None;
|
||||
panelCompanyTool.Controls.Add(buttonRefresh);
|
||||
panelCompanyTool.Controls.Add(buttonGoToChek);
|
||||
panelCompanyTool.Controls.Add(buttonCreateHoistingCrane);
|
||||
panelCompanyTool.Controls.Add(buttonCreateTrackedVehicle);
|
||||
panelCompanyTool.Controls.Add(buttonDeleteCar);
|
||||
panelCompanyTool.Controls.Add(maskedTextBox);
|
||||
panelCompanyTool.Location = new Point(3, 317);
|
||||
panelCompanyTool.Name = "panelCompanyTool";
|
||||
panelCompanyTool.Size = new Size(208, 238);
|
||||
panelCompanyTool.TabIndex = 8;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(12, 288);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(196, 23);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(12, 470);
|
||||
buttonRefresh.Location = new Point(9, 159);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(192, 27);
|
||||
buttonRefresh.Size = new Size(196, 27);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonGoToChek
|
||||
//
|
||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToChek.Location = new Point(9, 119);
|
||||
buttonGoToChek.Name = "buttonGoToChek";
|
||||
buttonGoToChek.Size = new Size(196, 24);
|
||||
buttonGoToChek.TabIndex = 6;
|
||||
buttonGoToChek.Text = "Передать на тесты";
|
||||
buttonGoToChek.UseVisualStyleBackColor = true;
|
||||
buttonGoToChek.Click += buttonGoToChek_Click;
|
||||
//
|
||||
// buttonCreateHoistingCrane
|
||||
//
|
||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCreateHoistingCrane.Location = new Point(9, 3);
|
||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
||||
buttonCreateHoistingCrane.Size = new Size(196, 22);
|
||||
buttonCreateHoistingCrane.TabIndex = 0;
|
||||
buttonCreateHoistingCrane.Text = "Добавить подъемный кран";
|
||||
buttonCreateHoistingCrane.UseVisualStyleBackColor = true;
|
||||
buttonCreateHoistingCrane.Click += buttonCreateHoistingCrane_Click;
|
||||
//
|
||||
// buttonCreateTrackedVehicle
|
||||
//
|
||||
buttonCreateTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonCreateTrackedVehicle.Location = new Point(9, 31);
|
||||
buttonCreateTrackedVehicle.Name = "buttonCreateTrackedVehicle";
|
||||
buttonCreateTrackedVehicle.Size = new Size(196, 24);
|
||||
buttonCreateTrackedVehicle.TabIndex = 1;
|
||||
buttonCreateTrackedVehicle.Text = "Добавить гусеничную машину";
|
||||
buttonCreateTrackedVehicle.UseVisualStyleBackColor = true;
|
||||
buttonCreateTrackedVehicle.Click += buttonCreateTrackedVehicle_Click;
|
||||
//
|
||||
// buttonDeleteCar
|
||||
//
|
||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonDeleteCar.Location = new Point(12, 411);
|
||||
buttonDeleteCar.Location = new Point(9, 90);
|
||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
||||
buttonDeleteCar.Size = new Size(192, 23);
|
||||
buttonDeleteCar.Size = new Size(196, 23);
|
||||
buttonDeleteCar.TabIndex = 4;
|
||||
buttonDeleteCar.Text = "Удалить автомобиль";
|
||||
buttonDeleteCar.UseVisualStyleBackColor = true;
|
||||
@ -106,55 +149,12 @@
|
||||
// maskedTextBox
|
||||
//
|
||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
maskedTextBox.Location = new Point(12, 382);
|
||||
maskedTextBox.Location = new Point(9, 61);
|
||||
maskedTextBox.Mask = "00";
|
||||
maskedTextBox.Name = "maskedTextBox";
|
||||
maskedTextBox.Size = new Size(192, 23);
|
||||
maskedTextBox.Size = new Size(196, 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;
|
||||
//
|
||||
// panelStorage
|
||||
//
|
||||
panelStorage.Controls.Add(buttonDeleteCollection);
|
||||
@ -167,35 +167,37 @@
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 19);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(204, 229);
|
||||
panelStorage.Size = new Size(208, 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 +210,53 @@
|
||||
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
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
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;
|
||||
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, 259);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(196, 23);
|
||||
comboBoxSelectorCompany.TabIndex = 2;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(759, 509);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormCarCollection
|
||||
//
|
||||
@ -257,10 +268,11 @@
|
||||
Name = "FormCarCollection";
|
||||
Text = "FormCarCollections";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
groupBoxTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
panelCompanyTool.ResumeLayout(false);
|
||||
panelCompanyTool.PerformLayout();
|
||||
panelStorage.ResumeLayout(false);
|
||||
panelStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -284,5 +296,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,15 +64,10 @@ namespace HoistingCrane
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningHoistingCrane));
|
||||
|
||||
|
||||
private void buttonCreateTrackedVehicle_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrackedVehicle));
|
||||
|
||||
|
||||
private void buttonDeleteCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@ -104,13 +90,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 +112,6 @@ namespace HoistingCrane
|
||||
SetCar = car
|
||||
};
|
||||
form.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -146,10 +129,9 @@ namespace HoistingCrane
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCollectionAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) ||(!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
@ -168,25 +150,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,9 +181,9 @@ namespace HoistingCrane
|
||||
_company = new Garage(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
panelStorage.Enabled = true;
|
||||
panelCompanyTool.Enabled = true;
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user