принято

This commit is contained in:
Владимир Данилов 2023-11-17 15:50:04 +04:00
parent a730ed3789
commit dfe8364c20
2 changed files with 13 additions and 12 deletions

View File

@ -30,6 +30,7 @@
{ {
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
groupBoxStorage = new GroupBox(); groupBoxStorage = new GroupBox();
textBoxStorageName = new TextBox();
buttonDelObject = new Button(); buttonDelObject = new Button();
listBoxStorages = new ListBox(); listBoxStorages = new ListBox();
buttonAddObject = new Button(); buttonAddObject = new Button();
@ -38,7 +39,6 @@
buttonRemoveTruck = new Button(); buttonRemoveTruck = new Button();
buttonAddTruck = new Button(); buttonAddTruck = new Button();
pictureBoxCollection = new PictureBox(); pictureBoxCollection = new PictureBox();
textBoxStorageName = new TextBox();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
groupBoxStorage.SuspendLayout(); groupBoxStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
@ -71,6 +71,13 @@
groupBoxStorage.TabStop = false; groupBoxStorage.TabStop = false;
groupBoxStorage.Text = "Наборы"; groupBoxStorage.Text = "Наборы";
// //
// textBoxStorageName
//
textBoxStorageName.Location = new Point(6, 22);
textBoxStorageName.Name = "textBoxStorageName";
textBoxStorageName.Size = new Size(176, 23);
textBoxStorageName.TabIndex = 5;
//
// buttonDelObject // buttonDelObject
// //
buttonDelObject.Location = new Point(6, 190); buttonDelObject.Location = new Point(6, 190);
@ -89,6 +96,7 @@
listBoxStorages.Name = "listBoxStorages"; listBoxStorages.Name = "listBoxStorages";
listBoxStorages.Size = new Size(176, 94); listBoxStorages.Size = new Size(176, 94);
listBoxStorages.TabIndex = 3; listBoxStorages.TabIndex = 3;
listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged;
// //
// buttonAddObject // buttonAddObject
// //
@ -145,13 +153,6 @@
pictureBoxCollection.TabIndex = 1; pictureBoxCollection.TabIndex = 1;
pictureBoxCollection.TabStop = false; pictureBoxCollection.TabStop = false;
// //
// textBoxStorageName
//
textBoxStorageName.Location = new Point(6, 22);
textBoxStorageName.Name = "textBoxStorageName";
textBoxStorageName.Size = new Size(176, 23);
textBoxStorageName.TabIndex = 5;
//
// FormTruckCollection // FormTruckCollection
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);

View File

@ -124,7 +124,7 @@ namespace Project_DumpTruck
pictureBoxCollection.Image = obj.ShowTrucks(); pictureBoxCollection.Image = obj.ShowTrucks();
} }
private void buttonAddObject_Click(object sender, EventArgs e) private void buttonAddObject_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(textBoxStorageName.Text)) if (string.IsNullOrEmpty(textBoxStorageName.Text))
{ {
@ -141,7 +141,7 @@ namespace Project_DumpTruck
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void ListBoxObjects_SelectedIndexChanged(object sender, private void listBoxStorages_SelectedIndexChanged(object sender,
EventArgs e) EventArgs e)
{ {
pictureBoxCollection.Image = pictureBoxCollection.Image =
@ -158,9 +158,9 @@ namespace Project_DumpTruck
{ {
return; return;
} }
if (MessageBox.Show($"Удалить объект { listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes) MessageBoxIcon.Question) == DialogResult.Yes)
{ {
_storage.DelSet(listBoxStorages.SelectedItem.ToString() _storage.DelSet(listBoxStorages.SelectedItem.ToString()
?? string.Empty); ?? string.Empty);
ReloadObjects(); ReloadObjects();