маленькие изменения
This commit is contained in:
parent
a50b38a592
commit
d1ad010777
@ -45,21 +45,19 @@
|
|||||||
comboBoxSelectorCompany = new ComboBox();
|
comboBoxSelectorCompany = new ComboBox();
|
||||||
buttonCreateHoistingCrane = new Button();
|
buttonCreateHoistingCrane = new Button();
|
||||||
pictureBox = new PictureBox();
|
pictureBox = new PictureBox();
|
||||||
|
panelCompanyTool = new Panel();
|
||||||
groupBoxTools.SuspendLayout();
|
groupBoxTools.SuspendLayout();
|
||||||
panelStorage.SuspendLayout();
|
panelStorage.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
|
panelCompanyTool.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBoxTools
|
// groupBoxTools
|
||||||
//
|
//
|
||||||
|
groupBoxTools.Controls.Add(panelCompanyTool);
|
||||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||||
groupBoxTools.Controls.Add(panelStorage);
|
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(comboBoxSelectorCompany);
|
||||||
groupBoxTools.Controls.Add(buttonCreateHoistingCrane);
|
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
groupBoxTools.Location = new Point(763, 0);
|
groupBoxTools.Location = new Point(763, 0);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
@ -163,7 +161,7 @@
|
|||||||
// buttonGoToChek
|
// buttonGoToChek
|
||||||
//
|
//
|
||||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonGoToChek.Location = new Point(12, 440);
|
buttonGoToChek.Location = new Point(9, 99);
|
||||||
buttonGoToChek.Name = "buttonGoToChek";
|
buttonGoToChek.Name = "buttonGoToChek";
|
||||||
buttonGoToChek.Size = new Size(192, 24);
|
buttonGoToChek.Size = new Size(192, 24);
|
||||||
buttonGoToChek.TabIndex = 6;
|
buttonGoToChek.TabIndex = 6;
|
||||||
@ -174,7 +172,7 @@
|
|||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonRefresh.Location = new Point(12, 470);
|
buttonRefresh.Location = new Point(9, 129);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(192, 27);
|
buttonRefresh.Size = new Size(192, 27);
|
||||||
buttonRefresh.TabIndex = 5;
|
buttonRefresh.TabIndex = 5;
|
||||||
@ -185,7 +183,7 @@
|
|||||||
// buttonDeleteCar
|
// buttonDeleteCar
|
||||||
//
|
//
|
||||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonDeleteCar.Location = new Point(12, 411);
|
buttonDeleteCar.Location = new Point(9, 70);
|
||||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
buttonDeleteCar.Name = "buttonDeleteCar";
|
||||||
buttonDeleteCar.Size = new Size(192, 23);
|
buttonDeleteCar.Size = new Size(192, 23);
|
||||||
buttonDeleteCar.TabIndex = 4;
|
buttonDeleteCar.TabIndex = 4;
|
||||||
@ -196,7 +194,7 @@
|
|||||||
// maskedTextBox
|
// maskedTextBox
|
||||||
//
|
//
|
||||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
maskedTextBox.Location = new Point(12, 382);
|
maskedTextBox.Location = new Point(9, 41);
|
||||||
maskedTextBox.Mask = "00";
|
maskedTextBox.Mask = "00";
|
||||||
maskedTextBox.Name = "maskedTextBox";
|
maskedTextBox.Name = "maskedTextBox";
|
||||||
maskedTextBox.Size = new Size(192, 23);
|
maskedTextBox.Size = new Size(192, 23);
|
||||||
@ -212,12 +210,12 @@
|
|||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||||
comboBoxSelectorCompany.Size = new Size(192, 23);
|
comboBoxSelectorCompany.Size = new Size(192, 23);
|
||||||
comboBoxSelectorCompany.TabIndex = 2;
|
comboBoxSelectorCompany.TabIndex = 2;
|
||||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
|
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
// buttonCreateHoistingCrane
|
// buttonCreateHoistingCrane
|
||||||
//
|
//
|
||||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonCreateHoistingCrane.Location = new Point(12, 324);
|
buttonCreateHoistingCrane.Location = new Point(9, 13);
|
||||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
||||||
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
||||||
buttonCreateHoistingCrane.TabIndex = 0;
|
buttonCreateHoistingCrane.TabIndex = 0;
|
||||||
@ -234,6 +232,19 @@
|
|||||||
pictureBox.TabIndex = 1;
|
pictureBox.TabIndex = 1;
|
||||||
pictureBox.TabStop = false;
|
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
|
// FormCarCollection
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@ -244,10 +255,11 @@
|
|||||||
Name = "FormCarCollection";
|
Name = "FormCarCollection";
|
||||||
Text = "FormCarCollections";
|
Text = "FormCarCollections";
|
||||||
groupBoxTools.ResumeLayout(false);
|
groupBoxTools.ResumeLayout(false);
|
||||||
groupBoxTools.PerformLayout();
|
|
||||||
panelStorage.ResumeLayout(false);
|
panelStorage.ResumeLayout(false);
|
||||||
panelStorage.PerformLayout();
|
panelStorage.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
|
panelCompanyTool.ResumeLayout(false);
|
||||||
|
panelCompanyTool.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,5 +282,6 @@
|
|||||||
private Button buttonDeleteCollection;
|
private Button buttonDeleteCollection;
|
||||||
private ListBox listBoxCollection;
|
private ListBox listBoxCollection;
|
||||||
private Button buttonCollectionAdd;
|
private Button buttonCollectionAdd;
|
||||||
|
private Panel panelCompanyTool;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,19 +21,12 @@ namespace HoistingCrane
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_storageCollection = new();
|
_storageCollection = new();
|
||||||
|
panelCompanyTool.Enabled = false;
|
||||||
}
|
}
|
||||||
|
private void comboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
private void comboBoxSelectorCompany_SelectedIndexChanged_1(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
switch (comboBoxSelectorCompany.Text)
|
panelCompanyTool.Enabled = false;
|
||||||
{
|
|
||||||
case "Хранилище":
|
|
||||||
_company = new Garage(pictureBox.Width, pictureBox.Height, new MassivGenericObjects<DrawningTrackedVehicle>());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CreateObject(string type)
|
private void CreateObject(string type)
|
||||||
{
|
{
|
||||||
DrawningTrackedVehicle drawning;
|
DrawningTrackedVehicle drawning;
|
||||||
@ -41,7 +34,6 @@ namespace HoistingCrane
|
|||||||
Random rand = new();
|
Random rand = new();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
||||||
case nameof(DrawningHoistingCrane):
|
case nameof(DrawningHoistingCrane):
|
||||||
drawning = new DrawningHoistingCrane(rand.Next(100, 300), rand.Next(1000, 3000), GetColor(rand), GetColor(rand), true, true);
|
drawning = new DrawningHoistingCrane(rand.Next(100, 300), rand.Next(1000, 3000), GetColor(rand), GetColor(rand), true, true);
|
||||||
break;
|
break;
|
||||||
@ -62,7 +54,6 @@ namespace HoistingCrane
|
|||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Color GetColor(Random random)
|
private static Color GetColor(Random random)
|
||||||
{
|
{
|
||||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
@ -72,24 +63,10 @@ namespace HoistingCrane
|
|||||||
color = dialog.Color;
|
color = dialog.Color;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
|
||||||
|
|
||||||
private void SetCar(DrawningTrackedVehicle car)
|
|
||||||
{
|
|
||||||
if (_company == null || car == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((_company + car) != -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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)
|
private void buttonDeleteCar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -113,13 +90,11 @@ namespace HoistingCrane
|
|||||||
MessageBox.Show("Не удалось удалить объект");
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_company == null) return;
|
if (_company == null) return;
|
||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonGoToChek_Click(object sender, EventArgs e)
|
private void buttonGoToChek_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_company == null) return;
|
if (_company == null) return;
|
||||||
@ -137,7 +112,6 @@ namespace HoistingCrane
|
|||||||
SetCar = car
|
SetCar = car
|
||||||
};
|
};
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -155,7 +129,6 @@ namespace HoistingCrane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCollectionAdd_Click(object sender, EventArgs e)
|
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))
|
||||||
@ -177,25 +150,18 @@ namespace HoistingCrane
|
|||||||
collectionType);
|
collectionType);
|
||||||
RerfreshListBoxItems();
|
RerfreshListBoxItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDeleteCollection_Click(object sender, EventArgs e)
|
private void buttonDeleteCollection_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO прописать логику удаления элемента из коллекции
|
|
||||||
// нужно убедиться, что есть выбранная коллекция
|
|
||||||
// спросить у пользователя через MessageBox, что он подтверждает, что хочет удалить запись
|
|
||||||
// удалить и обновить ListBox
|
|
||||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
MessageBox.Show("Коллекция не выбрана");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
return;
|
return;
|
||||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||||
RerfreshListBoxItems();
|
RerfreshListBoxItems();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||||
@ -215,16 +181,9 @@ namespace HoistingCrane
|
|||||||
_company = new Garage(pictureBox.Width, pictureBox.Height, collection);
|
_company = new Garage(pictureBox.Width, pictureBox.Height, collection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
panelStorage.Enabled = true;
|
panelCompanyTool.Enabled = true;
|
||||||
RerfreshListBoxItems();
|
RerfreshListBoxItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
FormCarConfig form = new();
|
|
||||||
form.AddEvent(SetCar);
|
|
||||||
form.Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user