Compare commits

...

2 Commits

Author SHA1 Message Date
eb17902171 лаб7 2024-10-22 13:26:55 +04:00
e22da57340 wip 7 2024-10-02 10:44:28 +04:00
16 changed files with 211 additions and 142 deletions

View File

@ -82,10 +82,14 @@ public abstract class AbstractCompany
SetObjectsPosition(); SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i) for (int i = 0; i < (_collection?.Count ?? 0); ++i)
{
try
{ {
DrawningTrackedVehicle? obj = _collection?.Get(i); DrawningTrackedVehicle? obj = _collection?.Get(i);
obj?.DrawTransport(graphics); obj?.DrawTransport(graphics);
} }
catch (Exception) { }
}
return bitmap; return bitmap;
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,6 @@ public interface ICollectionGenericObjects<T>
/// Получение типа коллекции /// Получение типа коллекции
/// </summary> /// </summary>
CollectionType GetCollectionType { get; } CollectionType GetCollectionType { get; }
int SetMaxCount { get; set; }
/// <summary> /// <summary>
/// Получение объектов коллекции по одному /// Получение объектов коллекции по одному

View File

@ -178,7 +178,7 @@ public class StorageCollection<T>
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set) foreach (string elem in set)
{ {
if (elem?.CreateDrawningEntityFighter() is T fighter) if (elem?.CreateDrawningTrackedVehicle() is T fighter)
{ {
try try
{ {

View File

@ -13,11 +13,6 @@ public class TrackedVehicleSharingService : AbstractCompany
{ {
} }
internal static int getAmountOfObjects()
{
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// Вывод заднего фона /// Вывод заднего фона
/// </summary> /// </summary>
@ -47,11 +42,12 @@ public class TrackedVehicleSharingService : AbstractCompany
int curHeight = 0; int curHeight = 0;
for (int i = 0; i < (_collection?.Count ?? 0); i++) for (int i = 0; i < (_collection?.Count ?? 0); i++)
{ {
if (_collection.Get(i) != null) try
{ {
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight); _collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 45, curHeight * _placeSizeHeight + 30); _collection?.Get(i)?.SetPosition(_placeSizeWidth * curWidth+28, curHeight * _placeSizeHeight + 28);
} }
catch (Exception) { }
if (curWidth > 0) if (curWidth > 0)
curWidth--; curWidth--;
else else

View File

@ -1,4 +1,5 @@
using lab1.Entities; using lab1.Entities;
namespace lab1.Drawnings; namespace lab1.Drawnings;
/// <summary> /// <summary>
@ -21,6 +22,12 @@ public class DrawningEntityFighter : DrawningTrackedVehicle
} }
public DrawningEntityFighter(EntityFighter fighter) : base(91, 65)
{
EntityTrackedVehicle = new EntityFighter(fighter.Speed, fighter.Weight, fighter.BodyColor, fighter.AdditionalColor, fighter.Kovsh, fighter.Otval);
}
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
{ {
if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityFighter fighter || !_startPosX.HasValue || !_startPosY.HasValue) if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityFighter fighter || !_startPosX.HasValue || !_startPosY.HasValue)

View File

@ -34,7 +34,6 @@ public class DrawningTrackedVehicle
/// Верхняя координата прорисовки истребителя /// Верхняя координата прорисовки истребителя
/// </summary> /// </summary>
protected int? _startPosY; protected int? _startPosY;
private EntityTrackedVehicle fighter;
/// <summary> /// <summary>
/// Ширина прорисовки истребителя /// Ширина прорисовки истребителя
@ -107,9 +106,9 @@ public class DrawningTrackedVehicle
} }
public DrawningTrackedVehicle(EntityTrackedVehicle fighter) public DrawningTrackedVehicle(EntityTrackedVehicle fighter): this()
{ {
this.fighter = fighter; EntityTrackedVehicle = new EntityTrackedVehicle(fighter.Speed, fighter.Weight, fighter.BodyColor);
} }

View File

@ -18,13 +18,13 @@ public static class ExtentionDrawningTrackedVehicle
/// </summary> /// </summary>
/// <param name="info">Строка с данными для создания объекта</param> /// <param name="info">Строка с данными для создания объекта</param>
/// <returns>Объект</returns> /// <returns>Объект</returns>
public static DrawningTrackedVehicle? CreateDrawningEntityFighter(this string info) public static DrawningTrackedVehicle? CreateDrawningTrackedVehicle(this string info)
{ {
string[] strs = info.Split(_separatorForObject); string[] strs = info.Split(_separatorForObject);
EntityTrackedVehicle? fighter = EntityFighter.CreateEntityFighter(strs); EntityTrackedVehicle? fighter = EntityFighter.CreateEntityStormtrooper(strs);
if (fighter != null) if (fighter != null)
{ {
return new DrawingEntityFighter((EntityFighter)fighter); return new DrawningEntityFighter((EntityFighter)fighter);
} }
fighter = EntityTrackedVehicle.CreateEntityTrackedVehicle(strs); fighter = EntityTrackedVehicle.CreateEntityTrackedVehicle(strs);
@ -50,10 +50,3 @@ public static class ExtentionDrawningTrackedVehicle
return string.Join(_separatorForObject, array); return string.Join(_separatorForObject, array);
} }
} }
internal class DrawingEntityFighter : DrawningTrackedVehicle
{
public DrawingEntityFighter(EntityTrackedVehicle fighter) : base(fighter)
{
}
}

View File

@ -68,11 +68,6 @@ public class EntityFighter : EntityTrackedVehicle
} }
return new EntityFighter(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6])); return new EntityFighter(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
} }
internal static EntityTrackedVehicle? CreateEntityFighter(string[] strs)
{
throw new NotImplementedException();
}
} }

