ИСЭбд-21 Чегодаев Александр лаб 6 простая #7

Closed
yacute wants to merge 1 commits from lab6 into lab5
10 changed files with 624 additions and 2358 deletions
Showing only changes of commit 2a4b5ecabc - Show all commits

View File

@ -13,6 +13,8 @@ namespace ProjectCruiser
where T : DrawningCruiser
where U : IMoveableObject
{
public IEnumerable<T?> GetCruiser => _collection.GetCruiser();
private readonly int _pictureWidth;
private readonly int _pictureHeight;

View File

@ -19,6 +19,12 @@ DrawningObjectCruiser>> _CruiserStorages;
private readonly int _pictureHeight;
private static readonly char _separatorForKeyValue = '|';
private readonly char _separatorRecords = ';';
private static readonly char _separatorForObject = ':';
public CruiserGenericStorage(int pictureWidth, int pictureHeight)
{
_CruiserStorages = new Dictionary<string,
@ -31,8 +37,8 @@ DrawningObjectCruiser>> _CruiserStorages;
{
if (!_CruiserStorages.ContainsKey(name))
{
var ustaCollection = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight);
_CruiserStorages.Add(name, ustaCollection);
var cruiserCollection = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight);
_CruiserStorages.Add(name, cruiserCollection);
}
}
@ -55,5 +61,87 @@ DrawningObjectCruiser>> _CruiserStorages;
return null;
}
}
public bool SaveData(string filename)
{
if (File.Exists(filename))
{
File.Delete(filename);
}
StringBuilder data = new();
foreach (KeyValuePair<string, CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>> record in _CruiserStorages)
{
StringBuilder records = new();
foreach (DrawningCruiser? elem in record.Value.GetCruiser)
{
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
}
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
}
if (data.Length == 0)
{
return false;
}
using (StreamWriter writer = new StreamWriter(filename))
{
writer.Write($"CruiserStorage{Environment.NewLine}{data}");
}
return true;
}
public bool LoadData(string filename)
{
if (!File.Exists(filename))
{
return false;
}
using (StreamReader reader = new StreamReader(filename))
{
string cheker = reader.ReadLine();
if (cheker == null)
{
return false;
}
if (!cheker.StartsWith("CruiserStorage"))
{
return false;
}
_CruiserStorages.Clear();
string strs;
bool firstinit = true;
while ((strs = reader.ReadLine()) != null)
{
if (strs == null && firstinit)
{
return false;
}
if (strs == null)
{
return false;
}
firstinit = false;
string name = strs.Split(_separatorForKeyValue)[0];
CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser> collection = new(_pictureWidth, _pictureHeight);
foreach (string data in strs.Split(_separatorForKeyValue)[1].Split(_separatorRecords))
{
DrawningCruiser? cruiser =
data?.CreateDrawningCruiser(_separatorForObject, _pictureWidth, _pictureHeight);
if (cruiser != null)
{
int? result = collection + cruiser;
if (result == null || result.Value == -1)
{
return false;
}
}
}
_CruiserStorages.Add(name, collection);
}
return true;
}
}
}
}

View File

