# Conflicts:
#	ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ListGenericObjects.cs
#	ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/StorageCollection.cs
#	ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs
#	ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs
#	ProjectGasolineTanker/ProjectGasolineTanker/FormTankerConfig.cs
This commit is contained in:
Roman-Klemendeev 2024-05-26 22:13:37 +04:00
parent ddc2987b68
commit 6725a8cb3a
5 changed files with 131 additions and 281 deletions

View File

@ -7,6 +7,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
private int _maxCount; private int _maxCount;
public int Count => _collection.Count; public int Count => _collection.Count;
<<<<<<< HEAD
public int MaxCount public int MaxCount
{ {
get => _maxCount; get => _maxCount;
@ -20,6 +21,9 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
} }
public CollectionType GetCollectionType => CollectionType.List; public CollectionType GetCollectionType => CollectionType.List;
=======
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
>>>>>>> 3ab0f7e (53)
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -67,6 +71,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
_collection.RemoveAt(position); _collection.RemoveAt(position);
return obj; return obj;
} }
<<<<<<< HEAD
public IEnumerable<T?> GetItems() public IEnumerable<T?> GetItems()
{ {
@ -75,4 +80,6 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
yield return _collection[i]; yield return _collection[i];
} }
} }
=======
>>>>>>> 3ab0f7e (53)
} }

View File

@ -1,9 +1,16 @@
<<<<<<< HEAD
using ProjectGasolineTanker.Drawnings; using ProjectGasolineTanker.Drawnings;
using System.Text; using System.Text;
namespace ProjectGasolineTanker.CollectionGenericObjects; namespace ProjectGasolineTanker.CollectionGenericObjects;
public class StorageCollection<T> public class StorageCollection<T>
where T : DrawningTanker where T : DrawningTanker
=======

namespace ProjectGasolineTanker.CollectionGenericObjects;
public class StorageCollection<T>
where T : class
>>>>>>> 3ab0f7e (53)
{ {
/// <summary> /// <summary>
/// Словарь (хранилище) с коллекциями /// Словарь (хранилище) с коллекциями
@ -16,6 +23,7 @@ public class StorageCollection<T>
public List<string> Keys => _storages.Keys.ToList(); public List<string> Keys => _storages.Keys.ToList();
/// <summary> /// <summary>
<<<<<<< HEAD
/// Ключевое слово, с которого должен начинаться файл /// Ключевое слово, с которого должен начинаться файл
/// </summary> /// </summary>
private readonly string _collectionKey = "CollectionsStorage"; private readonly string _collectionKey = "CollectionsStorage";
@ -31,6 +39,8 @@ public class StorageCollection<T>
private readonly string _separatorItems = ";"; private readonly string _separatorItems = ";";
/// <summary> /// <summary>
=======
>>>>>>> 3ab0f7e (53)
/// Конструктор /// Конструктор
/// </summary> /// </summary>
public StorageCollection() public StorageCollection()
@ -91,6 +101,7 @@ public class StorageCollection<T>
return null; return null;
} }
} }
<<<<<<< HEAD
/// <summary> /// <summary>
/// Сохранение информации по автомобилям в хранилище в файл /// Сохранение информации по автомобилям в хранилище в файл
@ -205,4 +216,6 @@ public class StorageCollection<T>
_ => null, _ => null,
}; };
} }
=======
>>>>>>> 3ab0f7e (53)
} }

View File

