This commit is contained in:
Александр Чегодаев 2023-12-22 17:20:59 +04:00
parent aeb998110e
commit 2a4b5ecabc
10 changed files with 624 additions and 2358 deletions

View File

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

View File

@ -19,6 +19,12 @@ DrawningObjectCruiser>> _CruiserStorages;
private readonly int _pictureHeight; private readonly int _pictureHeight;
private static readonly char _separatorForKeyValue = '|';
private readonly char _separatorRecords = ';';
private static readonly char _separatorForObject = ':';
public CruiserGenericStorage(int pictureWidth, int pictureHeight) public CruiserGenericStorage(int pictureWidth, int pictureHeight)
{ {
_CruiserStorages = new Dictionary<string, _CruiserStorages = new Dictionary<string,
@ -31,8 +37,8 @@ DrawningObjectCruiser>> _CruiserStorages;
{ {
if (!_CruiserStorages.ContainsKey(name)) if (!_CruiserStorages.ContainsKey(name))
{ {
var ustaCollection = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight); var cruiserCollection = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight);
_CruiserStorages.Add(name, ustaCollection); _CruiserStorages.Add(name, cruiserCollection);
} }
} }
@ -55,5 +61,87 @@ DrawningObjectCruiser>> _CruiserStorages;
return null; 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> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCruiser)); comboBoxStrategy = new System.Windows.Forms.ComboBox();
this.comboBoxStrategy = new System.Windows.Forms.ComboBox(); ButtonCreateCruiserBat = new System.Windows.Forms.Button();
this.ButtonCreateCruiserBat = new System.Windows.Forms.Button(); ButtonCreateCruiser = new System.Windows.Forms.Button();
this.ButtonCreateCruiser = new System.Windows.Forms.Button(); ButtonStep = new System.Windows.Forms.Button();
this.ButtonStep = new System.Windows.Forms.Button(); buttonUp = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button(); buttonDown = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button(); buttonLeft = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button(); buttonRight = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button(); pictureBoxCruiser = new System.Windows.Forms.PictureBox();
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox(); ButtonSelectCruiser = new System.Windows.Forms.Button();
this.ButtonSelectCruiser = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(pictureBoxCruiser)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit(); SuspendLayout();
this.SuspendLayout();
// //
// comboBoxStrategy // comboBoxStrategy
// //
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStrategy.FormattingEnabled = true; comboBoxStrategy.FormattingEnabled = true;
this.comboBoxStrategy.Items.AddRange(new object[] { comboBoxStrategy.Items.AddRange(new object[] {
"MoveToCenter", "MoveToCenter",
"MoveToBorder", "MoveToBorder",
"-"}); "-"});
this.comboBoxStrategy.Location = new System.Drawing.Point(667, 12); comboBoxStrategy.Location = new System.Drawing.Point(667, 12);
this.comboBoxStrategy.Name = "comboBoxStrategy"; comboBoxStrategy.Name = "comboBoxStrategy";
this.comboBoxStrategy.Size = new System.Drawing.Size(121, 23); comboBoxStrategy.Size = new System.Drawing.Size(121, 23);
this.comboBoxStrategy.TabIndex = 0; comboBoxStrategy.TabIndex = 0;
// //
// ButtonCreateCruiserBat // ButtonCreateCruiserBat
// //
this.ButtonCreateCruiserBat.Location = new System.Drawing.Point(19, 386); ButtonCreateCruiserBat.Location = new System.Drawing.Point(19, 386);
this.ButtonCreateCruiserBat.Name = "ButtonCreateCruiserBat"; ButtonCreateCruiserBat.Name = "ButtonCreateCruiserBat";
this.ButtonCreateCruiserBat.Size = new System.Drawing.Size(160, 57); ButtonCreateCruiserBat.Size = new System.Drawing.Size(160, 57);
this.ButtonCreateCruiserBat.TabIndex = 1; ButtonCreateCruiserBat.TabIndex = 1;
this.ButtonCreateCruiserBat.Text = "Создать крейсер с ракетными шахтами и площадкой под вертолет"; ButtonCreateCruiserBat.Text = "Создать крейсер с ракетными шахтами и площадкой под вертолет";
this.ButtonCreateCruiserBat.UseVisualStyleBackColor = true; ButtonCreateCruiserBat.UseVisualStyleBackColor = true;
this.ButtonCreateCruiserBat.Click += new System.EventHandler(this.ButtonCreateCruiserBat_Click); ButtonCreateCruiserBat.Click += new System.EventHandler(ButtonCreateCruiserBat_Click);
// //
// ButtonCreateCruiser // ButtonCreateCruiser
// //
this.ButtonCreateCruiser.Location = new System.Drawing.Point(185, 386); ButtonCreateCruiser.Location = new System.Drawing.Point(185, 386);
this.ButtonCreateCruiser.Name = "ButtonCreateCruiser"; ButtonCreateCruiser.Name = "ButtonCreateCruiser";
this.ButtonCreateCruiser.Size = new System.Drawing.Size(160, 57); ButtonCreateCruiser.Size = new System.Drawing.Size(160, 57);
this.ButtonCreateCruiser.TabIndex = 2; ButtonCreateCruiser.TabIndex = 2;
this.ButtonCreateCruiser.Text = "Создать крейсер"; ButtonCreateCruiser.Text = "Создать крейсер";
this.ButtonCreateCruiser.UseVisualStyleBackColor = true; ButtonCreateCruiser.UseVisualStyleBackColor = true;
this.ButtonCreateCruiser.Click += new System.EventHandler(this.ButtonCreateCruiser_Click); ButtonCreateCruiser.Click += new System.EventHandler(ButtonCreateCruiser_Click);
// //
// ButtonStep // ButtonStep
// //
this.ButtonStep.Location = new System.Drawing.Point(713, 50); ButtonStep.Location = new System.Drawing.Point(713, 50);
this.ButtonStep.Name = "ButtonStep"; ButtonStep.Name = "ButtonStep";
this.ButtonStep.Size = new System.Drawing.Size(75, 23); ButtonStep.Size = new System.Drawing.Size(75, 23);
this.ButtonStep.TabIndex = 3; ButtonStep.TabIndex = 3;
this.ButtonStep.Text = "Шаг"; ButtonStep.Text = "Шаг";
this.ButtonStep.UseVisualStyleBackColor = true; ButtonStep.UseVisualStyleBackColor = true;
this.ButtonStep.Click += new System.EventHandler(this.ButtonStep_Click); ButtonStep.Click += new System.EventHandler(ButtonStep_Click);
// //
// buttonUp // buttonUp
// //
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage"))); buttonUp.BackgroundImage = global::ProjectCruiser.Properties.Resources.вверх;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(678, 352); buttonUp.Location = new System.Drawing.Point(678, 352);
this.buttonUp.Name = "buttonUp"; buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(44, 38); buttonUp.Size = new System.Drawing.Size(44, 38);
this.buttonUp.TabIndex = 4; buttonUp.TabIndex = 4;
this.buttonUp.UseVisualStyleBackColor = true; buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); buttonUp.Click += new System.EventHandler(ButtonMove_Click);
// //
// buttonDown // buttonDown
// //
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage"))); buttonDown.BackgroundImage = global::ProjectCruiser.Properties.Resources.вниз;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(678, 395); buttonDown.Location = new System.Drawing.Point(678, 395);
this.buttonDown.Name = "buttonDown"; buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(44, 38); buttonDown.Size = new System.Drawing.Size(44, 38);
this.buttonDown.TabIndex = 5; buttonDown.TabIndex = 5;
this.buttonDown.UseVisualStyleBackColor = true; buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); buttonDown.Click += new System.EventHandler(ButtonMove_Click);
// //
// buttonLeft // buttonLeft
// //
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage"))); buttonLeft.BackgroundImage = global::ProjectCruiser.Properties.Resources.влево;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(629, 395); buttonLeft.Location = new System.Drawing.Point(629, 395);
this.buttonLeft.Name = "buttonLeft"; buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(44, 38); buttonLeft.Size = new System.Drawing.Size(44, 38);
this.buttonLeft.TabIndex = 6; buttonLeft.TabIndex = 6;
this.buttonLeft.UseVisualStyleBackColor = true; buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click); buttonLeft.Click += new System.EventHandler(ButtonMove_Click);
// //
// buttonRight // buttonRight
// //
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage"))); buttonRight.BackgroundImage = global::ProjectCruiser.Properties.Resources.вправо;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(727, 395); buttonRight.Location = new System.Drawing.Point(727, 395);
this.buttonRight.Name = "buttonRight"; buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(44, 38); buttonRight.Size = new System.Drawing.Size(44, 38);
this.buttonRight.TabIndex = 7; buttonRight.TabIndex = 7;
this.buttonRight.UseVisualStyleBackColor = true; buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click); buttonRight.Click += new System.EventHandler(ButtonMove_Click);
// //
// pictureBoxCruiser // pictureBoxCruiser
// //
this.pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill; pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxCruiser.Location = new System.Drawing.Point(0, 0); pictureBoxCruiser.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCruiser.Name = "pictureBoxCruiser"; pictureBoxCruiser.Name = "pictureBoxCruiser";
this.pictureBoxCruiser.Size = new System.Drawing.Size(800, 450); pictureBoxCruiser.Size = new System.Drawing.Size(800, 450);
this.pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxCruiser.TabIndex = 8; pictureBoxCruiser.TabIndex = 8;
this.pictureBoxCruiser.TabStop = false; pictureBoxCruiser.TabStop = false;
// //
// ButtonSelectCruiser // ButtonSelectCruiser
// //
this.ButtonSelectCruiser.Location = new System.Drawing.Point(351, 386); ButtonSelectCruiser.Location = new System.Drawing.Point(351, 386);
this.ButtonSelectCruiser.Name = "ButtonSelectCruiser"; ButtonSelectCruiser.Name = "ButtonSelectCruiser";
this.ButtonSelectCruiser.Size = new System.Drawing.Size(160, 57); ButtonSelectCruiser.Size = new System.Drawing.Size(160, 57);
this.ButtonSelectCruiser.TabIndex = 9; ButtonSelectCruiser.TabIndex = 9;
this.ButtonSelectCruiser.Text = "Выбор"; ButtonSelectCruiser.Text = "Выбор";
this.ButtonSelectCruiser.UseVisualStyleBackColor = true; ButtonSelectCruiser.UseVisualStyleBackColor = true;
this.ButtonSelectCruiser.Click += new System.EventHandler(this.ButtonSelectCruiser_Click); ButtonSelectCruiser.Click += new System.EventHandler(ButtonSelectCruiser_Click);
// //
// FormCruiser // FormCruiser
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.ButtonSelectCruiser); Controls.Add(ButtonSelectCruiser);
this.Controls.Add(this.buttonRight); Controls.Add(buttonRight);
this.Controls.Add(this.buttonLeft); Controls.Add(buttonLeft);
this.Controls.Add(this.buttonDown); Controls.Add(buttonDown);
this.Controls.Add(this.buttonUp); Controls.Add(buttonUp);
this.Controls.Add(this.ButtonStep); Controls.Add(ButtonStep);
this.Controls.Add(this.ButtonCreateCruiser); Controls.Add(ButtonCreateCruiser);
this.Controls.Add(this.ButtonCreateCruiserBat); Controls.Add(ButtonCreateCruiserBat);
this.Controls.Add(this.comboBoxStrategy); Controls.Add(comboBoxStrategy);
this.Controls.Add(this.pictureBoxCruiser); Controls.Add(pictureBoxCruiser);
this.Name = "FormCruiser"; Name = "FormCruiser";
this.Text = "FormCruiser"; Text = "FormCruiser";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit(); ((System.ComponentModel.ISupportInitialize)(pictureBoxCruiser)).EndInit();
this.ResumeLayout(false); ResumeLayout(false);
this.PerformLayout(); PerformLayout();
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -142,5 +142,37 @@ namespace ProjectCruiser
} }
pictureBoxCollection.Image = obj.ShowCruiser(); 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>
<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.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
@ -117,4 +57,16 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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> </root>

View File

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

View File

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