@ -0,0 +1,51 @@
using ProjectCruiser.DrawningObjects;
using ProjectCruiser.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectCruiser
{
public static class ExtentionDrawningCruiser
{
public static DrawningCruiser? CreateDrawningCruiser(this string info, char
separatorForObject, int width, int height)
{
string[] strs = info.Split(separatorForObject);
if (strs.Length == 3)
{
return new DrawningCruiser(Convert.ToInt32(strs[0]),
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
}
else if (strs.Length == 6)
{
return new DrawningCruiserDou(Convert.ToInt32(strs[0]),
Convert.ToInt32(strs[1]),
Color.FromName(strs[2]),
Color.FromName(strs[3]),
Convert.ToBoolean(strs[4]),
Convert.ToBoolean(strs[5]), width, height);
}
return null;
}
public static string GetDataForSave(this DrawningCruiser drawningCruiser,
char separatorForCruiser)
{
var cruiser = drawningCruiser.EntityCruiser;
if (cruiser == null)
{
return string.Empty;
}
var str =
$"{cruiser.Speed}{separatorForCruiser}{cruiser.Weight}{separatorForCruiser}{cruiser.BodyColor.Name}";
if (cruiser is not EntityCruiserDou sportCruiser)
{
return str;
}
return $"{str}{separatorForCruiser}{sportCruiser.AdditionalColor.Name}{separatorForCruiser}{sportCruiser.Vert}{separatorForCruiser}{sportCruiser.Rocket}";
}
}
}

View File

@ -28,147 +28,146 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCruiser));
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
this.ButtonCreateCruiserBat = new System.Windows.Forms.Button();
this.ButtonCreateCruiser = new System.Windows.Forms.Button();
this.ButtonStep = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox();
this.ButtonSelectCruiser = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit();
this.SuspendLayout();
comboBoxStrategy = new System.Windows.Forms.ComboBox();
ButtonCreateCruiserBat = new System.Windows.Forms.Button();
ButtonCreateCruiser = new System.Windows.Forms.Button();
ButtonStep = new System.Windows.Forms.Button();
buttonUp = new System.Windows.Forms.Button();
buttonDown = new System.Windows.Forms.Button();
buttonLeft = new System.Windows.Forms.Button();
buttonRight = new System.Windows.Forms.Button();
pictureBoxCruiser = new System.Windows.Forms.PictureBox();
ButtonSelectCruiser = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(pictureBoxCruiser)).BeginInit();
SuspendLayout();
//
// comboBoxStrategy
//
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStrategy.FormattingEnabled = true;
this.comboBoxStrategy.Items.AddRange(new object[] {
comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
comboBoxStrategy.FormattingEnabled = true;
comboBoxStrategy.Items.AddRange(new object[] {
"MoveToCenter",
"MoveToBorder",
"-"});
this.comboBoxStrategy.Location = new System.Drawing.Point(667, 12);
this.comboBoxStrategy.Name = "comboBoxStrategy";
this.comboBoxStrategy.Size = new System.Drawing.Size(121, 23);
this.comboBoxStrategy.TabIndex = 0;
comboBoxStrategy.Location = new System.Drawing.Point(667, 12);
comboBoxStrategy.Name = "comboBoxStrategy";
comboBoxStrategy.Size = new System.Drawing.Size(121, 23);
comboBoxStrategy.TabIndex = 0;
//
// ButtonCreateCruiserBat
//
this.ButtonCreateCruiserBat.Location = new System.Drawing.Point(19, 386);
this.ButtonCreateCruiserBat.Name = "ButtonCreateCruiserBat";
this.ButtonCreateCruiserBat.Size = new System.Drawing.Size(160, 57);
this.ButtonCreateCruiserBat.TabIndex = 1;
this.ButtonCreateCruiserBat.Text = "Создать крейсер с ракетными шахтами и площадкой под вертолет";
this.ButtonCreateCruiserBat.UseVisualStyleBackColor = true;
this.ButtonCreateCruiserBat.Click += new System.EventHandler(this.ButtonCreateCruiserBat_Click);
ButtonCreateCruiserBat.Location = new System.Drawing.Point(19, 386);
ButtonCreateCruiserBat.Name = "ButtonCreateCruiserBat";
ButtonCreateCruiserBat.Size = new System.Drawing.Size(160, 57);
ButtonCreateCruiserBat.TabIndex = 1;
ButtonCreateCruiserBat.Text = "Создать крейсер с ракетными шахтами и площадкой под вертолет";
ButtonCreateCruiserBat.UseVisualStyleBackColor = true;
ButtonCreateCruiserBat.Click += new System.EventHandler(ButtonCreateCruiserBat_Click);
//
// ButtonCreateCruiser
//
this.ButtonCreateCruiser.Location = new System.Drawing.Point(185, 386);
this.ButtonCreateCruiser.Name = "ButtonCreateCruiser";
this.ButtonCreateCruiser.Size = new System.Drawing.Size(160, 57);
this.ButtonCreateCruiser.TabIndex = 2;
this.ButtonCreateCruiser.Text = "Создать крейсер";
this.ButtonCreateCruiser.UseVisualStyleBackColor = true;
this.ButtonCreateCruiser.Click += new System.EventHandler(this.ButtonCreateCruiser_Click);
ButtonCreateCruiser.Location = new System.Drawing.Point(185, 386);
ButtonCreateCruiser.Name = "ButtonCreateCruiser";
ButtonCreateCruiser.Size = new System.Drawing.Size(160, 57);
ButtonCreateCruiser.TabIndex = 2;
ButtonCreateCruiser.Text = "Создать крейсер";
ButtonCreateCruiser.UseVisualStyleBackColor = true;
ButtonCreateCruiser.Click += new System.EventHandler(ButtonCreateCruiser_Click);
//
// ButtonStep
//
this.ButtonStep.Location = new System.Drawing.Point(713, 50);
this.ButtonStep.Name = "ButtonStep";
this.ButtonStep.Size = new System.Drawing.Size(75, 23);
this.ButtonStep.TabIndex = 3;
this.ButtonStep.Text = "Шаг";
this.ButtonStep.UseVisualStyleBackColor = true;
this.ButtonStep.Click += new System.EventHandler(this.ButtonStep_Click);
ButtonStep.Location = new System.Drawing.Point(713, 50);
ButtonStep.Name = "ButtonStep";
ButtonStep.Size = new System.Drawing.Size(75, 23);
ButtonStep.TabIndex = 3;
ButtonStep.Text = "Шаг";
ButtonStep.UseVisualStyleBackColor = true;
ButtonStep.Click += new System.EventHandler(ButtonStep_Click);
//
// buttonUp
//
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(678, 352);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(44, 38);
this.buttonUp.TabIndex = 4;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
buttonUp.BackgroundImage = global::ProjectCruiser.Properties.Resources.вверх;
buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
buttonUp.Location = new System.Drawing.Point(678, 352);
buttonUp.Name = "buttonUp";
buttonUp.Size = new System.Drawing.Size(44, 38);
buttonUp.TabIndex = 4;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.Click += new System.EventHandler(ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(678, 395);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(44, 38);
this.buttonDown.TabIndex = 5;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
buttonDown.BackgroundImage = global::ProjectCruiser.Properties.Resources.вниз;
buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
buttonDown.Location = new System.Drawing.Point(678, 395);
buttonDown.Name = "buttonDown";
buttonDown.Size = new System.Drawing.Size(44, 38);
buttonDown.TabIndex = 5;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += new System.EventHandler(ButtonMove_Click);
//
// buttonLeft
//
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(629, 395);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(44, 38);
this.buttonLeft.TabIndex = 6;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
buttonLeft.BackgroundImage = global::ProjectCruiser.Properties.Resources.влево;
buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
buttonLeft.Location = new System.Drawing.Point(629, 395);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new System.Drawing.Size(44, 38);
buttonLeft.TabIndex = 6;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += new System.EventHandler(ButtonMove_Click);
//
// buttonRight
//
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(727, 395);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(44, 38);
this.buttonRight.TabIndex = 7;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
buttonRight.BackgroundImage = global::ProjectCruiser.Properties.Resources.вправо;
buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
buttonRight.Location = new System.Drawing.Point(727, 395);
buttonRight.Name = "buttonRight";
buttonRight.Size = new System.Drawing.Size(44, 38);
buttonRight.TabIndex = 7;
buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += new System.EventHandler(ButtonMove_Click);
//
// pictureBoxCruiser
//
this.pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxCruiser.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCruiser.Name = "pictureBoxCruiser";
this.pictureBoxCruiser.Size = new System.Drawing.Size(800, 450);
this.pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxCruiser.TabIndex = 8;
this.pictureBoxCruiser.TabStop = false;
pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
pictureBoxCruiser.Location = new System.Drawing.Point(0, 0);
pictureBoxCruiser.Name = "pictureBoxCruiser";
pictureBoxCruiser.Size = new System.Drawing.Size(800, 450);
pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
pictureBoxCruiser.TabIndex = 8;
pictureBoxCruiser.TabStop = false;
//
// ButtonSelectCruiser
//
this.ButtonSelectCruiser.Location = new System.Drawing.Point(351, 386);
this.ButtonSelectCruiser.Name = "ButtonSelectCruiser";
this.ButtonSelectCruiser.Size = new System.Drawing.Size(160, 57);
this.ButtonSelectCruiser.TabIndex = 9;
this.ButtonSelectCruiser.Text = "Выбор";
this.ButtonSelectCruiser.UseVisualStyleBackColor = true;
this.ButtonSelectCruiser.Click += new System.EventHandler(this.ButtonSelectCruiser_Click);
ButtonSelectCruiser.Location = new System.Drawing.Point(351, 386);
ButtonSelectCruiser.Name = "ButtonSelectCruiser";
ButtonSelectCruiser.Size = new System.Drawing.Size(160, 57);
ButtonSelectCruiser.TabIndex = 9;
ButtonSelectCruiser.Text = "Выбор";
ButtonSelectCruiser.UseVisualStyleBackColor = true;
ButtonSelectCruiser.Click += new System.EventHandler(ButtonSelectCruiser_Click);
//
// FormCruiser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.ButtonSelectCruiser);
this.Controls.Add(this.buttonRight);
this.Controls.Add(this.buttonLeft);
this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.ButtonStep);
this.Controls.Add(this.ButtonCreateCruiser);
this.Controls.Add(this.ButtonCreateCruiserBat);
this.Controls.Add(this.comboBoxStrategy);
this.Controls.Add(this.pictureBoxCruiser);
this.Name = "FormCruiser";
this.Text = "FormCruiser";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(800, 450);
Controls.Add(ButtonSelectCruiser);
Controls.Add(buttonRight);
Controls.Add(buttonLeft);
Controls.Add(buttonDown);
Controls.Add(buttonUp);
Controls.Add(ButtonStep);
Controls.Add(ButtonCreateCruiser);
Controls.Add(ButtonCreateCruiserBat);
Controls.Add(comboBoxStrategy);
Controls.Add(pictureBoxCruiser);
Name = "FormCruiser";
Text = "FormCruiser";
((System.ComponentModel.ISupportInitialize)(pictureBoxCruiser)).EndInit();
ResumeLayout(false);
PerformLayout();
}

File diff suppressed because it is too large Load Diff

View File

@ -28,20 +28,27 @@
/// </summary>
private void InitializeComponent()
{
groupBox1 = new GroupBox();
groupBox2 = new GroupBox();
listBoxStorage = new ListBox();
textBoxStorageName = new TextBox();
ButtonAddObject = new Button();
ButtonDelObject = new Button();
maskedTextBoxNumber = new MaskedTextBox();
ButtonRefreshCollection = new Button();
ButtonRemoveCruiser = new Button();
buttonAddCruiser = new Button();
pictureBoxCollection = new PictureBox();
groupBox1 = new System.Windows.Forms.GroupBox();
groupBox2 = new System.Windows.Forms.GroupBox();
listBoxStorage = new System.Windows.Forms.ListBox();
textBoxStorageName = new System.Windows.Forms.TextBox();
ButtonAddObject = new System.Windows.Forms.Button();
ButtonDelObject = new System.Windows.Forms.Button();
maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
ButtonRefreshCollection = new System.Windows.Forms.Button();
ButtonRemoveCruiser = new System.Windows.Forms.Button();
buttonAddCruiser = new System.Windows.Forms.Button();
pictureBoxCollection = new System.Windows.Forms.PictureBox();
menuStrip = new System.Windows.Forms.MenuStrip();
fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
openFileDialog = new System.Windows.Forms.OpenFileDialog();
saveFileDialog = new System.Windows.Forms.SaveFileDialog();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
((System.ComponentModel.ISupportInitialize)(pictureBoxCollection)).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
//
// groupBox1
@ -51,9 +58,10 @@
groupBox1.Controls.Add(ButtonRefreshCollection);
groupBox1.Controls.Add(ButtonRemoveCruiser);
groupBox1.Controls.Add(buttonAddCruiser);
groupBox1.Location = new Point(643, 12);
groupBox1.Controls.Add(menuStrip);
groupBox1.Location = new System.Drawing.Point(643, 12);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(196, 436);
groupBox1.Size = new System.Drawing.Size(196, 483);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Инструменты";
@ -64,9 +72,9 @@
groupBox2.Controls.Add(textBoxStorageName);
groupBox2.Controls.Add(ButtonAddObject);
groupBox2.Controls.Add(ButtonDelObject);
groupBox2.Location = new Point(9, 24);
groupBox2.Location = new System.Drawing.Point(9, 58);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(179, 256);
groupBox2.Size = new System.Drawing.Size(179, 256);
groupBox2.TabIndex = 4;
groupBox2.TabStop = false;
groupBox2.Text = "Наборы";
@ -75,25 +83,25 @@
//
listBoxStorage.FormattingEnabled = true;
listBoxStorage.ItemHeight = 15;
listBoxStorage.Location = new Point(6, 93);
listBoxStorage.Location = new System.Drawing.Point(6, 93);
listBoxStorage.Name = "listBoxStorage";
listBoxStorage.Size = new Size(167, 109);
listBoxStorage.Size = new System.Drawing.Size(167, 109);
listBoxStorage.TabIndex = 5;
listBoxStorage.SelectedIndexChanged += listBoxStorage_SelectedIndexChanged;
//
// textBoxStorageName
//
textBoxStorageName.Font = new Font("Lucida Sans Unicode", 9F, FontStyle.Regular, GraphicsUnit.Point);
textBoxStorageName.Location = new Point(6, 22);
textBoxStorageName.Font = new System.Drawing.Font("Lucida Sans Unicode", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
textBoxStorageName.Location = new System.Drawing.Point(6, 22);
textBoxStorageName.Name = "textBoxStorageName";
textBoxStorageName.Size = new Size(167, 26);
textBoxStorageName.Size = new System.Drawing.Size(167, 26);
textBoxStorageName.TabIndex = 4;
//
// ButtonAddObject
//
ButtonAddObject.Location = new Point(6, 54);
ButtonAddObject.Location = new System.Drawing.Point(6, 54);
ButtonAddObject.Name = "ButtonAddObject";
ButtonAddObject.Size = new Size(167, 33);
ButtonAddObject.Size = new System.Drawing.Size(167, 33);
ButtonAddObject.TabIndex = 3;
ButtonAddObject.Text = "Добавить набор";
ButtonAddObject.UseVisualStyleBackColor = true;
@ -101,9 +109,9 @@
//
// ButtonDelObject
//
ButtonDelObject.Location = new Point(6, 217);
ButtonDelObject.Location = new System.Drawing.Point(6, 217);
ButtonDelObject.Name = "ButtonDelObject";
ButtonDelObject.Size = new Size(167, 33);
ButtonDelObject.Size = new System.Drawing.Size(167, 33);
ButtonDelObject.TabIndex = 2;
ButtonDelObject.Text = "Удалить набор";
ButtonDelObject.UseVisualStyleBackColor = true;
@ -111,18 +119,18 @@
//
// maskedTextBoxNumber
//
maskedTextBoxNumber.Font = new Font("Lucida Sans Unicode", 9F, FontStyle.Regular, GraphicsUnit.Point);
maskedTextBoxNumber.Location = new Point(34, 325);
maskedTextBoxNumber.Font = new System.Drawing.Font("Lucida Sans Unicode", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
maskedTextBoxNumber.Location = new System.Drawing.Point(34, 359);
maskedTextBoxNumber.Mask = "00";
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
maskedTextBoxNumber.Size = new Size(130, 26);
maskedTextBoxNumber.Size = new System.Drawing.Size(130, 26);
maskedTextBoxNumber.TabIndex = 3;
//
// ButtonRefreshCollection
//
ButtonRefreshCollection.Location = new Point(6, 396);
ButtonRefreshCollection.Location = new System.Drawing.Point(6, 430);
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
ButtonRefreshCollection.Size = new Size(184, 33);
ButtonRefreshCollection.Size = new System.Drawing.Size(184, 33);
ButtonRefreshCollection.TabIndex = 2;
ButtonRefreshCollection.Text = "Обовить коллекцию";
ButtonRefreshCollection.UseVisualStyleBackColor = true;
@ -130,9 +138,9 @@
//
// ButtonRemoveCruiser
//
ButtonRemoveCruiser.Location = new Point(6, 357);
ButtonRemoveCruiser.Location = new System.Drawing.Point(6, 391);
ButtonRemoveCruiser.Name = "ButtonRemoveCruiser";
ButtonRemoveCruiser.Size = new Size(184, 33);
ButtonRemoveCruiser.Size = new System.Drawing.Size(184, 33);
ButtonRemoveCruiser.TabIndex = 1;
ButtonRemoveCruiser.Text = "Удалить крейсер";
ButtonRemoveCruiser.UseVisualStyleBackColor = true;
@ -140,9 +148,9 @@
//
// buttonAddCruiser
//
buttonAddCruiser.Location = new Point(6, 286);
buttonAddCruiser.Location = new System.Drawing.Point(6, 320);
buttonAddCruiser.Name = "buttonAddCruiser";
buttonAddCruiser.Size = new Size(184, 33);
buttonAddCruiser.Size = new System.Drawing.Size(184, 33);
buttonAddCruiser.TabIndex = 0;
buttonAddCruiser.Text = "Добавить крейсер";
buttonAddCruiser.UseVisualStyleBackColor = true;
@ -150,28 +158,79 @@
//
// pictureBoxCollection
//
pictureBoxCollection.Location = new Point(1, 4);
pictureBoxCollection.Location = new System.Drawing.Point(1, 4);
pictureBoxCollection.Name = "pictureBoxCollection";
pictureBoxCollection.Size = new Size(637, 449);
pictureBoxCollection.SizeMode = PictureBoxSizeMode.Zoom;
pictureBoxCollection.Size = new System.Drawing.Size(637, 491);
pictureBoxCollection.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
pictureBoxCollection.TabIndex = 1;
pictureBoxCollection.TabStop = false;
//
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
fileToolStripMenuItem});
menuStrip.Location = new System.Drawing.Point(3, 19);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(7, 3, 0, 3);
menuStrip.Size = new System.Drawing.Size(190, 24);
menuStrip.TabIndex = 5;
menuStrip.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
SaveToolStripMenuItem,
LoadToolStripMenuItem});
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
fileToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
fileToolStripMenuItem.Text = "Файл";
//
// SaveToolStripMenuItem
//
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
SaveToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
SaveToolStripMenuItem.Text = "Сохранение";
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
//
// LoadToolStripMenuItem
//
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
LoadToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
LoadToolStripMenuItem.Text = "Загрузка";
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
//
// openFileDialog
//
openFileDialog.FileName = "openFileDialog1";
openFileDialog.Filter = "txt file | *.txt";
openFileDialog.Title = "Сохранить текстовый файл";
//
// saveFileDialog
//
saveFileDialog.Filter = "txt file | *.txt";
saveFileDialog.Title = "Выберите текстовый файл";
//
// FormCruiserCollection
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(853, 460);
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(853, 536);
Controls.Add(pictureBoxCollection);
Controls.Add(groupBox1);
MainMenuStrip = menuStrip;
Margin = new Padding(3, 4, 3, 4);
Name = "FormCruiserCollection";
Text = "FormCruiserCollection";
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
((System.ComponentModel.ISupportInitialize)(pictureBoxCollection)).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
}
#endregion
@ -187,5 +246,11 @@
private TextBox textBoxStorageName;
private Button ButtonAddObject;
private Button ButtonDelObject;
private MenuStrip menuStrip;
private ToolStripMenuItem fileToolStripMenuItem;
private ToolStripMenuItem SaveToolStripMenuItem;
private ToolStripMenuItem LoadToolStripMenuItem;
private OpenFileDialog openFileDialog;
private SaveFileDialog saveFileDialog;
}
}