View File

@ -43,8 +43,6 @@ public class EntityTrackedVehicle
Speed = speed; Speed = speed;
Weight = weight; Weight = weight;
BodyColor = bodyColor; BodyColor = bodyColor;
} }
/// <summary> /// <summary>
@ -61,7 +59,7 @@ public class EntityTrackedVehicle
/// </summary> /// </summary>
/// <param name="strs"></param> /// <param name="strs"></param>
/// <returns></returns> /// <returns></returns>
public static EntityTrackedVehicle? CreateEntityBaseStormtrooper(string[] strs) internal static EntityTrackedVehicle? CreateEntityTrackedVehicle(string[] strs)
{ {
if (strs.Length != 4 || strs[0] != nameof(EntityTrackedVehicle)) if (strs.Length != 4 || strs[0] != nameof(EntityTrackedVehicle))
{ {
@ -69,9 +67,4 @@ public class EntityTrackedVehicle
} }
return new EntityTrackedVehicle(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3])); return new EntityTrackedVehicle(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
} }
internal static EntityTrackedVehicle? CreateEntityTrackedVehicle(string[] strs)
{
throw new NotImplementedException();
}
} }

View File

@ -66,9 +66,11 @@
groupBoxTools.Controls.Add(panelStorage); groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(635, 33); groupBoxTools.Location = new Point(652, 24);
groupBoxTools.Margin = new Padding(2);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(297, 582); groupBoxTools.Padding = new Padding(2);
groupBoxTools.Size = new Size(208, 490);
groupBoxTools.TabIndex = 0; groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
@ -81,17 +83,19 @@
panelCompanyTools.Controls.Add(buttonGoToCheck); panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Controls.Add(buttonRemoveTrackedVehicle); panelCompanyTools.Controls.Add(buttonRemoveTrackedVehicle);
panelCompanyTools.Enabled = false; panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 338); panelCompanyTools.Location = new Point(5, 302);
panelCompanyTools.Margin = new Padding(2);
panelCompanyTools.Name = "panelCompanyTools"; panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(282, 273); panelCompanyTools.Size = new Size(197, 184);
panelCompanyTools.TabIndex = 10; panelCompanyTools.TabIndex = 10;
// //
// buttonAddTrackedVehicle // buttonAddTrackedVehicle
// //
buttonAddTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; buttonAddTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddTrackedVehicle.Location = new Point(6, 0); buttonAddTrackedVehicle.Location = new Point(3, 2);
buttonAddTrackedVehicle.Margin = new Padding(2);
buttonAddTrackedVehicle.Name = "buttonAddTrackedVehicle"; buttonAddTrackedVehicle.Name = "buttonAddTrackedVehicle";
buttonAddTrackedVehicle.Size = new Size(273, 63); buttonAddTrackedVehicle.Size = new Size(191, 38);
buttonAddTrackedVehicle.TabIndex = 3; buttonAddTrackedVehicle.TabIndex = 3;
buttonAddTrackedVehicle.Text = "Добавление гусеничной машины"; buttonAddTrackedVehicle.Text = "Добавление гусеничной машины";
buttonAddTrackedVehicle.UseVisualStyleBackColor = true; buttonAddTrackedVehicle.UseVisualStyleBackColor = true;
@ -100,9 +104,10 @@
// buttonRefresh // buttonRefresh
// //
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(3, 244); buttonRefresh.Location = new Point(3, 146);
buttonRefresh.Margin = new Padding(2);
buttonRefresh.Name = "buttonRefresh"; buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(272, 31); buttonRefresh.Size = new Size(190, 29);
buttonRefresh.TabIndex = 7; buttonRefresh.TabIndex = 7;
buttonRefresh.Text = "Обновить"; buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.UseVisualStyleBackColor = true;
@ -110,10 +115,11 @@
// //
// maskedTextBox // maskedTextBox
// //
maskedTextBox.Location = new Point(3, 124); maskedTextBox.Location = new Point(4, 44);
maskedTextBox.Margin = new Padding(2);
maskedTextBox.Mask = "00"; maskedTextBox.Mask = "00";
maskedTextBox.Name = "maskedTextBox"; maskedTextBox.Name = "maskedTextBox";
maskedTextBox.Size = new Size(284, 31); maskedTextBox.Size = new Size(191, 23);
maskedTextBox.TabIndex = 4; maskedTextBox.TabIndex = 4;
maskedTextBox.ValidatingType = typeof(int); maskedTextBox.ValidatingType = typeof(int);
maskedTextBox.MaskInputRejected += maskedTextBox1_MaskInputRejected; maskedTextBox.MaskInputRejected += maskedTextBox1_MaskInputRejected;
@ -121,9 +127,10 @@
// buttonGoToCheck // buttonGoToCheck
// //
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(7, 205); buttonGoToCheck.Location = new Point(4, 104);
buttonGoToCheck.Margin = new Padding(2);
buttonGoToCheck.Name = "buttonGoToCheck"; buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(274, 33); buttonGoToCheck.Size = new Size(192, 38);
buttonGoToCheck.TabIndex = 6; buttonGoToCheck.TabIndex = 6;
buttonGoToCheck.Text = "Передать на тесты"; buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true; buttonGoToCheck.UseVisualStyleBackColor = true;
@ -132,9 +139,10 @@
// buttonRemoveTrackedVehicle // buttonRemoveTrackedVehicle
// //
buttonRemoveTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; buttonRemoveTrackedVehicle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveTrackedVehicle.Location = new Point(7, 161); buttonRemoveTrackedVehicle.Location = new Point(1, 71);
buttonRemoveTrackedVehicle.Margin = new Padding(2);
buttonRemoveTrackedVehicle.Name = "buttonRemoveTrackedVehicle"; buttonRemoveTrackedVehicle.Name = "buttonRemoveTrackedVehicle";
buttonRemoveTrackedVehicle.Size = new Size(274, 38); buttonRemoveTrackedVehicle.Size = new Size(192, 29);
buttonRemoveTrackedVehicle.TabIndex = 5; buttonRemoveTrackedVehicle.TabIndex = 5;
buttonRemoveTrackedVehicle.Text = "Удаление гусеничной машины"; buttonRemoveTrackedVehicle.Text = "Удаление гусеничной машины";
buttonRemoveTrackedVehicle.UseVisualStyleBackColor = true; buttonRemoveTrackedVehicle.UseVisualStyleBackColor = true;
@ -142,9 +150,10 @@
// //
// button1CreateCompany // button1CreateCompany
// //
button1CreateCompany.Location = new Point(6, 298); button1CreateCompany.Location = new Point(7, 269);
button1CreateCompany.Margin = new Padding(2);
button1CreateCompany.Name = "button1CreateCompany"; button1CreateCompany.Name = "button1CreateCompany";
button1CreateCompany.Size = new Size(276, 34); button1CreateCompany.Size = new Size(193, 29);
button1CreateCompany.TabIndex = 9; button1CreateCompany.TabIndex = 9;
button1CreateCompany.Text = "Создать компанию"; button1CreateCompany.Text = "Создать компанию";
button1CreateCompany.UseVisualStyleBackColor = true; button1CreateCompany.UseVisualStyleBackColor = true;
@ -160,16 +169,18 @@
panelStorage.Controls.Add(textBoxCollectionName); panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName); panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top; panelStorage.Dock = DockStyle.Top;
panelStorage.Location = new Point(3, 27); panelStorage.Location = new Point(2, 18);
panelStorage.Margin = new Padding(2);
panelStorage.Name = "panelStorage"; panelStorage.Name = "panelStorage";
panelStorage.Size = new Size(291, 226); panelStorage.Size = new Size(204, 220);
panelStorage.TabIndex = 8; panelStorage.TabIndex = 8;
// //
// buttonCollectionDel // buttonCollectionDel
// //
buttonCollectionDel.Location = new Point(3, 189); buttonCollectionDel.Location = new Point(6, 183);
buttonCollectionDel.Margin = new Padding(2);
buttonCollectionDel.Name = "buttonCollectionDel"; buttonCollectionDel.Name = "buttonCollectionDel";
buttonCollectionDel.Size = new Size(276, 34); buttonCollectionDel.Size = new Size(193, 35);
buttonCollectionDel.TabIndex = 6; buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию"; buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true; buttonCollectionDel.UseVisualStyleBackColor = true;
@ -178,17 +189,19 @@
// listBoxCollection // listBoxCollection
// //
listBoxCollection.FormattingEnabled = true; listBoxCollection.FormattingEnabled = true;
listBoxCollection.ItemHeight = 25; listBoxCollection.ItemHeight = 15;
listBoxCollection.Location = new Point(6, 154); listBoxCollection.Location = new Point(7, 130);
listBoxCollection.Margin = new Padding(2);
listBoxCollection.Name = "listBoxCollection"; listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(276, 29); listBoxCollection.Size = new Size(191, 49);
listBoxCollection.TabIndex = 5; listBoxCollection.TabIndex = 5;
// //
// buttonCollectionAdd // buttonCollectionAdd
// //
buttonCollectionAdd.Location = new Point(6, 114); buttonCollectionAdd.Location = new Point(7, 75);
buttonCollectionAdd.Margin = new Padding(2);
buttonCollectionAdd.Name = "buttonCollectionAdd"; buttonCollectionAdd.Name = "buttonCollectionAdd";
buttonCollectionAdd.Size = new Size(276, 34); buttonCollectionAdd.Size = new Size(193, 32);
buttonCollectionAdd.TabIndex = 4; buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добавить коллекцию"; buttonCollectionAdd.Text = "Добавить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true; buttonCollectionAdd.UseVisualStyleBackColor = true;
@ -197,9 +210,10 @@
// radioButtonList // radioButtonList
// //
radioButtonList.AutoSize = true; radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(153, 79); radioButtonList.Location = new Point(109, 52);
radioButtonList.Margin = new Padding(2);
radioButtonList.Name = "radioButtonList"; radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(96, 29); radioButtonList.Size = new Size(66, 19);
radioButtonList.TabIndex = 3; radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true; radioButtonList.TabStop = true;
radioButtonList.Text = "Список"; radioButtonList.Text = "Список";
@ -208,9 +222,10 @@
// radioButtonMassive // radioButtonMassive
// //
radioButtonMassive.AutoSize = true; radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(41, 79); radioButtonMassive.Location = new Point(29, 52);
radioButtonMassive.Margin = new Padding(2);
radioButtonMassive.Name = "radioButtonMassive"; radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(98, 29); radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.TabIndex = 2; radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true; radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив"; radioButtonMassive.Text = "Массив";
@ -219,17 +234,19 @@
// //
// textBoxCollectionName // textBoxCollectionName
// //
textBoxCollectionName.Location = new Point(4, 42); textBoxCollectionName.Location = new Point(3, 25);
textBoxCollectionName.Margin = new Padding(2);
textBoxCollectionName.Name = "textBoxCollectionName"; textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(278, 31); textBoxCollectionName.Size = new Size(196, 23);
textBoxCollectionName.TabIndex = 1; textBoxCollectionName.TabIndex = 1;
// //
// labelCollectionName // labelCollectionName
// //
labelCollectionName.AutoSize = true; labelCollectionName.AutoSize = true;
labelCollectionName.Location = new Point(41, 14); labelCollectionName.Location = new Point(29, 8);
labelCollectionName.Margin = new Padding(2, 0, 2, 0);
labelCollectionName.Name = "labelCollectionName"; labelCollectionName.Name = "labelCollectionName";
labelCollectionName.Size = new Size(186, 25); labelCollectionName.Size = new Size(125, 15);
labelCollectionName.TabIndex = 0; labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции:"; labelCollectionName.Text = "Название коллекции:";
// //
@ -239,18 +256,20 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(3, 259); comboBoxSelectorCompany.Location = new Point(7, 242);
comboBoxSelectorCompany.Margin = new Padding(2);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(284, 33); comboBoxSelectorCompany.Size = new Size(194, 23);
comboBoxSelectorCompany.TabIndex = 1; comboBoxSelectorCompany.TabIndex = 1;
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged; comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
// //
// pictureBox // pictureBox
// //
pictureBox.Dock = DockStyle.Fill; pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 33); pictureBox.Location = new Point(0, 24);
pictureBox.Margin = new Padding(2);
pictureBox.Name = "pictureBox"; pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(635, 582); pictureBox.Size = new Size(652, 490);
pictureBox.TabIndex = 1; pictureBox.TabIndex = 1;
pictureBox.TabStop = false; pictureBox.TabStop = false;
pictureBox.Click += pictureBox1_Click; pictureBox.Click += pictureBox1_Click;
@ -261,7 +280,8 @@
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(932, 33); menuStrip.Padding = new Padding(4, 1, 0, 1);
menuStrip.Size = new Size(860, 24);
menuStrip.TabIndex = 2; menuStrip.TabIndex = 2;
menuStrip.Text = "menuStrip1"; menuStrip.Text = "menuStrip1";
// //
@ -269,14 +289,14 @@
// //
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem }); файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem });
файлToolStripMenuItem.Name = айлToolStripMenuItem"; файлToolStripMenuItem.Name = айлToolStripMenuItem";
файлToolStripMenuItem.Size = new Size(69, 29); файлToolStripMenuItem.Size = new Size(48, 22);
файлToolStripMenuItem.Text = "Файл"; файлToolStripMenuItem.Text = "Файл";
// //
// SaveToolStripMenuItem // SaveToolStripMenuItem
// //
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
SaveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; SaveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
SaveToolStripMenuItem.Size = new Size(273, 34); SaveToolStripMenuItem.Size = new Size(181, 22);
SaveToolStripMenuItem.Text = "Сохранение"; SaveToolStripMenuItem.Text = "Сохранение";
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
// //
@ -284,7 +304,7 @@
// //
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
LoadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L; LoadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
LoadToolStripMenuItem.Size = new Size(273, 34); LoadToolStripMenuItem.Size = new Size(181, 22);
LoadToolStripMenuItem.Text = "Загрузка"; LoadToolStripMenuItem.Text = "Загрузка";
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
// //
@ -299,13 +319,14 @@
// //
// FormTrackedVehicleCollection // FormTrackedVehicleCollection
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(932, 615); ClientSize = new Size(860, 514);
Controls.Add(pictureBox); Controls.Add(pictureBox);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Controls.Add(menuStrip); Controls.Add(menuStrip);
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
Margin = new Padding(2);
Name = "FormTrackedVehicleCollection"; Name = "FormTrackedVehicleCollection";
Text = "Коллекция гусеничных машин"; Text = "Коллекция гусеничных машин";
Load += FormTrackedVehicleCollection_Load; Load += FormTrackedVehicleCollection_Load;

