Compare commits

..

No commits in common. "cb2629af906884869661030f59b6a55df065c571" and "c0f44442eecb75aa0cc9ebbc3c94887230fc09c7" have entirely different histories.

3 changed files with 69 additions and 165 deletions

View File

@ -46,17 +46,10 @@
maskedTextBoxPosision = new MaskedTextBox();
buttonGetToTest = new Button();
pictureBoxTrain = new PictureBox();
menuStrip = new MenuStrip();
файлToolStripMenuItem = new ToolStripMenuItem();
saveToolStripMenuItem = new ToolStripMenuItem();
loadToolStripMenuItem = new ToolStripMenuItem();
saveFileDialog = new SaveFileDialog();
openFileDialog = new OpenFileDialog();
groupBoxTools.SuspendLayout();
panelStorage.SuspendLayout();
panelCompanyTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxTrain).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
//
// groupBoxTools
@ -66,18 +59,21 @@
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Controls.Add(panelCompanyTools);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(631, 28);
groupBoxTools.Location = new Point(522, 0);
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(222, 651);
groupBoxTools.Padding = new Padding(3, 2, 3, 2);
groupBoxTools.Size = new Size(182, 490);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "инструменты";
//
// buttonCreateCompany
//
buttonCreateCompany.Location = new Point(21, 345);
buttonCreateCompany.Location = new Point(18, 259);
buttonCreateCompany.Margin = new Padding(3, 2, 3, 2);
buttonCreateCompany.Name = "buttonCreateCompany";
buttonCreateCompany.Size = new Size(186, 27);
buttonCreateCompany.Size = new Size(163, 20);
buttonCreateCompany.TabIndex = 7;
buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true;
@ -93,16 +89,18 @@
panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top;
panelStorage.Location = new Point(3, 23);
panelStorage.Location = new Point(3, 18);
panelStorage.Margin = new Padding(3, 2, 3, 2);
panelStorage.Name = "panelStorage";
panelStorage.Size = new Size(216, 283);
panelStorage.Size = new Size(176, 212);
panelStorage.TabIndex = 6;
//
// buttonCollectionDel
//
buttonCollectionDel.Location = new Point(17, 247);
buttonCollectionDel.Location = new Point(15, 185);
buttonCollectionDel.Margin = new Padding(3, 2, 3, 2);
buttonCollectionDel.Name = "buttonCollectionDel";
buttonCollectionDel.Size = new Size(186, 27);
buttonCollectionDel.Size = new Size(163, 20);
buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true;
@ -111,16 +109,19 @@
// listBoxCollection
//
listBoxCollection.FormattingEnabled = true;
listBoxCollection.Location = new Point(17, 137);
listBoxCollection.ItemHeight = 15;
listBoxCollection.Location = new Point(15, 103);
listBoxCollection.Margin = new Padding(3, 2, 3, 2);
listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(186, 104);
listBoxCollection.Size = new Size(163, 79);
listBoxCollection.TabIndex = 5;
//
// buttonCollecctionAdd
//
buttonCollecctionAdd.Location = new Point(17, 104);
buttonCollecctionAdd.Location = new Point(15, 78);
buttonCollecctionAdd.Margin = new Padding(3, 2, 3, 2);
buttonCollecctionAdd.Name = "buttonCollecctionAdd";
buttonCollecctionAdd.Size = new Size(186, 27);
buttonCollecctionAdd.Size = new Size(163, 20);
buttonCollecctionAdd.TabIndex = 4;
buttonCollecctionAdd.Text = "Добавить коллекцию";
buttonCollecctionAdd.UseVisualStyleBackColor = true;
@ -129,9 +130,10 @@
// radioButtonList
//
radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(123, 75);
radioButtonList.Location = new Point(108, 56);
radioButtonList.Margin = new Padding(3, 2, 3, 2);
radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(80, 24);
radioButtonList.Size = new Size(66, 19);
radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true;
radioButtonList.Text = "Список";
@ -140,9 +142,10 @@
// radioButtonMassive
//
radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(17, 75);
radioButtonMassive.Location = new Point(15, 56);
radioButtonMassive.Margin = new Padding(3, 2, 3, 2);
radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(82, 24);
radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив";
@ -150,17 +153,18 @@
//
// textBoxCollectionName
//
textBoxCollectionName.Location = new Point(17, 32);
textBoxCollectionName.Location = new Point(15, 24);
textBoxCollectionName.Margin = new Padding(3, 2, 3, 2);
textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(186, 27);
textBoxCollectionName.Size = new Size(163, 23);
textBoxCollectionName.TabIndex = 1;
//
// labelCollectionName
//
labelCollectionName.AutoSize = true;
labelCollectionName.Location = new Point(26, 9);
labelCollectionName.Location = new Point(23, 7);
labelCollectionName.Name = "labelCollectionName";
labelCollectionName.Size = new Size(155, 20);
labelCollectionName.Size = new Size(122, 15);
labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции";
//
@ -169,9 +173,10 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(21, 311);
comboBoxSelectorCompany.Location = new Point(18, 233);
comboBoxSelectorCompany.Margin = new Padding(3, 2, 3, 2);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(186, 28);
comboBoxSelectorCompany.Size = new Size(163, 23);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
//
@ -183,18 +188,20 @@
panelCompanyTools.Controls.Add(maskedTextBoxPosision);
panelCompanyTools.Controls.Add(buttonGetToTest);
panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 379);
panelCompanyTools.Location = new Point(3, 284);
panelCompanyTools.Margin = new Padding(3, 2, 3, 2);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(216, 274);
panelCompanyTools.Size = new Size(189, 206);
panelCompanyTools.TabIndex = 8;
//
// ButtonAddTrain
//
ButtonAddTrain.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddTrain.BackgroundImageLayout = ImageLayout.Center;
ButtonAddTrain.Location = new Point(18, 3);
ButtonAddTrain.Location = new Point(16, 2);
ButtonAddTrain.Margin = new Padding(3, 2, 3, 2);
ButtonAddTrain.Name = "ButtonAddTrain";
ButtonAddTrain.Size = new Size(186, 40);
ButtonAddTrain.Size = new Size(163, 55);
ButtonAddTrain.TabIndex = 1;
ButtonAddTrain.Text = "добваление поезда";
ButtonAddTrain.UseVisualStyleBackColor = true;
@ -203,9 +210,10 @@
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRefresh.Location = new Point(18, 227);
buttonRefresh.Location = new Point(16, 170);
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(186, 41);
buttonRefresh.Size = new Size(163, 31);
buttonRefresh.TabIndex = 5;
buttonRefresh.Text = "обновить";
buttonRefresh.UseVisualStyleBackColor = true;
@ -214,9 +222,10 @@
// ButtonRemoveTrain
//
ButtonRemoveTrain.Anchor = AnchorStyles.Right;
ButtonRemoveTrain.Location = new Point(18, 138);
ButtonRemoveTrain.Location = new Point(16, 88);
ButtonRemoveTrain.Margin = new Padding(3, 2, 3, 2);
ButtonRemoveTrain.Name = "ButtonRemoveTrain";
ButtonRemoveTrain.Size = new Size(186, 40);
ButtonRemoveTrain.Size = new Size(163, 46);
ButtonRemoveTrain.TabIndex = 3;
ButtonRemoveTrain.Text = "удалить поезд";
ButtonRemoveTrain.UseVisualStyleBackColor = true;
@ -224,19 +233,21 @@
//
// maskedTextBoxPosision
//
maskedTextBoxPosision.Location = new Point(17, 105);
maskedTextBoxPosision.Location = new Point(16, 61);
maskedTextBoxPosision.Margin = new Padding(3, 2, 3, 2);
maskedTextBoxPosision.Mask = "00";
maskedTextBoxPosision.Name = "maskedTextBoxPosision";
maskedTextBoxPosision.Size = new Size(187, 27);
maskedTextBoxPosision.Size = new Size(164, 23);
maskedTextBoxPosision.TabIndex = 2;
maskedTextBoxPosision.ValidatingType = typeof(int);
//
// buttonGetToTest
//
buttonGetToTest.Anchor = AnchorStyles.Right;
buttonGetToTest.Location = new Point(18, 184);
buttonGetToTest.Location = new Point(16, 138);
buttonGetToTest.Margin = new Padding(3, 2, 3, 2);
buttonGetToTest.Name = "buttonGetToTest";
buttonGetToTest.Size = new Size(186, 40);
buttonGetToTest.Size = new Size(163, 30);
buttonGetToTest.TabIndex = 4;
buttonGetToTest.Text = "передать на тесты";
buttonGetToTest.UseVisualStyleBackColor = true;
@ -245,63 +256,21 @@
// pictureBoxTrain
//
pictureBoxTrain.Dock = DockStyle.Fill;
pictureBoxTrain.Location = new Point(0, 28);
pictureBoxTrain.Location = new Point(0, 0);
pictureBoxTrain.Margin = new Padding(3, 2, 3, 2);
pictureBoxTrain.Name = "pictureBoxTrain";
pictureBoxTrain.Size = new Size(631, 651);
pictureBoxTrain.Size = new Size(522, 490);
pictureBoxTrain.TabIndex = 1;
pictureBoxTrain.TabStop = false;
pictureBoxTrain.Click += pictureBoxTrain_Click;
//
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(853, 28);
menuStrip.TabIndex = 2;
menuStrip.Text = "menuStrip1";
//
// файлToolStripMenuItem
//
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
файлToolStripMenuItem.Name = айлToolStripMenuItem";
файлToolStripMenuItem.Size = new Size(59, 24);
файлToolStripMenuItem.Text = "Файл";
//
// saveToolStripMenuItem
//
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
saveToolStripMenuItem.Size = new Size(227, 26);
saveToolStripMenuItem.Text = "Сохранение";
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
//
// loadToolStripMenuItem
//
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
loadToolStripMenuItem.Size = new Size(227, 26);
loadToolStripMenuItem.Text = "Загрузка";
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
//
// saveFileDialog
//
saveFileDialog.Filter = "txt file|*.txt";
//
// openFileDialog
//
openFileDialog.Filter = "txt file|*.txt";
//
// FormTrainsCollection
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(853, 679);
ClientSize = new Size(704, 490);
Controls.Add(pictureBoxTrain);
Controls.Add(groupBoxTools);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Margin = new Padding(3, 2, 3, 2);
Name = "FormTrainsCollection";
Text = "FormTrainsCollection";
groupBoxTools.ResumeLayout(false);
@ -310,10 +279,7 @@
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxTrain).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -336,11 +302,5 @@
private Button buttonCreateCompany;
private Button buttonCollectionDel;
private Panel panelCompanyTools;
private MenuStrip menuStrip;
private ToolStripMenuItem файлToolStripMenuItem;
private ToolStripMenuItem saveToolStripMenuItem;
private ToolStripMenuItem loadToolStripMenuItem;
private SaveFileDialog saveFileDialog;
private OpenFileDialog openFileDialog;
}
}