View File

@ -9,7 +9,7 @@ namespace ProjectCruiser
public partial class FormCruiserCollection : Form
{
private readonly CruiserGenericStorage _storage;
public FormCruiserCollection()
{
InitializeComponent();
@ -142,5 +142,37 @@ namespace ProjectCruiser
}
pictureBoxCollection.Image = obj.ShowCruiser();
}
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if (_storage.SaveData(saveFileDialog.FileName))
{
MessageBox.Show("Сохранение прошло успешно",
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Не сохранилось", "Результат",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
if (_storage.LoadData(openFileDialog.FileName))
{
MessageBox.Show("Данные успешно загружены.", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
ReloadObjects();
}
else
{
MessageBox.Show("Ошибка при загрузке данных.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
@ -117,4 +57,16 @@
<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, 17</value>
</metadata>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>281, 16</value>
</metadata>
<metadata name="$TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>74</value>
</metadata>
</root>

View File

@ -28,194 +28,194 @@
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.labelModifiedObject = new System.Windows.Forms.Label();
this.labelSimpleObject = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.panelPurple = new System.Windows.Forms.Panel();
this.panelYellow = new System.Windows.Forms.Panel();
this.panelBlack = new System.Windows.Forms.Panel();
this.panelBlue = new System.Windows.Forms.Panel();
this.panelGray = new System.Windows.Forms.Panel();
this.panelGreen = new System.Windows.Forms.Panel();
this.panelWhite = new System.Windows.Forms.Panel();
this.panelRed = new System.Windows.Forms.Panel();
this.checkBoxBodyKit = new System.Windows.Forms.CheckBox();
this.checkBoxPushka = new System.Windows.Forms.CheckBox();
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panelColor = new System.Windows.Forms.Panel();
this.labelDopColor = new System.Windows.Forms.Label();
this.labelBaseColor = new System.Windows.Forms.Label();
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
this.ButtonOk = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
this.panelColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
this.SuspendLayout();
groupBox1 = new System.Windows.Forms.GroupBox();
labelModifiedObject = new System.Windows.Forms.Label();
labelSimpleObject = new System.Windows.Forms.Label();
groupBox2 = new System.Windows.Forms.GroupBox();
panelPurple = new System.Windows.Forms.Panel();
panelYellow = new System.Windows.Forms.Panel();
panelBlack = new System.Windows.Forms.Panel();
panelBlue = new System.Windows.Forms.Panel();
panelGray = new System.Windows.Forms.Panel();
panelGreen = new System.Windows.Forms.Panel();
panelWhite = new System.Windows.Forms.Panel();
panelRed = new System.Windows.Forms.Panel();
checkBoxBodyKit = new System.Windows.Forms.CheckBox();
checkBoxPushka = new System.Windows.Forms.CheckBox();
numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
label2 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
panelColor = new System.Windows.Forms.Panel();
labelDopColor = new System.Windows.Forms.Label();
labelBaseColor = new System.Windows.Forms.Label();
pictureBoxObject = new System.Windows.Forms.PictureBox();
ButtonOk = new System.Windows.Forms.Button();
buttonCancel = new System.Windows.Forms.Button();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(numericUpDownWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(numericUpDownSpeed)).BeginInit();
panelColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(pictureBoxObject)).BeginInit();
SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.labelModifiedObject);
this.groupBox1.Controls.Add(this.labelSimpleObject);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.checkBoxBodyKit);
this.groupBox1.Controls.Add(this.checkBoxPushka);
this.groupBox1.Controls.Add(this.numericUpDownWeight);
this.groupBox1.Controls.Add(this.numericUpDownSpeed);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(454, 228);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Параметры";
groupBox1.Controls.Add(labelModifiedObject);
groupBox1.Controls.Add(labelSimpleObject);
groupBox1.Controls.Add(groupBox2);
groupBox1.Controls.Add(checkBoxBodyKit);
groupBox1.Controls.Add(checkBoxPushka);
groupBox1.Controls.Add(numericUpDownWeight);
groupBox1.Controls.Add(numericUpDownSpeed);
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(label1);
groupBox1.Location = new System.Drawing.Point(12, 12);
groupBox1.Name = "groupBox1";
groupBox1.Size = new System.Drawing.Size(454, 228);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Параметры";
//
// labelModifiedObject
//
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelModifiedObject.Location = new System.Drawing.Point(361, 146);
this.labelModifiedObject.Name = "labelModifiedObject";
this.labelModifiedObject.Size = new System.Drawing.Size(87, 27);
this.labelModifiedObject.TabIndex = 8;
this.labelModifiedObject.Text = "Продвинутый";
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
labelModifiedObject.Location = new System.Drawing.Point(361, 146);
labelModifiedObject.Name = "labelModifiedObject";
labelModifiedObject.Size = new System.Drawing.Size(87, 27);
labelModifiedObject.TabIndex = 8;
labelModifiedObject.Text = "Продвинутый";
labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelModifiedObject.MouseDown += LabelObject_MouseDown;
//
// labelSimpleObject
//
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelSimpleObject.Location = new System.Drawing.Point(263, 146);
this.labelSimpleObject.Name = "labelSimpleObject";
this.labelSimpleObject.Size = new System.Drawing.Size(87, 27);
this.labelSimpleObject.TabIndex = 7;
this.labelSimpleObject.Text = "Простой";
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
labelSimpleObject.Location = new System.Drawing.Point(263, 146);
labelSimpleObject.Name = "labelSimpleObject";
labelSimpleObject.Size = new System.Drawing.Size(87, 27);
labelSimpleObject.TabIndex = 7;
labelSimpleObject.Text = "Простой";
labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelSimpleObject.MouseDown += LabelObject_MouseDown;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.panelPurple);
this.groupBox2.Controls.Add(this.panelYellow);
this.groupBox2.Controls.Add(this.panelBlack);
this.groupBox2.Controls.Add(this.panelBlue);
this.groupBox2.Controls.Add(this.panelGray);
this.groupBox2.Controls.Add(this.panelGreen);
this.groupBox2.Controls.Add(this.panelWhite);
this.groupBox2.Controls.Add(this.panelRed);
this.groupBox2.Location = new System.Drawing.Point(263, 32);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(185, 106);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Цвета";
groupBox2.Controls.Add(panelPurple);
groupBox2.Controls.Add(panelYellow);
groupBox2.Controls.Add(panelBlack);
groupBox2.Controls.Add(panelBlue);
groupBox2.Controls.Add(panelGray);
groupBox2.Controls.Add(panelGreen);
groupBox2.Controls.Add(panelWhite);
groupBox2.Controls.Add(panelRed);
groupBox2.Location = new System.Drawing.Point(263, 32);
groupBox2.Name = "groupBox2";
groupBox2.Size = new System.Drawing.Size(185, 106);
groupBox2.TabIndex = 6;
groupBox2.TabStop = false;
groupBox2.Text = "Цвета";
//
// panelPurple
//
this.panelPurple.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.panelPurple.Location = new System.Drawing.Point(139, 63);
this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(35, 30);
this.panelPurple.TabIndex = 7;
this.panelPurple.MouseDown += panelColor_MouseDown;
panelPurple.BackColor = System.Drawing.Color.Purple;
panelPurple.Location = new System.Drawing.Point(139, 63);
panelPurple.Name = "panelPurple";
panelPurple.Size = new System.Drawing.Size(35, 30);
panelPurple.TabIndex = 7;
panelPurple.MouseDown += panelColor_MouseDown;
//
// panelYellow
//
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(139, 22);
this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(35, 30);
this.panelYellow.TabIndex = 3;
this.panelYellow.MouseDown += panelColor_MouseDown;
panelYellow.BackColor = System.Drawing.Color.Yellow;
panelYellow.Location = new System.Drawing.Point(139, 22);
panelYellow.Name = "panelYellow";
panelYellow.Size = new System.Drawing.Size(35, 30);
panelYellow.TabIndex = 3;
panelYellow.MouseDown += panelColor_MouseDown;
//
// panelBlack
//
this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.Location = new System.Drawing.Point(98, 63);
this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(35, 30);
this.panelBlack.TabIndex = 6;
this.panelBlack.MouseDown += panelColor_MouseDown;
panelBlack.BackColor = System.Drawing.Color.Black;
panelBlack.Location = new System.Drawing.Point(98, 63);
panelBlack.Name = "panelBlack";
panelBlack.Size = new System.Drawing.Size(35, 30);
panelBlack.TabIndex = 6;
panelBlack.MouseDown += panelColor_MouseDown;
//
// panelBlue
//
this.panelBlue.BackColor = System.Drawing.Color.Blue;
this.panelBlue.Location = new System.Drawing.Point(98, 22);
this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(35, 30);
this.panelBlue.TabIndex = 2;
this.panelBlue.MouseDown += panelColor_MouseDown;
panelBlue.BackColor = System.Drawing.Color.Blue;
panelBlue.Location = new System.Drawing.Point(98, 22);
panelBlue.Name = "panelBlue";
panelBlue.Size = new System.Drawing.Size(35, 30);
panelBlue.TabIndex = 2;
panelBlue.MouseDown += panelColor_MouseDown;
//
// panelGray
//
this.panelGray.BackColor = System.Drawing.Color.Gray;
this.panelGray.Location = new System.Drawing.Point(57, 63);
this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(35, 30);
this.panelGray.TabIndex = 5;
this.panelGray.MouseDown += panelColor_MouseDown;
panelGray.BackColor = System.Drawing.Color.Gray;
panelGray.Location = new System.Drawing.Point(57, 63);
panelGray.Name = "panelGray";
panelGray.Size = new System.Drawing.Size(35, 30);
panelGray.TabIndex = 5;
panelGray.MouseDown += panelColor_MouseDown;
//
// panelGreen
//
this.panelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.panelGreen.Location = new System.Drawing.Point(57, 22);
this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(35, 30);
this.panelGreen.TabIndex = 1;
this.panelGreen.MouseDown += panelColor_MouseDown;
panelGreen.BackColor = System.Drawing.Color.Green;
panelGreen.Location = new System.Drawing.Point(57, 22);
panelGreen.Name = "panelGreen";
panelGreen.Size = new System.Drawing.Size(35, 30);
panelGreen.TabIndex = 1;
panelGreen.MouseDown += panelColor_MouseDown;
//
// panelWhite
//
this.panelWhite.BackColor = System.Drawing.Color.White;
this.panelWhite.Location = new System.Drawing.Point(16, 63);
this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(35, 30);
this.panelWhite.TabIndex = 4;
this.panelWhite.MouseDown += panelColor_MouseDown;
panelWhite.BackColor = System.Drawing.Color.White;
panelWhite.Location = new System.Drawing.Point(16, 63);
panelWhite.Name = "panelWhite";
panelWhite.Size = new System.Drawing.Size(35, 30);
panelWhite.TabIndex = 4;
panelWhite.MouseDown += panelColor_MouseDown;
//
// panelRed
//
this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.Location = new System.Drawing.Point(16, 22);
this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(35, 30);
this.panelRed.TabIndex = 0;
this.panelRed.MouseDown += panelColor_MouseDown;
panelRed.BackColor = System.Drawing.Color.Red;
panelRed.Location = new System.Drawing.Point(16, 22);
panelRed.Name = "panelRed";
panelRed.Size = new System.Drawing.Size(35, 30);
panelRed.TabIndex = 0;
panelRed.MouseDown += panelColor_MouseDown;
//
// checkBoxBodyKit
//
this.checkBoxBodyKit.AutoSize = true;
this.checkBoxBodyKit.Location = new System.Drawing.Point(10, 154);
this.checkBoxBodyKit.Name = "checkBoxBodyKit";
this.checkBoxBodyKit.Size = new System.Drawing.Size(256, 19);
this.checkBoxBodyKit.TabIndex = 5;
this.checkBoxBodyKit.Text = "Признак наличия вертолетной площадки";
this.checkBoxBodyKit.UseVisualStyleBackColor = true;
checkBoxBodyKit.AutoSize = true;
checkBoxBodyKit.Location = new System.Drawing.Point(10, 154);
checkBoxBodyKit.Name = "checkBoxBodyKit";
checkBoxBodyKit.Size = new System.Drawing.Size(256, 19);
checkBoxBodyKit.TabIndex = 5;
checkBoxBodyKit.Text = "Признак наличия вертолетной площадки";
checkBoxBodyKit.UseVisualStyleBackColor = true;
//
// checkBoxPushka
//
this.checkBoxPushka.AutoSize = true;
this.checkBoxPushka.Location = new System.Drawing.Point(10, 119);
this.checkBoxPushka.Name = "checkBoxPushka";
this.checkBoxPushka.Size = new System.Drawing.Size(227, 19);
this.checkBoxPushka.TabIndex = 4;
this.checkBoxPushka.Text = "Признак наличия отсека под ракеты";
this.checkBoxPushka.UseVisualStyleBackColor = true;
checkBoxPushka.AutoSize = true;
checkBoxPushka.Location = new System.Drawing.Point(10, 119);
checkBoxPushka.Name = "checkBoxPushka";
checkBoxPushka.Size = new System.Drawing.Size(227, 19);
checkBoxPushka.TabIndex = 4;
checkBoxPushka.Text = "Признак наличия отсека под ракеты";
checkBoxPushka.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
this.numericUpDownWeight.Location = new System.Drawing.Point(76, 60);
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(73, 23);
this.numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Value = new decimal(new int[] {
numericUpDownWeight.Location = new System.Drawing.Point(76, 60);
numericUpDownWeight.Name = "numericUpDownWeight";
numericUpDownWeight.Size = new System.Drawing.Size(73, 23);
numericUpDownWeight.TabIndex = 3;
numericUpDownWeight.Value = new decimal(new int[] {
100,
0,
0,
@ -223,11 +223,11 @@
//
// numericUpDownSpeed
//
this.numericUpDownSpeed.Location = new System.Drawing.Point(76, 31);
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(73, 23);
this.numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Value = new decimal(new int[] {
numericUpDownSpeed.Location = new System.Drawing.Point(76, 31);
numericUpDownSpeed.Name = "numericUpDownSpeed";
numericUpDownSpeed.Size = new System.Drawing.Size(73, 23);
numericUpDownSpeed.TabIndex = 2;
numericUpDownSpeed.Value = new decimal(new int[] {
100,
0,
0,
@ -235,109 +235,109 @@
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 62);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Вес:";
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(10, 62);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(29, 15);
label2.TabIndex = 1;
label2.Text = "Вес:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Скорость:";
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(10, 33);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(62, 15);
label1.TabIndex = 0;
label1.Text = "Скорость:";
//
// panelColor
//
this.panelColor.AllowDrop = true;
this.panelColor.Controls.Add(this.labelDopColor);
this.panelColor.Controls.Add(this.labelBaseColor);
this.panelColor.Controls.Add(this.pictureBoxObject);
this.panelColor.Location = new System.Drawing.Point(472, 12);
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(276, 184);
this.panelColor.TabIndex = 1;
this.panelColor.DragDrop += PanelObject_DragDrop;
this.panelColor.DragEnter += PanelObject_DragEnter;
panelColor.AllowDrop = true;
panelColor.Controls.Add(labelDopColor);
panelColor.Controls.Add(labelBaseColor);
panelColor.Controls.Add(pictureBoxObject);
panelColor.Location = new System.Drawing.Point(472, 12);
panelColor.Name = "panelColor";
panelColor.Size = new System.Drawing.Size(276, 184);
panelColor.TabIndex = 1;
panelColor.DragDrop += PanelObject_DragDrop;
panelColor.DragEnter += PanelObject_DragEnter;
//
// labelDopColor
//
this.labelDopColor.AllowDrop = true;
this.labelDopColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelDopColor.Location = new System.Drawing.Point(164, 10);
this.labelDopColor.Name = "labelDopColor";
this.labelDopColor.Size = new System.Drawing.Size(100, 29);
this.labelDopColor.TabIndex = 2;
this.labelDopColor.Text = "Доп. цвет";
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelDopColor.DragDrop += LabelDopColor_DragDrop;
this.labelDopColor.DragEnter += LabelColor_DragEnter;
this.labelDopColor.MouseDown += LabelObject_MouseDown;
labelDopColor.AllowDrop = true;
labelDopColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
labelDopColor.Location = new System.Drawing.Point(164, 10);
labelDopColor.Name = "labelDopColor";
labelDopColor.Size = new System.Drawing.Size(100, 29);
labelDopColor.TabIndex = 2;
labelDopColor.Text = "Доп. цвет";
labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelDopColor.DragDrop += LabelDopColor_DragDrop;
labelDopColor.DragEnter += LabelColor_DragEnter;
labelDopColor.MouseDown += LabelObject_MouseDown;
//
// labelBaseColor
//
this.labelBaseColor.AllowDrop = true;
this.labelBaseColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelBaseColor.Location = new System.Drawing.Point(12, 10);
this.labelBaseColor.Name = "labelBaseColor";
this.labelBaseColor.Size = new System.Drawing.Size(100, 29);
this.labelBaseColor.TabIndex = 2;
this.labelBaseColor.Text = "Цвет";
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelBaseColor.DragDrop += LabelBaseColor_DragDrop;
this.labelBaseColor.DragEnter += LabelColor_DragEnter;
this.labelBaseColor.MouseDown += LabelObject_MouseDown;
labelBaseColor.AllowDrop = true;
labelBaseColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
labelBaseColor.Location = new System.Drawing.Point(12, 10);
labelBaseColor.Name = "labelBaseColor";
labelBaseColor.Size = new System.Drawing.Size(100, 29);
labelBaseColor.TabIndex = 2;
labelBaseColor.Text = "Цвет";
labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelBaseColor.DragDrop += LabelBaseColor_DragDrop;
labelBaseColor.DragEnter += LabelColor_DragEnter;
labelBaseColor.MouseDown += LabelObject_MouseDown;
//
// pictureBoxObject
//
this.pictureBoxObject.Location = new System.Drawing.Point(12, 46);
this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(252, 127);
this.pictureBoxObject.TabIndex = 0;
this.pictureBoxObject.TabStop = false;
pictureBoxObject.Location = new System.Drawing.Point(12, 46);
pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new System.Drawing.Size(252, 127);
pictureBoxObject.TabIndex = 0;
pictureBoxObject.TabStop = false;
//
// ButtonOk
//
this.ButtonOk.Location = new System.Drawing.Point(484, 208);
this.ButtonOk.Name = "ButtonOk";
this.ButtonOk.Size = new System.Drawing.Size(100, 32);
this.ButtonOk.TabIndex = 2;
this.ButtonOk.Text = "Добавить";
this.ButtonOk.UseVisualStyleBackColor = true;
this.ButtonOk.Click += ButtonOk_Click;
ButtonOk.Location = new System.Drawing.Point(484, 208);
ButtonOk.Name = "ButtonOk";
ButtonOk.Size = new System.Drawing.Size(100, 32);
ButtonOk.TabIndex = 2;
ButtonOk.Text = "Добавить";
ButtonOk.UseVisualStyleBackColor = true;
ButtonOk.Click += ButtonOk_Click;
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(636, 208);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(100, 32);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Location = new System.Drawing.Point(636, 208);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new System.Drawing.Size(100, 32);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
//
// FormCruiserConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 252);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.ButtonOk);
this.Controls.Add(this.panelColor);
this.Controls.Add(this.groupBox1);
this.Name = "FormCruiserConfig";
this.Text = "FormLincornConfig";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
this.panelColor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
this.ResumeLayout(false);
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(800, 252);
Controls.Add(buttonCancel);
Controls.Add(ButtonOk);
Controls.Add(panelColor);
Controls.Add(groupBox1);
Name = "FormCruiserConfig";
Text = "FormCruiserConfig";
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(numericUpDownWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(numericUpDownSpeed)).EndInit();
panelColor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(pictureBoxObject)).EndInit();
ResumeLayout(false);
}

View File

@ -9,7 +9,6 @@ namespace ProjectCruiser.Generics
internal class SetGeneric<T>
where T : class
{
private readonly List<T?> _places;
public int Count => _places.Count;