View File

@ -103,7 +103,6 @@ public partial class FormTrackedVehicleCollection : Form
return; return;
} }
int pos = Convert.ToInt32(maskedTextBox.Text); int pos = Convert.ToInt32(maskedTextBox.Text);
int tempSize = TrackedVehicleSharingService.getAmountOfObjects();
try try
{ {
if (_company - pos != null) if (_company - pos != null)

View File

@ -73,8 +73,10 @@
groupBoxConfig.Controls.Add(LabelSimpleObject); groupBoxConfig.Controls.Add(LabelSimpleObject);
groupBoxConfig.Dock = DockStyle.Left; groupBoxConfig.Dock = DockStyle.Left;
groupBoxConfig.Location = new Point(0, 0); groupBoxConfig.Location = new Point(0, 0);
groupBoxConfig.Margin = new Padding(2);
groupBoxConfig.Name = "groupBoxConfig"; groupBoxConfig.Name = "groupBoxConfig";
groupBoxConfig.Size = new Size(634, 420); groupBoxConfig.Padding = new Padding(2);
groupBoxConfig.Size = new Size(444, 252);
groupBoxConfig.TabIndex = 0; groupBoxConfig.TabIndex = 0;
groupBoxConfig.TabStop = false; groupBoxConfig.TabStop = false;
groupBoxConfig.Text = "Параметры"; groupBoxConfig.Text = "Параметры";
@ -89,89 +91,100 @@
groupBoxColors.Controls.Add(panelBlue); groupBoxColors.Controls.Add(panelBlue);
groupBoxColors.Controls.Add(panelGreen); groupBoxColors.Controls.Add(panelGreen);
groupBoxColors.Controls.Add(panelRed); groupBoxColors.Controls.Add(panelRed);
groupBoxColors.Location = new Point(363, 21); groupBoxColors.Location = new Point(254, 13);
groupBoxColors.Margin = new Padding(2);
groupBoxColors.Name = "groupBoxColors"; groupBoxColors.Name = "groupBoxColors";
groupBoxColors.Size = new Size(265, 120); groupBoxColors.Padding = new Padding(2);
groupBoxColors.Size = new Size(186, 83);
groupBoxColors.TabIndex = 8; groupBoxColors.TabIndex = 8;
groupBoxColors.TabStop = false; groupBoxColors.TabStop = false;
// //
// panelPurple // panelPurple
// //
panelPurple.BackColor = Color.Purple; panelPurple.BackColor = Color.Purple;
panelPurple.Location = new Point(214, 77); panelPurple.Location = new Point(150, 46);
panelPurple.Margin = new Padding(2);
panelPurple.Name = "panelPurple"; panelPurple.Name = "panelPurple";
panelPurple.Size = new Size(34, 37); panelPurple.Size = new Size(24, 22);
panelPurple.TabIndex = 5; panelPurple.TabIndex = 5;
panelPurple.MouseDown += Panel_MouseDown; panelPurple.MouseDown += Panel_MouseDown;
// //
// panelBlack // panelBlack
// //
panelBlack.BackColor = Color.Black; panelBlack.BackColor = Color.Black;
panelBlack.Location = new Point(154, 77); panelBlack.Location = new Point(108, 46);
panelBlack.Margin = new Padding(2);
panelBlack.Name = "panelBlack"; panelBlack.Name = "panelBlack";
panelBlack.Size = new Size(34, 37); panelBlack.Size = new Size(24, 22);
panelBlack.TabIndex = 4; panelBlack.TabIndex = 4;
panelBlack.MouseDown += Panel_MouseDown; panelBlack.MouseDown += Panel_MouseDown;
// //
// panelGray // panelGray
// //
panelGray.BackColor = Color.Gray; panelGray.BackColor = Color.Gray;
panelGray.Location = new Point(85, 77); panelGray.Location = new Point(60, 46);
panelGray.Margin = new Padding(2);
panelGray.Name = "panelGray"; panelGray.Name = "panelGray";
panelGray.Size = new Size(34, 37); panelGray.Size = new Size(24, 22);
panelGray.TabIndex = 3; panelGray.TabIndex = 3;
panelGray.MouseDown += Panel_MouseDown; panelGray.MouseDown += Panel_MouseDown;
// //
// panelWhite // panelWhite
// //
panelWhite.BackColor = Color.White; panelWhite.BackColor = Color.White;
panelWhite.Location = new Point(16, 77); panelWhite.Location = new Point(11, 46);
panelWhite.Margin = new Padding(2);
panelWhite.Name = "panelWhite"; panelWhite.Name = "panelWhite";
panelWhite.Size = new Size(34, 37); panelWhite.Size = new Size(24, 22);
panelWhite.TabIndex = 2; panelWhite.TabIndex = 2;
panelWhite.MouseDown += Panel_MouseDown; panelWhite.MouseDown += Panel_MouseDown;
// //
// panelYellow // panelYellow
// //
panelYellow.BackColor = Color.Yellow; panelYellow.BackColor = Color.Yellow;
panelYellow.Location = new Point(214, 30); panelYellow.Location = new Point(150, 18);
panelYellow.Margin = new Padding(2);
panelYellow.Name = "panelYellow"; panelYellow.Name = "panelYellow";
panelYellow.Size = new Size(34, 37); panelYellow.Size = new Size(24, 22);
panelYellow.TabIndex = 1; panelYellow.TabIndex = 1;
panelYellow.MouseDown += Panel_MouseDown; panelYellow.MouseDown += Panel_MouseDown;
// //
// panelBlue // panelBlue
// //
panelBlue.BackColor = Color.Blue; panelBlue.BackColor = Color.Blue;
panelBlue.Location = new Point(154, 30); panelBlue.Location = new Point(108, 18);
panelBlue.Margin = new Padding(2);
panelBlue.Name = "panelBlue"; panelBlue.Name = "panelBlue";
panelBlue.Size = new Size(34, 37); panelBlue.Size = new Size(24, 22);
panelBlue.TabIndex = 1; panelBlue.TabIndex = 1;
// //
// panelGreen // panelGreen
// //
panelGreen.BackColor = Color.Green; panelGreen.BackColor = Color.Green;
panelGreen.Location = new Point(85, 30); panelGreen.Location = new Point(60, 18);
panelGreen.Margin = new Padding(2);
panelGreen.Name = "panelGreen"; panelGreen.Name = "panelGreen";
panelGreen.Size = new Size(34, 37); panelGreen.Size = new Size(24, 22);
panelGreen.TabIndex = 1; panelGreen.TabIndex = 1;
panelGreen.MouseDown += Panel_MouseDown; panelGreen.MouseDown += Panel_MouseDown;
// //
// panelRed // panelRed
// //
panelRed.BackColor = Color.Red; panelRed.BackColor = Color.Red;
panelRed.Location = new Point(16, 30); panelRed.Location = new Point(11, 18);
panelRed.Margin = new Padding(2);
panelRed.Name = "panelRed"; panelRed.Name = "panelRed";
panelRed.Size = new Size(34, 37); panelRed.Size = new Size(24, 22);
panelRed.TabIndex = 0; panelRed.TabIndex = 0;
panelRed.MouseDown += Panel_MouseDown; panelRed.MouseDown += Panel_MouseDown;
// //
// checkBoxOtval // checkBoxOtval
// //
checkBoxOtval.AutoSize = true; checkBoxOtval.AutoSize = true;
checkBoxOtval.Location = new Point(12, 147); checkBoxOtval.Location = new Point(8, 102);
checkBoxOtval.Margin = new Padding(2);
checkBoxOtval.Name = "checkBoxOtval"; checkBoxOtval.Name = "checkBoxOtval";
checkBoxOtval.Size = new Size(345, 29); checkBoxOtval.Size = new Size(234, 19);
checkBoxOtval.TabIndex = 7; checkBoxOtval.TabIndex = 7;
checkBoxOtval.Text = "Признак наличия опор для фиксации"; checkBoxOtval.Text = "Признак наличия опор для фиксации";
checkBoxOtval.UseVisualStyleBackColor = true; checkBoxOtval.UseVisualStyleBackColor = true;
@ -179,57 +192,63 @@
// checkBoxKovsh // checkBoxKovsh
// //
checkBoxKovsh.AutoSize = true; checkBoxKovsh.AutoSize = true;
checkBoxKovsh.Location = new Point(12, 112); checkBoxKovsh.Location = new Point(8, 79);
checkBoxKovsh.Margin = new Padding(2);
checkBoxKovsh.Name = "checkBoxKovsh"; checkBoxKovsh.Name = "checkBoxKovsh";
checkBoxKovsh.Size = new Size(238, 29); checkBoxKovsh.Size = new Size(162, 19);
checkBoxKovsh.TabIndex = 6; checkBoxKovsh.TabIndex = 6;
checkBoxKovsh.Text = "Признак наличия ковша"; checkBoxKovsh.Text = "Признак наличия ковша";
checkBoxKovsh.UseVisualStyleBackColor = true; checkBoxKovsh.UseVisualStyleBackColor = true;
// //
// numericUpDownWeight // numericUpDownWeight
// //
numericUpDownWeight.Location = new Point(105, 75); numericUpDownWeight.Location = new Point(74, 45);
numericUpDownWeight.Margin = new Padding(2);
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownWeight.Name = "numericUpDownWeight"; numericUpDownWeight.Name = "numericUpDownWeight";
numericUpDownWeight.Size = new Size(252, 31); numericUpDownWeight.Size = new Size(176, 23);
numericUpDownWeight.TabIndex = 5; numericUpDownWeight.TabIndex = 5;
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
// //
// labelWeight // labelWeight
// //
labelWeight.AutoSize = true; labelWeight.AutoSize = true;
labelWeight.Location = new Point(12, 75); labelWeight.Location = new Point(8, 45);
labelWeight.Margin = new Padding(2, 0, 2, 0);
labelWeight.Name = "labelWeight"; labelWeight.Name = "labelWeight";
labelWeight.Size = new Size(43, 25); labelWeight.Size = new Size(29, 15);
labelWeight.TabIndex = 4; labelWeight.TabIndex = 4;
labelWeight.Text = "Вес:"; labelWeight.Text = "Вес:";
// //
// numericUpDownSpeed // numericUpDownSpeed
// //
numericUpDownSpeed.Location = new Point(105, 36); numericUpDownSpeed.Location = new Point(74, 22);
numericUpDownSpeed.Margin = new Padding(2);
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownSpeed.Name = "numericUpDownSpeed"; numericUpDownSpeed.Name = "numericUpDownSpeed";
numericUpDownSpeed.Size = new Size(252, 31); numericUpDownSpeed.Size = new Size(176, 23);
numericUpDownSpeed.TabIndex = 3; numericUpDownSpeed.TabIndex = 3;
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
// //
// labelSpeed // labelSpeed
// //
labelSpeed.AutoSize = true; labelSpeed.AutoSize = true;
labelSpeed.Location = new Point(6, 38); labelSpeed.Location = new Point(4, 23);
labelSpeed.Margin = new Padding(2, 0, 2, 0);
labelSpeed.Name = "labelSpeed"; labelSpeed.Name = "labelSpeed";
labelSpeed.Size = new Size(93, 25); labelSpeed.Size = new Size(62, 15);
labelSpeed.TabIndex = 2; labelSpeed.TabIndex = 2;
labelSpeed.Text = "Скорость:"; labelSpeed.Text = "Скорость:";
// //
// LabelModifiedObject // LabelModifiedObject
// //
LabelModifiedObject.BorderStyle = BorderStyle.FixedSingle; LabelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
LabelModifiedObject.Location = new Point(498, 147); LabelModifiedObject.Location = new Point(348, 102);
LabelModifiedObject.Margin = new Padding(2, 0, 2, 0);
LabelModifiedObject.Name = "LabelModifiedObject"; LabelModifiedObject.Name = "LabelModifiedObject";
LabelModifiedObject.Size = new Size(130, 38); LabelModifiedObject.Size = new Size(92, 24);
LabelModifiedObject.TabIndex = 1; LabelModifiedObject.TabIndex = 1;
LabelModifiedObject.Text = "Продвинутый"; LabelModifiedObject.Text = "Продвинутый";
LabelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; LabelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
@ -238,9 +257,10 @@
// LabelSimpleObject // LabelSimpleObject
// //
LabelSimpleObject.BorderStyle = BorderStyle.FixedSingle; LabelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
LabelSimpleObject.Location = new Point(360, 147); LabelSimpleObject.Location = new Point(254, 102);
LabelSimpleObject.Margin = new Padding(2, 0, 2, 0);
LabelSimpleObject.Name = "LabelSimpleObject"; LabelSimpleObject.Name = "LabelSimpleObject";
LabelSimpleObject.Size = new Size(122, 38); LabelSimpleObject.Size = new Size(86, 24);
LabelSimpleObject.TabIndex = 0; LabelSimpleObject.TabIndex = 0;
LabelSimpleObject.Text = "Простой"; LabelSimpleObject.Text = "Простой";
LabelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; LabelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
@ -248,17 +268,19 @@
// //
// pictureBoxObject // pictureBoxObject
// //
pictureBoxObject.Location = new Point(659, 75); pictureBoxObject.Location = new Point(461, 45);
pictureBoxObject.Margin = new Padding(2);
pictureBoxObject.Name = "pictureBoxObject"; pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new Size(290, 227); pictureBoxObject.Size = new Size(203, 141);
pictureBoxObject.TabIndex = 1; pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false; pictureBoxObject.TabStop = false;
// //
// buttonAdd // buttonAdd
// //
buttonAdd.Location = new Point(640, 341); buttonAdd.Location = new Point(451, 205);
buttonAdd.Margin = new Padding(2);
buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(106, 34); buttonAdd.Size = new Size(112, 36);
buttonAdd.TabIndex = 2; buttonAdd.TabIndex = 2;
buttonAdd.Text = "Добавить"; buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
@ -266,9 +288,10 @@
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(752, 341); buttonCancel.Location = new Point(567, 205);
buttonCancel.Margin = new Padding(2);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(103, 34); buttonCancel.Size = new Size(110, 36);
buttonCancel.TabIndex = 3; buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -278,9 +301,10 @@
panelObject1.AllowDrop = true; panelObject1.AllowDrop = true;
panelObject1.Controls.Add(labelAdditionalColor); panelObject1.Controls.Add(labelAdditionalColor);
panelObject1.Controls.Add(labelBodyColor); panelObject1.Controls.Add(labelBodyColor);
panelObject1.Location = new Point(644, 12); panelObject1.Location = new Point(451, 7);
panelObject1.Margin = new Padding(2);
panelObject1.Name = "panelObject1"; panelObject1.Name = "panelObject1";
panelObject1.Size = new Size(512, 323); panelObject1.Size = new Size(338, 194);
panelObject1.TabIndex = 4; panelObject1.TabIndex = 4;
panelObject1.DragDrop += PanelObject1_DragDrop; panelObject1.DragDrop += PanelObject1_DragDrop;
panelObject1.DragEnter += PanelObject1_DragEnter; panelObject1.DragEnter += PanelObject1_DragEnter;
@ -289,9 +313,10 @@
// //
labelAdditionalColor.AllowDrop = true; labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
labelAdditionalColor.Location = new Point(102, 9); labelAdditionalColor.Location = new Point(116, 6);
labelAdditionalColor.Margin = new Padding(2, 0, 2, 0);
labelAdditionalColor.Name = "labelAdditionalColor"; labelAdditionalColor.Name = "labelAdditionalColor";
labelAdditionalColor.Size = new Size(103, 30); labelAdditionalColor.Size = new Size(97, 25);
labelAdditionalColor.TabIndex = 2; labelAdditionalColor.TabIndex = 2;
labelAdditionalColor.Text = "Доп. Цвет"; labelAdditionalColor.Text = "Доп. Цвет";
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
@ -303,9 +328,10 @@
// //
labelBodyColor.AllowDrop = true; labelBodyColor.AllowDrop = true;
labelBodyColor.BorderStyle = BorderStyle.FixedSingle; labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
labelBodyColor.Location = new Point(3, 9); labelBodyColor.Location = new Point(10, 6);
labelBodyColor.Margin = new Padding(2, 0, 2, 0);
labelBodyColor.Name = "labelBodyColor"; labelBodyColor.Name = "labelBodyColor";
labelBodyColor.Size = new Size(93, 30); labelBodyColor.Size = new Size(102, 25);
labelBodyColor.TabIndex = 1; labelBodyColor.TabIndex = 1;
labelBodyColor.Text = "Цвет"; labelBodyColor.Text = "Цвет";
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
@ -314,14 +340,15 @@
// //
// FormTrackedVehicleConfig // FormTrackedVehicleConfig
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1168, 420); ClientSize = new Size(794, 252);
Controls.Add(pictureBoxObject); Controls.Add(pictureBoxObject);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonAdd); Controls.Add(buttonAdd);
Controls.Add(groupBoxConfig); Controls.Add(groupBoxConfig);
Controls.Add(panelObject1); Controls.Add(panelObject1);
Margin = new Padding(2);
Name = "FormTrackedVehicleConfig"; Name = "FormTrackedVehicleConfig";
Text = "Создание объекта"; Text = "Создание объекта";
Load += FormTrackedVehicleConfig_Load; Load += FormTrackedVehicleConfig_Load;

