From c603a8b8b07f7225528beaabbcf8506c17b55594 Mon Sep 17 00:00:00 2001
From: Roman-Klemendeev <147613551+Roman-Klemendeev@users.noreply.github.com>
Date: Sun, 26 May 2024 22:06:31 +0400
Subject: [PATCH] fix
---
.../FormTankerCollection.Designer.cs | 174 ++++++++++++++----
.../FormTankerCollection.cs | 39 ++--
.../FormTankerCollection.resx | 50 ++---
3 files changed, 171 insertions(+), 92 deletions(-)
diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs
index 2857956..6f8a810 100644
--- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs
+++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs
@@ -31,27 +31,34 @@ namespace ProjectGasolineTanker
private void InitializeComponent()
{
groupBoxTools = new GroupBox();
+ buttonCreateCompany = new Button();
+ panelStorage = new Panel();
+ buttonCollectionDel = new Button();
+ listBoxCollection = new ListBox();
+ buttonCollectionAdd = new Button();
+ radioButtonList = new RadioButton();
+ radioButtonMassive = new RadioButton();
+ textBoxCollectionName = new TextBox();
+ labelCollectionName = new Label();
buttonRefresh = new Button();
buttonGoToCheck = new Button();
buttonRemoveTanker = new Button();
maskedTextBoxPosition = new MaskedTextBox();
- buttonAddGasolineTanker = new Button();
buttonAddTanker = new Button();
comboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox();
+ panelCompanyTools = new Panel();
groupBoxTools.SuspendLayout();
+ panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
panelCompanyTools.SuspendLayout();
SuspendLayout();
//
- // Инструменты
+ // groupBoxTools
//
- groupBoxTools.Controls.Add(buttonRefresh);
- groupBoxTools.Controls.Add(buttonGoToCheck);
- groupBoxTools.Controls.Add(buttonRemoveTanker);
- groupBoxTools.Controls.Add(maskedTextBoxPosition);
- groupBoxTools.Controls.Add(buttonAddGasolineTanker);
- groupBoxTools.Controls.Add(buttonAddTanker);
+ groupBoxTools.Controls.Add(panelCompanyTools);
+ groupBoxTools.Controls.Add(buttonCreateCompany);
+ groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(783, 0);
@@ -61,10 +68,102 @@ namespace ProjectGasolineTanker
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
//
- // buttonAddGasolineTanker
+ // buttonCreateCompany
+ //
+ buttonCreateCompany.Location = new Point(6, 320);
+ buttonCreateCompany.Name = "buttonCreateCompany";
+ buttonCreateCompany.Size = new Size(167, 23);
+ buttonCreateCompany.TabIndex = 8;
+ buttonCreateCompany.Text = "Создать компанию";
+ buttonCreateCompany.UseVisualStyleBackColor = true;
+ buttonCreateCompany.Click += ButtonCreateCompany_Click;
+ //
+ // panelStorage
+ //
+ panelStorage.Controls.Add(buttonCollectionDel);
+ panelStorage.Controls.Add(listBoxCollection);
+ panelStorage.Controls.Add(buttonCollectionAdd);
+ panelStorage.Controls.Add(radioButtonList);
+ panelStorage.Controls.Add(radioButtonMassive);
+ panelStorage.Controls.Add(textBoxCollectionName);
+ panelStorage.Controls.Add(labelCollectionName);
+ panelStorage.Dock = DockStyle.Top;
+ panelStorage.Location = new Point(3, 19);
+ panelStorage.Name = "panelStorage";
+ panelStorage.Size = new Size(173, 266);
+ panelStorage.TabIndex = 7;
+ //
+ // buttonCollectionDel
+ //
+ buttonCollectionDel.Location = new Point(3, 227);
+ buttonCollectionDel.Name = "buttonCollectionDel";
+ buttonCollectionDel.Size = new Size(167, 23);
+ buttonCollectionDel.TabIndex = 6;
+ buttonCollectionDel.Text = "Удалить коллекцию";
+ buttonCollectionDel.UseVisualStyleBackColor = true;
+ buttonCollectionDel.Click += ButtonCollectionDel_Click;
+ //
+ // listBoxCollection
+ //
+ listBoxCollection.FormattingEnabled = true;
+ listBoxCollection.ItemHeight = 15;
+ listBoxCollection.Location = new Point(3, 112);
+ listBoxCollection.Name = "listBoxCollection";
+ listBoxCollection.Size = new Size(167, 109);
+ listBoxCollection.TabIndex = 5;
+ //
+ // buttonCollectionAdd
+ //
+ buttonCollectionAdd.Location = new Point(3, 83);
+ buttonCollectionAdd.Name = "buttonCollectionAdd";
+ buttonCollectionAdd.Size = new Size(167, 23);
+ buttonCollectionAdd.TabIndex = 4;
+ buttonCollectionAdd.Text = "Добавить коллекцию";
+ buttonCollectionAdd.UseVisualStyleBackColor = true;
+ buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
+ //
+ // radioButtonList
+ //
+ radioButtonList.AutoSize = true;
+ radioButtonList.Location = new Point(98, 58);
+ radioButtonList.Name = "radioButtonList";
+ radioButtonList.Size = new Size(66, 19);
+ radioButtonList.TabIndex = 3;
+ radioButtonList.TabStop = true;
+ radioButtonList.Text = "Список";
+ radioButtonList.UseVisualStyleBackColor = true;
+ //
+ // radioButtonMassive
+ //
+ radioButtonMassive.AutoSize = true;
+ radioButtonMassive.Location = new Point(16, 58);
+ radioButtonMassive.Name = "radioButtonMassive";
+ radioButtonMassive.Size = new Size(67, 19);
+ radioButtonMassive.TabIndex = 2;
+ radioButtonMassive.TabStop = true;
+ radioButtonMassive.Text = "Массив";
+ radioButtonMassive.UseVisualStyleBackColor = true;
+ //
+ // textBoxCollectionName
+ //
+ textBoxCollectionName.Location = new Point(3, 29);
+ textBoxCollectionName.Name = "textBoxCollectionName";
+ textBoxCollectionName.Size = new Size(167, 23);
+ textBoxCollectionName.TabIndex = 1;
+ //
+ // labelCollectionName
+ //
+ labelCollectionName.AutoSize = true;
+ labelCollectionName.Location = new Point(26, 11);
+ labelCollectionName.Name = "labelCollectionName";
+ labelCollectionName.Size = new Size(125, 15);
+ labelCollectionName.TabIndex = 0;
+ labelCollectionName.Text = "Название коллекции:";
+ //
+ // buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonRefresh.Location = new Point(6, 499);
+ buttonRefresh.Location = new Point(3, 210);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(167, 40);
buttonRefresh.TabIndex = 6;
@@ -75,10 +174,10 @@ namespace ProjectGasolineTanker
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonGoToCheck.Location = new Point(6, 361);
+ buttonGoToCheck.Location = new Point(3, 170);
buttonGoToCheck.Name = "buttonGoToCheck";
- buttonGoToCheck.Size = new Size(213, 40);
- buttonGoToCheck.TabIndex = 6;
+ buttonGoToCheck.Size = new Size(167, 40);
+ buttonGoToCheck.TabIndex = 5;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
@@ -86,39 +185,28 @@ namespace ProjectGasolineTanker
// buttonRemoveTanker
//
buttonRemoveTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonRemoveTanker.Location = new Point(6, 251);
+ buttonRemoveTanker.Location = new Point(3, 124);
buttonRemoveTanker.Name = "buttonRemoveTanker";
- buttonRemoveTanker.Size = new Size(213, 40);
+ buttonRemoveTanker.Size = new Size(167, 40);
buttonRemoveTanker.TabIndex = 4;
- buttonRemoveTanker.Text = "Удаление машины";
+ buttonRemoveTanker.Text = "Удалить автомобиль";
buttonRemoveTanker.UseVisualStyleBackColor = true;
buttonRemoveTanker.Click += ButtonRemoveTanker_Click;
//
- // buttonRefresh
+ // maskedTextBoxPosition
//
- maskedTextBoxPosition.Location = new Point(6, 222);
+ maskedTextBoxPosition.Location = new Point(3, 95);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(167, 23);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
- // buttonAddGaslineTanker
- //
- buttonAddGasolineTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddGasolineTanker.Location = new Point(6, 137);
- buttonAddGasolineTanker.Name = "buttonAddGasolineTanker";
- buttonAddGasolineTanker.Size = new Size(167, 40);
- buttonAddGasolineTanker.TabIndex = 2;
- buttonAddGasolineTanker.Text = "Добавление бензовоза";
- buttonAddGasolineTanker.UseVisualStyleBackColor = true;
- buttonAddGasolineTanker.Click += ButtonAddGasolineTanker_Click;
- //
// buttonAddTanker
//
buttonAddTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddTanker.Location = new Point(6, 91);
+ buttonAddTanker.Location = new Point(3, 3);
buttonAddTanker.Name = "buttonAddTanker";
buttonAddTanker.Size = new Size(167, 40);
buttonAddTanker.TabIndex = 1;
@@ -132,9 +220,9 @@ namespace ProjectGasolineTanker
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
- comboBoxSelectorCompany.Location = new Point(6, 22);
+ comboBoxSelectorCompany.Location = new Point(6, 291);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
- comboBoxSelectorCompany.Size = new Size(213, 23);
+ comboBoxSelectorCompany.Size = new Size(167, 23);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
@@ -143,7 +231,7 @@ namespace ProjectGasolineTanker
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(861, 651);
+ pictureBox.Size = new Size(783, 616);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
@@ -165,9 +253,9 @@ namespace ProjectGasolineTanker
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1086, 651);
+ ClientSize = new Size(962, 616);
Controls.Add(pictureBox);
- Controls.Add(Инструменты);
+ Controls.Add(groupBoxTools);
Name = "FormTankerCollection";
Text = "Коллекция автомобилей";
groupBoxTools.ResumeLayout(false);
@@ -181,17 +269,23 @@ namespace ProjectGasolineTanker
#endregion
- private GroupBox Инструменты;
- private Button buttonAddTanker;
+ private GroupBox groupBoxTools;
private ComboBox comboBoxSelectorCompany;
- private Button buttonAddGasolineTanker;
private Button buttonAddTanker;
private Button buttonRemoveTanker;
private MaskedTextBox maskedTextBoxPosition;
private PictureBox pictureBox;
- private Button buttonRefresh;
- private Button buttonRemoveTanker;
private Button buttonGoToCheck;
private Button buttonRefresh;
+ private Panel panelStorage;
+ private Label labelCollectionName;
+ private TextBox textBoxCollectionName;
+ private RadioButton radioButtonList;
+ private RadioButton radioButtonMassive;
+ private Button buttonCollectionAdd;
+ private ListBox listBoxCollection;
+ private Button buttonCollectionDel;
+ private Button buttonCreateCompany;
+ private Panel panelCompanyTools;
}
}
\ No newline at end of file
diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs
index 0ce7fa6..c12a09f 100644
--- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs
+++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs
@@ -48,20 +48,17 @@ public partial class FormTankerCollection : Form
///
///
///
- private void ButtonAddTanker_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTanker));
-
+ private void ButtonAddTanker_Click(object sender, EventArgs e)
+ {
+ FormTankerConfig form = new();
+ form.Show();
+ form.AddEvent(SetTanker);
+ }
///
- /// Добавление спортивного автомобиля
+ /// Добавление автомобиля в коллекцию
///
- ///
- ///
- private void ButtonAddGasolineTanker_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningGasolineTanker));
-
- ///
- /// Создание объекта класса-перемещения
- ///
- /// Тип создаваемого объекта
- private void CreateObject(string type)
+ ///
+ private void SetTanker(DrawningTanker? tank)
{
if (_company == null || tank == null)
{
@@ -80,22 +77,10 @@ public partial class FormTankerCollection : Form
}
///
- /// Получение цвета
+ /// Удаление объекта
///
- /// Генератор случайных чисел
- ///
- private static Color GetColor(Random random)
- {
- Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
- ColorDialog dialog = new();
- if (dialog.ShowDialog() == DialogResult.OK)
- {
- color = dialog.Color;
- }
-
- return color;
- }
-
+ ///
+ ///
private void ButtonRemoveTanker_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx
index af32865..1af7de1 100644
--- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx
+++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx
@@ -1,17 +1,17 @@
-