View File

@ -1,5 +1,6 @@
using ProjectTrain.CollectionGenericObjects;
using ProjectTrain.Drawnings;
using System.Windows.Forms;
namespace ProjectTrain
{
@ -44,17 +45,17 @@ namespace ProjectTrain
}
/// <summary>
/// Добавление самолета в коллекцию
/// Добавление артиллерийской установки в коллекцию
/// </summary>
/// <param name="plane"></param>
private void SetTrain(DrawningTrain? plane)
/// <param name="train"></param>
private void SetTrain(DrawningTrain train)
{
if (_company == null || plane == null)
if (_company == null || train == null)
{
return;
}
if (_company + plane != -1)
if (_company + train != -1)
{
MessageBox.Show("Объект добавлен");
pictureBoxTrain.Image = _company.Show();
@ -100,24 +101,24 @@ namespace ProjectTrain
return;
}
DrawningTrain? plane = null;
DrawningTrain? train = null;
int counter = 100;
while (plane == null)
while (train == null)
{
plane = _company.GetRandomObject();
train = _company.GetRandomObject();
counter--;
if (counter <= 0)
{
break;
}
}
if (plane == null)
if (train == null)
{
return;
}
FormTrain form = new()
{
SetTrain = plane
SetTrain = train
};
form.ShowDialog();
@ -222,53 +223,8 @@ namespace ProjectTrain
}
panelCompanyTools.Enabled = true;
}
/// <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))
{
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
RerfreshListBoxItems();
}
else
{
MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void pictureBoxTrain_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -117,16 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 1</value>
</metadata>
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>145, 1</value>
</metadata>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>310, 1</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>