View File

@ -24,7 +24,7 @@ public partial class FormTrackedVehicleConfig : Form
/// <summary> /// <summary>
/// Событие для предачи объекта /// Событие для предачи объекта
/// </summary> /// </summary>
private event TrackedVehicleDelegate? TrackedVehicleDelegate; private event Action<DrawningTrackedVehicle>? TrackedVehicleDelegate;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
@ -47,7 +47,17 @@ public partial class FormTrackedVehicleConfig : Form
/// </summary> /// </summary>
/// <param name="trackedVehicleDelegate"></param> /// <param name="trackedVehicleDelegate"></param>
/// ///
public void AddEvent(Action<DrawningTrackedVehicle> trackedVehicleDelegate)
{
if (TrackedVehicleDelegate == null)
{
TrackedVehicleDelegate = trackedVehicleDelegate;
}
else
{
TrackedVehicleDelegate += trackedVehicleDelegate;
}
}
/// <summary> /// <summary>
@ -80,7 +90,6 @@ public partial class FormTrackedVehicleConfig : Form
private void PanelObject1_DragEnter(object sender, DragEventArgs e) private void PanelObject1_DragEnter(object sender, DragEventArgs e)
{ {
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None; e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
} }
/// <summary> /// <summary>
/// Действия при приёме перетаскиваемой информации /// Действия при приёме перетаскиваемой информации
@ -132,10 +141,6 @@ public partial class FormTrackedVehicleConfig : Form
e.Effect = DragDropEffects.None; e.Effect = DragDropEffects.None;
} }
} }
public void AddEvent(TrackedVehicleDelegate trainDelegate)
{
TrackedVehicleDelegate += trainDelegate;
}
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{ {

View File

@ -1,5 +1,7 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System; using Microsoft.Extensions.Logging;
using Serilog;
using Microsoft.Extensions.Configuration;
namespace lab1 namespace lab1
{ {
@ -27,13 +29,20 @@ namespace lab1
/// <param name="services"></param> /// <param name="services"></param>
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)
{ {
string[] path = Directory.GetCurrentDirectory().Split('\\');
string pathNeed = "";
for (int i = 0; i < path.Length - 3; i++)
{
pathNeed += path[i] + "\\";
}
services.AddSingleton<FormTrackedVehicleCollection>() services.AddSingleton<FormTrackedVehicleCollection>()
.AddLogging(option => .AddLogging(option =>
{ {
option.SetMinimumLevel(LogLevel.Information); option.SetMinimumLevel(LogLevel.Information);
option.AddSerilog(new LoggerConfiguration() option.AddSerilog(new LoggerConfiguration()
.WriteTo.File("log.txt") .ReadFrom.Configuration(new ConfigurationBuilder()
.AddJsonFile($"{pathNeed}serilog.json")
.Build())
.CreateLogger()); .CreateLogger());
}); });
} }

View File

@ -9,7 +9,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.12" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,15 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.File" ],
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "File",
"Args": { "path": "log.log" }
}
],
"Properties": {
"Application": "Sample"
}
}
}