@ -30,13 +30,7 @@ namespace ProjectGasolineTanker
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
Инструменты = new GroupBox(); groupBoxTools = new GroupBox();
panelCompanyTools = new Panel();
buttonAddTanker = new Button();
maskedTextBoxPosition = new MaskedTextBox();
buttonGoToCheck = new Button();
buttonRemoveTanker = new Button();
buttonRefresh = new Button();
buttonCreateCompany = new Button(); buttonCreateCompany = new Button();
panelStorage = new Panel(); panelStorage = new Panel();
buttonCollectionDel = new Button(); buttonCollectionDel = new Button();
@ -46,107 +40,40 @@ namespace ProjectGasolineTanker
radioButtonMassive = new RadioButton(); radioButtonMassive = new RadioButton();
textBoxCollectionName = new TextBox(); textBoxCollectionName = new TextBox();
labelCollectionName = new Label(); labelCollectionName = new Label();
buttonRefresh = new Button();
buttonGoToCheck = new Button();
buttonRemoveTanker = new Button();
maskedTextBoxPosition = new MaskedTextBox();
buttonAddTanker = new Button();
comboBoxSelectorCompany = new ComboBox(); comboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox(); pictureBox = new PictureBox();
menuStrip = new MenuStrip(); panelCompanyTools = new Panel();
файлToolStripMenuItem = new ToolStripMenuItem(); groupBoxTools.SuspendLayout();
saveToolStripMenuItem = new ToolStripMenuItem();
loadToolStripMenuItem = new ToolStripMenuItem();
saveFileDialog = new SaveFileDialog();
openFileDialog = new OpenFileDialog();
Инструменты.SuspendLayout();
panelCompanyTools.SuspendLayout();
panelStorage.SuspendLayout(); panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
menuStrip.SuspendLayout(); panelCompanyTools.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// Инструменты // groupBoxTools
// //
Инструменты.Controls.Add(panelCompanyTools); groupBoxTools.Controls.Add(panelCompanyTools);
Инструменты.Controls.Add(buttonCreateCompany); groupBoxTools.Controls.Add(buttonCreateCompany);
Инструменты.Controls.Add(panelStorage); groupBoxTools.Controls.Add(panelStorage);
Инструменты.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Controls.Add(comboBoxSelectorCompany);
Инструменты.Dock = DockStyle.Right; groupBoxTools.Dock = DockStyle.Right;
Инструменты.Location = new Point(861, 24); groupBoxTools.Location = new Point(783, 0);
Инструменты.Name = "Инструменты"; groupBoxTools.Name = "groupBoxTools";
Инструменты.Size = new Size(225, 627); groupBoxTools.Size = new Size(179, 616);
Инструменты.TabIndex = 0; groupBoxTools.TabIndex = 0;
Инструменты.TabStop = false; groupBoxTools.TabStop = false;
Инструменты.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
//
// panelCompanyTools
//
panelCompanyTools.Controls.Add(buttonAddTanker);
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Controls.Add(buttonRemoveTanker);
panelCompanyTools.Controls.Add(buttonRefresh);
panelCompanyTools.Dock = DockStyle.Bottom;
panelCompanyTools.Location = new Point(3, 380);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(219, 244);
panelCompanyTools.TabIndex = 8;
//
// buttonAddTanker
//
buttonAddTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddTanker.Location = new Point(3, 21);
buttonAddTanker.Name = "buttonAddTanker";
buttonAddTanker.Size = new Size(213, 37);
buttonAddTanker.TabIndex = 1;
buttonAddTanker.Text = "Добавление грузовика";
buttonAddTanker.UseVisualStyleBackColor = true;
buttonAddTanker.Click += ButtonAddTanker_Click;
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(3, 86);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(213, 23);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(3, 161);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(213, 40);
buttonGoToCheck.TabIndex = 6;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
//
// buttonRemoveTanker
//
buttonRemoveTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveTanker.Location = new Point(3, 115);
buttonRemoveTanker.Name = "buttonRemoveTanker";
buttonRemoveTanker.Size = new Size(213, 40);
buttonRemoveTanker.TabIndex = 4;
buttonRemoveTanker.Text = "Удаление автомобиль";
buttonRemoveTanker.UseVisualStyleBackColor = true;
buttonRemoveTanker.Click += ButtonRemoveTanker_Click;
//
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(3, 207);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(213, 40);
buttonRefresh.TabIndex = 5;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
// //
// buttonCreateCompany // buttonCreateCompany
// //
buttonCreateCompany.Location = new Point(6, 350); buttonCreateCompany.Location = new Point(6, 320);
buttonCreateCompany.Name = "buttonCreateCompany"; buttonCreateCompany.Name = "buttonCreateCompany";
buttonCreateCompany.Size = new Size(213, 24); buttonCreateCompany.Size = new Size(167, 23);
buttonCreateCompany.TabIndex = 7; buttonCreateCompany.TabIndex = 8;
buttonCreateCompany.Text = "Создать компанию"; buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true; buttonCreateCompany.UseVisualStyleBackColor = true;
buttonCreateCompany.Click += ButtonCreateCompany_Click; buttonCreateCompany.Click += ButtonCreateCompany_Click;
@ -163,14 +90,14 @@ namespace ProjectGasolineTanker
panelStorage.Dock = DockStyle.Top; panelStorage.Dock = DockStyle.Top;
panelStorage.Location = new Point(3, 19); panelStorage.Location = new Point(3, 19);
panelStorage.Name = "panelStorage"; panelStorage.Name = "panelStorage";
panelStorage.Size = new Size(219, 296); panelStorage.Size = new Size(173, 266);
panelStorage.TabIndex = 7; panelStorage.TabIndex = 7;
// //
// buttonCollectionDel // buttonCollectionDel
// //
buttonCollectionDel.Location = new Point(3, 267); buttonCollectionDel.Location = new Point(3, 227);
buttonCollectionDel.Name = "buttonCollectionDel"; buttonCollectionDel.Name = "buttonCollectionDel";
buttonCollectionDel.Size = new Size(213, 24); buttonCollectionDel.Size = new Size(167, 23);
buttonCollectionDel.TabIndex = 6; buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию"; buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true; buttonCollectionDel.UseVisualStyleBackColor = true;
@ -180,16 +107,16 @@ namespace ProjectGasolineTanker
// //
listBoxCollection.FormattingEnabled = true; listBoxCollection.FormattingEnabled = true;
listBoxCollection.ItemHeight = 15; listBoxCollection.ItemHeight = 15;
listBoxCollection.Location = new Point(3, 122); listBoxCollection.Location = new Point(3, 112);
listBoxCollection.Name = "listBoxCollection"; listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(213, 139); listBoxCollection.Size = new Size(167, 109);
listBoxCollection.TabIndex = 5; listBoxCollection.TabIndex = 5;
// //
// buttonCollectionAdd // buttonCollectionAdd
// //
buttonCollectionAdd.Location = new Point(3, 85); buttonCollectionAdd.Location = new Point(3, 83);
buttonCollectionAdd.Name = "buttonCollectionAdd"; buttonCollectionAdd.Name = "buttonCollectionAdd";
buttonCollectionAdd.Size = new Size(213, 24); buttonCollectionAdd.Size = new Size(167, 23);
buttonCollectionAdd.TabIndex = 4; buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добавить коллекцию"; buttonCollectionAdd.Text = "Добавить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true; buttonCollectionAdd.UseVisualStyleBackColor = true;
@ -198,7 +125,7 @@ namespace ProjectGasolineTanker
// radioButtonList // radioButtonList
// //
radioButtonList.AutoSize = true; radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(139, 60); radioButtonList.Location = new Point(98, 58);
radioButtonList.Name = "radioButtonList"; radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(66, 19); radioButtonList.Size = new Size(66, 19);
radioButtonList.TabIndex = 3; radioButtonList.TabIndex = 3;
@ -209,7 +136,7 @@ namespace ProjectGasolineTanker
// radioButtonMassive // radioButtonMassive
// //
radioButtonMassive.AutoSize = true; radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(19, 60); radioButtonMassive.Location = new Point(16, 58);
radioButtonMassive.Name = "radioButtonMassive"; radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(67, 19); radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.TabIndex = 2; radioButtonMassive.TabIndex = 2;
@ -219,27 +146,81 @@ namespace ProjectGasolineTanker
// //
// textBoxCollectionName // textBoxCollectionName
// //
textBoxCollectionName.Location = new Point(3, 31); textBoxCollectionName.Location = new Point(3, 29);
textBoxCollectionName.Name = "textBoxCollectionName"; textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(213, 23); textBoxCollectionName.Size = new Size(167, 23);
textBoxCollectionName.TabIndex = 1; textBoxCollectionName.TabIndex = 1;
// //
// labelCollectionName // labelCollectionName
// //
labelCollectionName.AutoSize = true; labelCollectionName.AutoSize = true;
labelCollectionName.Location = new Point(47, 13); labelCollectionName.Location = new Point(26, 11);
labelCollectionName.Name = "labelCollectionName"; labelCollectionName.Name = "labelCollectionName";
labelCollectionName.Size = new Size(125, 15); labelCollectionName.Size = new Size(125, 15);
labelCollectionName.TabIndex = 0; labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции:"; labelCollectionName.Text = "Название коллекции:";
// //
// buttonAddTanker
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(3, 210);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(167, 40);
buttonRefresh.TabIndex = 6;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(3, 170);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(213, 40);
buttonGoToCheck.TabIndex = 6;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
//
// buttonRemoveTanker
//
buttonRemoveTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveTanker.Location = new Point(3, 124);
buttonRemoveTanker.Name = "buttonRemoveTanker";
buttonRemoveTanker.Size = new Size(213, 40);
buttonRemoveTanker.TabIndex = 4;
buttonRemoveTanker.Text = "Удаление автомобиль";
buttonRemoveTanker.UseVisualStyleBackColor = true;
buttonRemoveTanker.Click += ButtonRemoveTanker_Click;
//
// buttonRefresh
//
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);
//
// buttonAddTanker
//
buttonAddTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddTanker.Location = new Point(3, 3);
buttonAddTanker.Name = "buttonAddTanker";
buttonAddTanker.Size = new Size(167, 40);
buttonAddTanker.TabIndex = 1;
buttonAddTanker.Text = "Добавление грузовика";
buttonAddTanker.UseVisualStyleBackColor = true;
buttonAddTanker.Click += ButtonAddTanker_Click;
//
// comboBoxSelectorCompany // comboBoxSelectorCompany
// //
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(6, 321); comboBoxSelectorCompany.Location = new Point(6, 291);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(213, 23); comboBoxSelectorCompany.Size = new Size(213, 23);
comboBoxSelectorCompany.TabIndex = 0; comboBoxSelectorCompany.TabIndex = 0;
@ -254,45 +235,19 @@ namespace ProjectGasolineTanker
pictureBox.TabIndex = 1; pictureBox.TabIndex = 1;
pictureBox.TabStop = false; pictureBox.TabStop = false;
// //
// menuStrip // panelCompanyTools
// //
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); panelCompanyTools.Controls.Add(buttonAddTanker);
menuStrip.Location = new Point(0, 0); panelCompanyTools.Controls.Add(maskedTextBoxPosition);
menuStrip.Name = "menuStrip"; panelCompanyTools.Controls.Add(buttonRefresh);
menuStrip.Size = new Size(1086, 24); panelCompanyTools.Controls.Add(buttonRemoveTanker);
menuStrip.TabIndex = 2; panelCompanyTools.Controls.Add(buttonGoToCheck);
menuStrip.Text = "menuStrip1"; panelCompanyTools.Dock = DockStyle.Bottom;
// panelCompanyTools.Enabled = false;
// файлToolStripMenuItem panelCompanyTools.Location = new Point(3, 360);
// panelCompanyTools.Name = "panelCompanyTools";
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem }); panelCompanyTools.Size = new Size(173, 253);
файлToolStripMenuItem.Name = айлToolStripMenuItem"; panelCompanyTools.TabIndex = 9;
файлToolStripMenuItem.Size = new Size(48, 20);
файлToolStripMenuItem.Text = "Файл";
//
// saveToolStripMenuItem
//
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
saveToolStripMenuItem.Size = new Size(181, 22);
saveToolStripMenuItem.Text = "Сохранение";
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
//
// loadToolStripMenuItem
//
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
loadToolStripMenuItem.Size = new Size(181, 22);
loadToolStripMenuItem.Text = "Загрузка";
loadToolStripMenuItem.Click += loadToolStripMenuItem_Click;
//
// saveFileDialog
//
saveFileDialog.Filter = "txt file | *.txt";
//
// openFileDialog
//
openFileDialog.Filter = "txt file | *.txt";
// //
// FormTankerCollection // FormTankerCollection
// //
@ -305,17 +260,14 @@ namespace ProjectGasolineTanker
Controls.Add(menuStrip); Controls.Add(menuStrip);
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
Name = "FormTankerCollection"; Name = "FormTankerCollection";
Text = "Коллекция Грузовиков"; Text = "Коллекция автомобилей";
Инструменты.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
panelStorage.ResumeLayout(false); panelStorage.ResumeLayout(false);
panelStorage.PerformLayout(); panelStorage.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
menuStrip.ResumeLayout(false); panelCompanyTools.ResumeLayout(false);
menuStrip.PerformLayout(); panelCompanyTools.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
@ -338,11 +290,5 @@ namespace ProjectGasolineTanker
private Button buttonCollectionDel; private Button buttonCollectionDel;
private Button buttonCreateCompany; private Button buttonCreateCompany;
private Panel panelCompanyTools; private Panel panelCompanyTools;
private MenuStrip menuStrip;
private ToolStripMenuItem файлToolStripMenuItem;
private ToolStripMenuItem saveToolStripMenuItem;
private ToolStripMenuItem loadToolStripMenuItem;
private SaveFileDialog saveFileDialog;
private OpenFileDialog openFileDialog;
} }
} }

View File

@ -148,124 +148,4 @@ public partial class FormTankerCollection : Form
pictureBox.Image = _company.Show(); pictureBox.Image = _company.Show();
} }
private void ButtonCollectionAdd_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
{
MessageBox.Show("Не все данный заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
CollectionType collectionType = CollectionType.None;
if (radioButtonMassive.Checked)
{
collectionType = CollectionType.Massive;
}
else if (radioButtonList.Checked)
{
collectionType = CollectionType.List;
}
_storageCollection.AddCollection(textBoxCollectionName.Text, collectionType);
RefreshListBoxItems();
}
/// <summary>
/// Обновление списка в listBoxCollection
/// </summary>
private void RefreshListBoxItems()
{
listBoxCollection.Items.Clear();
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
{
string? colName = _storageCollection.Keys?[i];
if (!string.IsNullOrEmpty(colName))
{
listBoxCollection.Items.Add(colName);
}
}
}
private void ButtonCollectionDel_Click(object sender, EventArgs e)
{
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItems == null)
{
MessageBox.Show("Коллекция не выбрана");
return;
}
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
RefreshListBoxItems();
}
private void ButtonCreateCompany_Click(object sender, EventArgs e)
{
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
{
MessageBox.Show("Коллекция не выбрана");
return;
}
ICollectionGenericObjects<DrawningTanker>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
if (collection == null)
{
MessageBox.Show("Коллекция не проинициализирована");
return;
}
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new CarPark(pictureBox.Width, pictureBox.Height, collection);
break;
}
panelCompanyTools.Enabled = true;
RefreshListBoxItems();
}
/// <summary>
/// Обработка нажатия "Сохранение"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if (_storageCollection.SaveData(saveFileDialog.FileName))
{
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
/// <summary>
/// Обработка кнопки загрузки
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
if (_storageCollection.LoadData(openFileDialog.FileName))
{
RefreshListBoxItems();
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Загрузка не выполнена", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
} }

View File

@ -79,7 +79,11 @@ public partial class FormTankerConfig : Form
break; break;
case "labelModifiedObject": case "labelModifiedObject":
_tanker = new DrawningGasolineTanker((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, _tanker = new DrawningGasolineTanker((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
<<<<<<< HEAD
Color.Black, checkBoxSignalbeacon.Checked, checkBoxTanker.Checked); Color.Black, checkBoxSignalbeacon.Checked, checkBoxTanker.Checked);
=======
Color.Black, checkBoxTanker.Checked, checkBoxSignalbeacon.Checked);
>>>>>>> 3ab0f7e (53)
break; break;
} }
labelBodyColor.BackColor = Color.Empty; labelBodyColor.BackColor = Color.Empty;