diff --git a/DoubleDeckerBus/DrawingBus.cs b/DoubleDeckerBus/Drawing/DrawingBus.cs
similarity index 96%
rename from DoubleDeckerBus/DrawingBus.cs
rename to DoubleDeckerBus/Drawing/DrawingBus.cs
index 03af2a5..ff28441 100644
--- a/DoubleDeckerBus/DrawingBus.cs
+++ b/DoubleDeckerBus/Drawing/DrawingBus.cs
@@ -5,9 +5,9 @@ using System.Text;
using System.Threading.Tasks;
using DoubleDeckerbus.Entities;
-using DoubleDeckerbus.MovementStrategy;
+using DoubleDeckerbus.Move_Strategy;
-namespace DoubleDeckerbus.DrawingObjects
+namespace DoubleDeckerbus.Drawing
{
public class DrawingBus
{
@@ -17,8 +17,8 @@ namespace DoubleDeckerbus.DrawingObjects
public int _pictureHeight;
protected int _startPosX;
protected int _startPosY;
- protected readonly int _busWidth = 175;
- protected readonly int _busHeight = 115;
+ protected readonly int _busWidth = 175;
+ protected readonly int _busHeight = 115;
public int GetPosX => _startPosX;
public int GetPosY => _startPosY;
public int GetWidth => _busWidth;
@@ -55,7 +55,7 @@ namespace DoubleDeckerbus.DrawingObjects
_startPosY = y;
}
public void MoveTransport(DirectionType direction)
- {
+ {
if (!CanMove(direction) || EntityBus == null)
{
return;
@@ -91,10 +91,8 @@ namespace DoubleDeckerbus.DrawingObjects
public virtual void DrawTransport(Graphics g)
{
Pen pen = new(Color.Black);
-
Brush additionalBrush = new
SolidBrush(EntityBus.BodyColor);
-
g.FillRectangle(additionalBrush, _startPosX + 147, _startPosY + 52, 21, 20);
g.FillRectangle(additionalBrush, _startPosX + 147, _startPosY + 71, 30, 27);
g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY + 52, 137, 46);
@@ -106,7 +104,6 @@ namespace DoubleDeckerbus.DrawingObjects
g.FillRectangle(brBlue, _startPosX + 123, _startPosY + 55, 15, 15);
g.DrawLine(pen, _startPosX + 30, _startPosY + 52, _startPosX + 30, _startPosY + 98);
g.DrawLine(pen, _startPosX + 35, _startPosY + 52, _startPosX + 35, _startPosY + 98);
-
Brush gr = new SolidBrush(Color.Gray);
g.FillEllipse(additionalBrush, _startPosX + 23, _startPosY + 88, 25, 25);
g.FillEllipse(additionalBrush, _startPosX + 123, _startPosY + 88, 25, 25);
diff --git a/DoubleDeckerBus/DrawingDoubleDeckerbus.cs b/DoubleDeckerBus/Drawing/DrawingDoubleDeckerbus.cs
similarity index 89%
rename from DoubleDeckerBus/DrawingDoubleDeckerbus.cs
rename to DoubleDeckerBus/Drawing/DrawingDoubleDeckerbus.cs
index 01e7374..8729bc7 100644
--- a/DoubleDeckerBus/DrawingDoubleDeckerbus.cs
+++ b/DoubleDeckerBus/Drawing/DrawingDoubleDeckerbus.cs
@@ -1,5 +1,4 @@
-using DoubleDeckerbus.DrawingObjects;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,7 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using DoubleDeckerbus.Entities;
-namespace DoubleDeckerbus
+namespace DoubleDeckerbus.Drawing
{
public class DrawingDoubleDeckerbus : DrawingBus
{
@@ -17,7 +16,6 @@ namespace DoubleDeckerbus
{
EntityBus = new EntityDoubleDeckerBus(speed, weight, bodyColor, additionalColor, secondfloor, stairs);
}
-
}
public override void DrawTransport(Graphics g)
{
@@ -25,16 +23,20 @@ namespace DoubleDeckerbus
{
return;
}
- Pen pen = new(Color.Black);
- Pen additionalPen = new(doubleDeckerBus.Body);
- Brush additionalBrush = new SolidBrush(doubleDeckerBus.Body);
+ Pen pen = new(Color.Black); //чёрный цвет для колёс
+ Pen additionalPen = new(doubleDeckerBus.AddColor);
+ Brush additionalBrush = new SolidBrush(doubleDeckerBus.AddColor);
base.DrawTransport(g);
+
if (doubleDeckerBus.Secondfloor)
{
- Brush additionalBrush2 = new SolidBrush(doubleDeckerBus.Body);
+ Brush additionalBrush2 = new SolidBrush(doubleDeckerBus.AddColor);
Brush brBlue = new SolidBrush(Color.LightBlue);
- g.FillRectangle(additionalBrush2, _startPosX + 7, _startPosY + 12, 172, 40);
+
+ g.FillRectangle(additionalBrush2, _startPosX + 7, _startPosY + 12, 172, 40); //большой прямоугольник
+
g.DrawLine(pen, _startPosX + 7, _startPosY + 36, _startPosX + 178, _startPosY + 36);
+
g.FillRectangle(brBlue, _startPosX + 15, _startPosY + 15, 15, 15);
g.FillRectangle(brBlue, _startPosX + 42, _startPosY + 15, 15, 15);
g.FillRectangle(brBlue, _startPosX + 69, _startPosY + 15, 15, 15);
@@ -42,6 +44,7 @@ namespace DoubleDeckerbus
g.FillRectangle(brBlue, _startPosX + 123, _startPosY + 15, 15, 15);
g.FillRectangle(brBlue, _startPosX + 150, _startPosY + 15, 15, 15);
}
+
if (doubleDeckerBus.Stairs)
{
g.DrawLine(pen, _startPosX + 10, _startPosY + 55, _startPosX + 34, _startPosY + 55);
diff --git a/DoubleDeckerBus/DirectionType.cs b/DoubleDeckerBus/Entities/DirectionType.cs
similarity index 86%
rename from DoubleDeckerBus/DirectionType.cs
rename to DoubleDeckerBus/Entities/DirectionType.cs
index e13f540..e635c45 100644
--- a/DoubleDeckerBus/DirectionType.cs
+++ b/DoubleDeckerBus/Entities/DirectionType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DoubleDeckerbus
+namespace DoubleDeckerbus.Entities
{
public enum DirectionType
{
diff --git a/DoubleDeckerBus/EntityBus.cs b/DoubleDeckerBus/Entities/EntityBus.cs
similarity index 100%
rename from DoubleDeckerBus/EntityBus.cs
rename to DoubleDeckerBus/Entities/EntityBus.cs
diff --git a/DoubleDeckerBus/EntityDoubleDeckerBus.cs b/DoubleDeckerBus/Entities/EntityDoubleDeckerbus.cs
similarity index 86%
rename from DoubleDeckerBus/EntityDoubleDeckerBus.cs
rename to DoubleDeckerBus/Entities/EntityDoubleDeckerbus.cs
index 11cd618..ece2239 100644
--- a/DoubleDeckerBus/EntityDoubleDeckerBus.cs
+++ b/DoubleDeckerBus/Entities/EntityDoubleDeckerbus.cs
@@ -9,12 +9,12 @@ namespace DoubleDeckerbus.Entities
{
public class EntityDoubleDeckerBus : EntityBus
{
- public Color Body { get; private set; }
+ public Color AddColor { get; private set; }
public bool Secondfloor { get; private set; }
public bool Stairs { get; private set; }
public EntityDoubleDeckerBus(int speed, double weight, Color bodyColor, Color additionalColor, bool secondfloor, bool stairs) : base(speed, weight, bodyColor)
{
- Body = additionalColor;
+ AddColor = additionalColor;
Secondfloor = secondfloor;
Stairs = stairs;
}
diff --git a/DoubleDeckerBus/FormBusCollection.Designer.cs b/DoubleDeckerBus/FormBusCollection.Designer.cs
deleted file mode 100644
index 08ff655..0000000
--- a/DoubleDeckerBus/FormBusCollection.Designer.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-namespace DoubleDeckerbus
-{
- partial class FormBusCollection
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
- this.labelInstruments = new System.Windows.Forms.Label();
- this.buttonAdd = new System.Windows.Forms.Button();
- this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
- this.buttonDelete = new System.Windows.Forms.Button();
- this.buttonUpdate = new System.Windows.Forms.Button();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
- this.SuspendLayout();
- //
- // pictureBoxCollection
- //
- this.pictureBoxCollection.Location = new System.Drawing.Point(1, -2);
- this.pictureBoxCollection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.pictureBoxCollection.Name = "pictureBoxCollection";
- this.pictureBoxCollection.Size = new System.Drawing.Size(803, 924);
- this.pictureBoxCollection.TabIndex = 0;
- this.pictureBoxCollection.TabStop = false;
- //
- // labelInstruments
- //
- this.labelInstruments.AutoSize = true;
- this.labelInstruments.Location = new System.Drawing.Point(852, 22);
- this.labelInstruments.Name = "labelInstruments";
- this.labelInstruments.Size = new System.Drawing.Size(83, 15);
- this.labelInstruments.TabIndex = 1;
- this.labelInstruments.Text = "Инструменты";
- //
- // buttonAdd
- //
- this.buttonAdd.Location = new System.Drawing.Point(823, 63);
- this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.buttonAdd.Name = "buttonAdd";
- this.buttonAdd.Size = new System.Drawing.Size(161, 44);
- this.buttonAdd.TabIndex = 2;
- this.buttonAdd.Text = "Добавить автобус";
- this.buttonAdd.UseVisualStyleBackColor = true;
- this.buttonAdd.Click += new System.EventHandler(this.ButtonAddBus_Click);
- //
- // maskedTextBoxNumber
- //
- this.maskedTextBoxNumber.Location = new System.Drawing.Point(874, 140);
- this.maskedTextBoxNumber.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
- this.maskedTextBoxNumber.Size = new System.Drawing.Size(110, 23);
- this.maskedTextBoxNumber.TabIndex = 3;
- //
- // buttonDelete
- //
- this.buttonDelete.Location = new System.Drawing.Point(840, 167);
- this.buttonDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.buttonDelete.Name = "buttonDelete";
- this.buttonDelete.Size = new System.Drawing.Size(165, 45);
- this.buttonDelete.TabIndex = 4;
- this.buttonDelete.Text = "Удалить автобус";
- this.buttonDelete.UseVisualStyleBackColor = true;
- this.buttonDelete.Click += new System.EventHandler(this.ButtonRemoveBus_Click);
- //
- // buttonUpdate
- //
- this.buttonUpdate.Location = new System.Drawing.Point(840, 260);
- this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.buttonUpdate.Name = "buttonUpdate";
- this.buttonUpdate.Size = new System.Drawing.Size(165, 45);
- this.buttonUpdate.TabIndex = 5;
- this.buttonUpdate.Text = "Обновить";
- this.buttonUpdate.UseVisualStyleBackColor = true;
- this.buttonUpdate.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
- //
- // FormBusCollection
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1152, 975);
- this.Controls.Add(this.buttonUpdate);
- this.Controls.Add(this.buttonDelete);
- this.Controls.Add(this.maskedTextBoxNumber);
- this.Controls.Add(this.buttonAdd);
- this.Controls.Add(this.labelInstruments);
- this.Controls.Add(this.pictureBoxCollection);
- this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.Name = "FormBusCollection";
- this.Text = "Автобус";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private PictureBox pictureBoxCollection;
- private Label labelInstruments;
- private Button buttonAdd;
- private TextBox maskedTextBoxNumber;
- private Button buttonDelete;
- private Button buttonUpdate;
- }
-}
\ No newline at end of file
diff --git a/DoubleDeckerBus/FormBusCollection.cs b/DoubleDeckerBus/FormBusCollection.cs
deleted file mode 100644
index c78c379..0000000
--- a/DoubleDeckerBus/FormBusCollection.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using DoubleDeckerbus.DrawingObjects;
-using DoubleDeckerbus;
-using DoubleDeckerbus.MovementStrategy;
-
-namespace DoubleDeckerbus
-{
- public partial class FormBusCollection : Form
- {
- private readonly BusGenericCollection _bus;
- public FormBusCollection()
- {
- InitializeComponent();
- _bus = new BusGenericCollection(pictureBoxCollection.Width, pictureBoxCollection.Height);
-
- }
- private void ButtonAddBus_Click(object sender, EventArgs e)
- {
- FormDoubleDeckerbus form = new();
- if (form.ShowDialog() == DialogResult.OK)
- {
- if (_bus + form.SelectedBus != -1)
- {
- MessageBox.Show("Объект добавлен");
- pictureBoxCollection.Image = _bus.ShowBus();
- }
- else
- {
- MessageBox.Show("Не удалось добавить объект");
- }
- }
- }
- private void ButtonRemoveBus_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("Удалить объект?", "Удаление",
- MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- int pos = 0;
- try
- {
- pos = Convert.ToInt32(maskedTextBoxNumber.Text) ;
-
- }
- catch
- {
- MessageBox.Show("Ошибка ввода данных");
- return;
- }
- if (_bus - (_bus.ReturnLength() - pos))
- {
- MessageBox.Show("Объект удален");
- pictureBoxCollection.Image = _bus.ShowBus();
- }
- else
- {
- MessageBox.Show("Не удалось удалить объект");
- }
- }
- private void ButtonRefreshCollection_Click(object sender, EventArgs e)
- {
- pictureBoxCollection.Image = _bus.ShowBus();
- }
- }
-}
diff --git a/DoubleDeckerBus/FormBusCollection.resx b/DoubleDeckerBus/FormBusCollection.resx
deleted file mode 100644
index f298a7b..0000000
--- a/DoubleDeckerBus/FormBusCollection.resx
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/DoubleDeckerBus/FormDoubleDeckerBus.cs b/DoubleDeckerBus/FormDoubleDeckerBus.cs
index 65e991a..04e15df 100644
--- a/DoubleDeckerBus/FormDoubleDeckerBus.cs
+++ b/DoubleDeckerBus/FormDoubleDeckerBus.cs
@@ -1,13 +1,16 @@
-using DoubleDeckerbus.DrawingObjects;
-using DoubleDeckerbus.MovementStrategy;
+using DoubleDeckerbus.Drawing;
+using DoubleDeckerbus.Entities;
+using DoubleDeckerbus.Move_Strategy;
namespace DoubleDeckerbus
{
+
public partial class FormDoubleDeckerbus : Form
{
private DrawingBus? _drawingBus;
private AbstractStrategy? _abstractStrategy;
public DrawingBus? SelectedBus { get; private set; }
+
public FormDoubleDeckerbus()
{
InitializeComponent();
@@ -24,6 +27,7 @@ namespace DoubleDeckerbus
Graphics gr = Graphics.FromImage(bmp);
_drawingBus.DrawTransport(gr);
pictureBoxDoubleDeckerbus.Image = bmp;
+
}
private void buttonCreateDoubleDeckerbus_Click(object sender, EventArgs e)
{
@@ -45,6 +49,7 @@ namespace DoubleDeckerbus
_drawingBus.SetPosition(random.Next(10, 100), random.Next(10,
100));
Draw();
+
}
private void buttonCreateBus_Click(object sender, EventArgs e)
{
@@ -59,7 +64,7 @@ namespace DoubleDeckerbus
_drawingBus = new DrawingBus(random.Next(100, 300),
random.Next(1000, 3000), color,
pictureBoxDoubleDeckerbus.Width, pictureBoxDoubleDeckerbus.Height);
- _drawingBus.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ _drawingBus.SetPosition(random.Next(10, 100), random.Next(10,100));
Draw();
}
private void buttonMove_Click(object sender, EventArgs e)
diff --git a/DoubleDeckerBus/FormDoubleDeckerbusCollection.Designer.cs b/DoubleDeckerBus/FormDoubleDeckerbusCollection.Designer.cs
new file mode 100644
index 0000000..2fe1fb8
--- /dev/null
+++ b/DoubleDeckerBus/FormDoubleDeckerbusCollection.Designer.cs
@@ -0,0 +1,197 @@
+namespace DoubleDeckerbus
+{
+ partial class FormDoubleDeckerbusCollection
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ buttonAddBus = new Button();
+ pictureBoxCollection = new PictureBox();
+ labelInstruments = new Label();
+ buttonUpdate = new Button();
+ buttonDeleteBus = new Button();
+ colorDialog = new ColorDialog();
+ maskedTextBoxNumber = new MaskedTextBox();
+ label1 = new Label();
+ listBoxStorages = new ListBox();
+ buttonAddStorage = new Button();
+ buttonDeleteStorage = new Button();
+ textBoxStorageName = new TextBox();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
+ SuspendLayout();
+ //
+ // buttonAddBus
+ //
+ buttonAddBus.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonAddBus.Location = new Point(666, 331);
+ buttonAddBus.Name = "buttonAddBus";
+ buttonAddBus.Size = new Size(118, 28);
+ buttonAddBus.TabIndex = 0;
+ buttonAddBus.Text = "Добавить автобус";
+ buttonAddBus.UseVisualStyleBackColor = true;
+ buttonAddBus.Click += buttonAddBus_Click;
+ //
+ // pictureBoxCollection
+ //
+ pictureBoxCollection.Location = new Point(3, 0);
+ pictureBoxCollection.Name = "pictureBoxCollection";
+ pictureBoxCollection.Size = new Size(639, 436);
+ pictureBoxCollection.TabIndex = 1;
+ pictureBoxCollection.TabStop = false;
+ //
+ // labelInstruments
+ //
+ labelInstruments.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ labelInstruments.AutoSize = true;
+ labelInstruments.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ labelInstruments.Location = new Point(666, 0);
+ labelInstruments.Name = "labelInstruments";
+ labelInstruments.Size = new Size(108, 21);
+ labelInstruments.TabIndex = 2;
+ labelInstruments.Text = "Инструменты";
+ //
+ // buttonUpdate
+ //
+ buttonUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonUpdate.Location = new Point(658, 130);
+ buttonUpdate.Name = "buttonUpdate";
+ buttonUpdate.Size = new Size(131, 25);
+ buttonUpdate.TabIndex = 3;
+ buttonUpdate.Text = "Обновить набор";
+ buttonUpdate.UseVisualStyleBackColor = true;
+ buttonUpdate.Click += buttonUpdate_Click;
+ //
+ // buttonDeleteBus
+ //
+ buttonDeleteBus.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonDeleteBus.Location = new Point(666, 394);
+ buttonDeleteBus.Name = "buttonDeleteBus";
+ buttonDeleteBus.Size = new Size(118, 28);
+ buttonDeleteBus.TabIndex = 4;
+ buttonDeleteBus.Text = "Удалить автобус";
+ buttonDeleteBus.UseVisualStyleBackColor = true;
+ buttonDeleteBus.Click += buttonDeleteBus_Click;
+ //
+ // maskedTextBoxNumber
+ //
+ maskedTextBoxNumber.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ maskedTextBoxNumber.Location = new Point(658, 365);
+ maskedTextBoxNumber.Mask = "00";
+ maskedTextBoxNumber.Name = "maskedTextBoxNumber";
+ maskedTextBoxNumber.Size = new Size(138, 23);
+ maskedTextBoxNumber.TabIndex = 5;
+ maskedTextBoxNumber.ValidatingType = typeof(int);
+ //
+ // label1
+ //
+ label1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ label1.AutoSize = true;
+ label1.Location = new Point(658, 38);
+ label1.Name = "label1";
+ label1.Size = new Size(52, 15);
+ label1.TabIndex = 7;
+ label1.Text = "Наборы";
+ //
+ // listBoxStorages
+ //
+ listBoxStorages.FormattingEnabled = true;
+ listBoxStorages.ItemHeight = 15;
+ listBoxStorages.Location = new Point(657, 159);
+ listBoxStorages.Margin = new Padding(3, 2, 3, 2);
+ listBoxStorages.Name = "listBoxStorages";
+ listBoxStorages.Size = new Size(132, 109);
+ listBoxStorages.TabIndex = 8;
+ listBoxStorages.SelectedIndexChanged += listBoxObjects_SelectedIndexChanged;
+ //
+ // buttonAddStorage
+ //
+ buttonAddStorage.Location = new Point(657, 101);
+ buttonAddStorage.Margin = new Padding(3, 2, 3, 2);
+ buttonAddStorage.Name = "buttonAddStorage";
+ buttonAddStorage.Size = new Size(131, 25);
+ buttonAddStorage.TabIndex = 9;
+ buttonAddStorage.Text = "Добавить набор";
+ buttonAddStorage.UseVisualStyleBackColor = true;
+ buttonAddStorage.Click += buttonAddStorage_Click;
+ //
+ // buttonDeleteStorage
+ //
+ buttonDeleteStorage.Location = new Point(657, 272);
+ buttonDeleteStorage.Margin = new Padding(3, 2, 3, 2);
+ buttonDeleteStorage.Name = "buttonDeleteStorage";
+ buttonDeleteStorage.Size = new Size(131, 25);
+ buttonDeleteStorage.TabIndex = 10;
+ buttonDeleteStorage.Text = "Удалить набор";
+ buttonDeleteStorage.UseVisualStyleBackColor = true;
+ buttonDeleteStorage.Click += buttonDeleteStorage_Click;
+ //
+ // textBoxStorageName
+ //
+ textBoxStorageName.Location = new Point(657, 76);
+ textBoxStorageName.Margin = new Padding(3, 2, 3, 2);
+ textBoxStorageName.Name = "textBoxStorageName";
+ textBoxStorageName.Size = new Size(132, 23);
+ textBoxStorageName.TabIndex = 11;
+ //
+ // FormDoubleDeckerbusCollection
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(810, 443);
+ Controls.Add(textBoxStorageName);
+ Controls.Add(buttonDeleteStorage);
+ Controls.Add(buttonAddStorage);
+ Controls.Add(listBoxStorages);
+ Controls.Add(label1);
+ Controls.Add(buttonAddBus);
+ Controls.Add(maskedTextBoxNumber);
+ Controls.Add(buttonDeleteBus);
+ Controls.Add(buttonUpdate);
+ Controls.Add(labelInstruments);
+ Controls.Add(pictureBoxCollection);
+ Name = "FormDoubleDeckerbusCollection";
+ Text = "Набор автобусов";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Button buttonAddBus;
+ private PictureBox pictureBoxCollection;
+ private Label labelInstruments;
+ private Button buttonUpdate;
+ private Button buttonDeleteBus;
+ private ColorDialog colorDialog;
+ private MaskedTextBox maskedTextBoxNumber;
+ private Label label1;
+ private ListBox listBoxStorages;
+ private Button buttonAddStorage;
+ private Button buttonDeleteStorage;
+ private TextBox textBoxStorageName;
+ }
+}
\ No newline at end of file
diff --git a/DoubleDeckerBus/FormDoubleDeckerbusCollection.cs b/DoubleDeckerBus/FormDoubleDeckerbusCollection.cs
new file mode 100644
index 0000000..8b40734
--- /dev/null
+++ b/DoubleDeckerBus/FormDoubleDeckerbusCollection.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using DoubleDeckerbus.Generic;
+using DoubleDeckerbus.Drawing;
+using DoubleDeckerbus.Move_Strategy;
+
+namespace DoubleDeckerbus
+{
+ public partial class FormDoubleDeckerbusCollection : Form
+ {
+ private readonly BusesGenericStorage _storage;
+ public FormDoubleDeckerbusCollection()
+ {
+ InitializeComponent();
+ _storage = new BusesGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
+ }
+ private void ReloadObjects()
+ {
+ int index = listBoxStorages.SelectedIndex;
+ listBoxStorages.Items.Clear();
+ for (int i = 0; i < _storage.Keys.Count; i++)
+ {
+ listBoxStorages.Items.Add(_storage.Keys[i]);
+ }
+ if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count))
+ {
+ listBoxStorages.SelectedIndex = 0;
+ }
+ else if (listBoxStorages.Items.Count > 0 && index > -1 && index < listBoxStorages.Items.Count)
+ {
+ listBoxStorages.SelectedIndex = index;
+ }
+ }
+ private void buttonAddStorage_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxStorageName.Text))
+ {
+ MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _storage.AddSet(textBoxStorageName.Text);
+ ReloadObjects();
+ }
+ private void listBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowBus();
+ }
+ private void buttonDeleteStorage_Click(object sender, EventArgs e)
+ {
+ if (listBoxStorages.SelectedIndex == -1)
+ {
+ return;
+ }
+ if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ _storage.DelSet(listBoxStorages.SelectedItem.ToString() ?? string.Empty);
+ ReloadObjects();
+ }
+ }
+ private void buttonAddBus_Click(object sender, EventArgs e)
+ {
+ if (listBoxStorages.SelectedIndex == -1)
+ {
+ MessageBox.Show("Не выбран набор");
+ return;
+ }
+ var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
+ if (obj == null)
+ {
+ return;
+ }
+ FormDoubleDeckerbus form = new();
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (obj + form.SelectedBus != -1) //-1
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBoxCollection.Image = obj.ShowBus();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
+ }
+ private void buttonDeleteBus_Click(object sender, EventArgs e)
+ {
+ if (listBoxStorages.SelectedIndex == -1)
+ {
+ return;
+ }
+ var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
+ if (obj == null)
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
+ {
+ return;
+ }
+ int pos = 0;
+ try
+ {
+ pos = Convert.ToInt32(maskedTextBoxNumber.Text);
+ }
+ catch
+ {
+ MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (obj - pos) //!!
+ {
+ MessageBox.Show("Объект удален");
+ pictureBoxCollection.Image = obj.ShowBus();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось удалить объект");
+ }
+ }
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ if (listBoxStorages.SelectedIndex == -1)
+ {
+ return;
+ }
+ var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
+ string.Empty];
+ if (obj == null)
+ {
+ return;
+ }
+ pictureBoxCollection.Image = obj.ShowBus();
+ }
+ }
+}
diff --git a/DoubleDeckerBus/FormDoubleDeckerbusCollection.resx b/DoubleDeckerBus/FormDoubleDeckerbusCollection.resx
new file mode 100644
index 0000000..71459e5
--- /dev/null
+++ b/DoubleDeckerBus/FormDoubleDeckerbusCollection.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 36
+
+
\ No newline at end of file
diff --git a/DoubleDeckerBus/BusGenericCollection.cs b/DoubleDeckerBus/Generic/BusGenericCollection.cs
similarity index 66%
rename from DoubleDeckerBus/BusGenericCollection.cs
rename to DoubleDeckerBus/Generic/BusGenericCollection.cs
index 397a7e1..fb1f569 100644
--- a/DoubleDeckerBus/BusGenericCollection.cs
+++ b/DoubleDeckerBus/Generic/BusGenericCollection.cs
@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using DoubleDeckerbus.DrawingObjects;
-using DoubleDeckerbus.MovementStrategy;
+using DoubleDeckerbus.Drawing;
+using DoubleDeckerbus.Move_Strategy;
-namespace DoubleDeckerbus
+namespace DoubleDeckerbus.Generic
{
internal class BusGenericCollection
where T : DrawingBus
@@ -17,7 +17,6 @@ namespace DoubleDeckerbus
private readonly int _placeSizeWidth = 200;
private readonly int _placeSizeHeight = 120;
private readonly SetGeneric _collection;
-
public BusGenericCollection(int picWidth, int picHeight)
{
int width = picWidth / _placeSizeWidth;
@@ -37,20 +36,19 @@ namespace DoubleDeckerbus
}
public static bool operator -(BusGenericCollection collect, int pos)
{
- if (collect._collection.Get(pos) == null)
+ if (collect._collection.GetBus(pos) == null)
{
return false;
}
return collect?._collection.Remove(pos) ?? false;
}
-
- public int ReturnLength()
- {
- return _collection.Count;
- }
public U? GetU(int pos)
{
- return (U?)_collection.Get(pos)?.GetMoveableObject;
+ return (U?)_collection[pos]?.GetMoveableObject;
+ }
+ public int ReturnLength()
+ {
+ return _collection.Count;
}
public Bitmap ShowBus()
{
@@ -74,30 +72,20 @@ namespace DoubleDeckerbus
}
private void DrawObjects(Graphics g)
{
- int x = 0;
+ int x = _pictureWidth / _placeSizeWidth - 1;
int y = 0;
- int index = -1;
- for (int i = 0; i <= _collection.Count; ++i)
+ foreach (var bus in _collection.GetBus())
{
- DrawingBus _bus = _collection.Get(i);
- x = 0;
- y = 0;
- if (_bus != null)
+ if (bus != null)
{
- index = _collection.Count - i;
- while ((index - _pictureWidth / _placeSizeWidth) >= 0)
- {
- y++;
- index -= _pictureWidth / _placeSizeWidth;
- }
- if (index > 0)
+ if (x < 0)
{
- x += index;
+ x = _pictureWidth / _placeSizeWidth - 1;
+ ++y;
}
- x = _pictureWidth / _placeSizeWidth - 1 - x;
- _bus.SetPosition(_placeSizeWidth * x, _placeSizeHeight * y);
-
- _bus.DrawTransport(g);
+ bus.SetPosition(_placeSizeWidth * x, _placeSizeHeight * y);
+ bus.DrawTransport(g);
+ --x;
}
}
}
diff --git a/DoubleDeckerBus/Generic/BusesGenericStorage.cs b/DoubleDeckerBus/Generic/BusesGenericStorage.cs
new file mode 100644
index 0000000..d500226
--- /dev/null
+++ b/DoubleDeckerBus/Generic/BusesGenericStorage.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using DoubleDeckerbus.Drawing;
+using DoubleDeckerbus.Move_Strategy;
+
+namespace DoubleDeckerbus.Generic
+{
+ internal class BusesGenericStorage
+ {
+ readonly Dictionary> _busStorages;
+ public List Keys => _busStorages.Keys.ToList();
+ private readonly int _pictureWidth;
+ private readonly int _pictureHeight;
+
+ public BusesGenericStorage(int pictureWidth, int pictureHeight)
+ {
+ _busStorages = new Dictionary>();
+ _pictureWidth = pictureWidth;
+ _pictureHeight = pictureHeight;
+ }
+ public void AddSet(string name)
+ {
+ foreach (string nameStorage in Keys)
+ {
+ if (nameStorage == name)
+ {
+ MessageBox.Show("Набор с заданным именем уже есть", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ _busStorages.Add(name, new BusGenericCollection(_pictureWidth, _pictureHeight));
+ }
+ public void DelSet(string name)
+ {
+ if (_busStorages.ContainsKey(name))
+ {
+ _busStorages.Remove(name);
+ }
+
+ }
+ public BusGenericCollection? this[string ind]
+ {
+ get
+ {
+ if (_busStorages.ContainsKey(ind))
+ {
+ return _busStorages[ind];
+ }
+ return null;
+ }
+ }
+ }
+}
diff --git a/DoubleDeckerBus/Generic/SetGeneric.cs b/DoubleDeckerBus/Generic/SetGeneric.cs
new file mode 100644
index 0000000..a065d07
--- /dev/null
+++ b/DoubleDeckerBus/Generic/SetGeneric.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DoubleDeckerbus.Generic
+{
+ internal class SetGeneric
+ where T : class
+ {
+ private readonly List _places;
+ public int Count => _places.Count;
+ private readonly int _maxCount;
+ public SetGeneric(int count)
+ {
+ _maxCount = count;
+ _places = new List(count);
+ }
+ public int Insert(T bus)
+ {
+ _places.Insert(0, bus); //0
+ return 0;
+ }
+ public bool Insert(T bus, int position)
+ {
+ if (position < 0 || position >= Count || Count >= _maxCount)
+ {
+ return false;
+ }
+ _places.Insert(position, bus);
+ return true;
+ }
+ public bool Remove(int position)
+ {
+ if (position < 0 || position >= Count)
+ {
+ return false;
+ }
+ _places.RemoveAt(position);
+ return true;
+ }
+ public T? this[int position]
+ {
+ get
+ {
+ if (position < 0 || position >= Count)
+ {
+ return null;
+ }
+ return _places[position];
+ }
+ set
+ {
+ if (position < 0 || position > Count || Count >= _maxCount)
+ {
+ return;
+ }
+ _places.Insert(position, value);
+ }
+ }
+ public IEnumerable GetBus(int? maxBus = null)
+ {
+ for (int i = 0; i < _places.Count; ++i)
+ {
+ yield return _places[i];
+ if (maxBus.HasValue && i == maxBus.Value)
+ {
+ yield break;
+ }
+ }
+ }
+ }
+}
diff --git a/DoubleDeckerBus/AbstractStrategy.cs b/DoubleDeckerBus/Move_Strategy/AbstractStrategy.cs
similarity index 94%
rename from DoubleDeckerBus/AbstractStrategy.cs
rename to DoubleDeckerBus/Move_Strategy/AbstractStrategy.cs
index e3d4f72..2cc7507 100644
--- a/DoubleDeckerBus/AbstractStrategy.cs
+++ b/DoubleDeckerBus/Move_Strategy/AbstractStrategy.cs
@@ -1,14 +1,12 @@
-using DoubleDeckerbus.MovementStrategy;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using DoubleDeckerbus.Entities;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
-using DoubleDeckerbus.DrawingObjects;
-
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
public abstract class AbstractStrategy
{
diff --git a/DoubleDeckerBus/DrawingObjectBus.cs b/DoubleDeckerBus/Move_Strategy/DrawingObjectBus.cs
similarity index 80%
rename from DoubleDeckerBus/DrawingObjectBus.cs
rename to DoubleDeckerBus/Move_Strategy/DrawingObjectBus.cs
index 2f081f9..067f6c9 100644
--- a/DoubleDeckerBus/DrawingObjectBus.cs
+++ b/DoubleDeckerBus/Move_Strategy/DrawingObjectBus.cs
@@ -1,14 +1,14 @@
-using DoubleDeckerbus.MovementStrategy;
-using DoubleDeckerbus;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
-using DoubleDeckerbus.DrawingObjects;
-namespace DoubleDeckerbus.MovementStrategy
+using DoubleDeckerbus.Entities;
+using DoubleDeckerbus.Drawing;
+
+namespace DoubleDeckerbus.Move_Strategy
{
public class DrawingObjectBus : IMoveableObject
{
@@ -25,7 +25,7 @@ namespace DoubleDeckerbus.MovementStrategy
{
return null;
}
- return new ObjectParameters(_drawingBus.GetPosX,_drawingBus.GetPosY, _drawingBus.GetWidth, _drawingBus.GetHeight);
+ return new ObjectParameters(_drawingBus.GetPosX, _drawingBus.GetPosY, _drawingBus.GetWidth, _drawingBus.GetHeight);
}
}
public int GetStep => (int)(_drawingBus?.EntityBus?.Step ?? 0);
diff --git a/DoubleDeckerBus/IMoveableObject.cs b/DoubleDeckerBus/Move_Strategy/IMoveableObject.cs
similarity index 77%
rename from DoubleDeckerBus/IMoveableObject.cs
rename to DoubleDeckerBus/Move_Strategy/IMoveableObject.cs
index 263b464..c49acde 100644
--- a/DoubleDeckerBus/IMoveableObject.cs
+++ b/DoubleDeckerBus/Move_Strategy/IMoveableObject.cs
@@ -4,9 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using DoubleDeckerbus.DrawingObjects;
+using DoubleDeckerbus.Drawing;
+using DoubleDeckerbus.Entities;
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
public interface IMoveableObject
{
diff --git a/DoubleDeckerBus/MoveToBorder.cs b/DoubleDeckerBus/Move_Strategy/MoveToBorder.cs
similarity index 93%
rename from DoubleDeckerBus/MoveToBorder.cs
rename to DoubleDeckerBus/Move_Strategy/MoveToBorder.cs
index e7fa9b3..51fdcd9 100644
--- a/DoubleDeckerBus/MoveToBorder.cs
+++ b/DoubleDeckerBus/Move_Strategy/MoveToBorder.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
internal class MoveToBorder : AbstractStrategy
{
@@ -18,7 +18,7 @@ namespace DoubleDeckerbus.MovementStrategy
return objParams.RightBorder <= FieldWidth &&
objParams.RightBorder + GetStep() >= FieldWidth &&
objParams.DownBorder <= FieldHeight &&
- objParams.DownBorder + GetStep() >= FieldHeight;
+ objParams.DownBorder + GetStep() >= FieldHeight;
}
protected override void MoveToTarget()
{
@@ -38,7 +38,6 @@ namespace DoubleDeckerbus.MovementStrategy
{
MoveRight();
}
-
}
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
if (Math.Abs(diffY) > GetStep())
diff --git a/DoubleDeckerBus/MoveToCenter.cs b/DoubleDeckerBus/Move_Strategy/MoveToCenter.cs
similarity index 97%
rename from DoubleDeckerBus/MoveToCenter.cs
rename to DoubleDeckerBus/Move_Strategy/MoveToCenter.cs
index beebbe9..b3b0363 100644
--- a/DoubleDeckerBus/MoveToCenter.cs
+++ b/DoubleDeckerBus/Move_Strategy/MoveToCenter.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
public class MoveToCenter : AbstractStrategy
{
diff --git a/DoubleDeckerBus/ObjectParameters.cs b/DoubleDeckerBus/Move_Strategy/ObjectParameters.cs
similarity index 94%
rename from DoubleDeckerBus/ObjectParameters.cs
rename to DoubleDeckerBus/Move_Strategy/ObjectParameters.cs
index 1aaace0..dde9984 100644
--- a/DoubleDeckerBus/ObjectParameters.cs
+++ b/DoubleDeckerBus/Move_Strategy/ObjectParameters.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
public class ObjectParameters
{
diff --git a/DoubleDeckerBus/Status.cs b/DoubleDeckerBus/Move_Strategy/Status.cs
similarity index 82%
rename from DoubleDeckerBus/Status.cs
rename to DoubleDeckerBus/Move_Strategy/Status.cs
index 2f4640b..5d276ca 100644
--- a/DoubleDeckerBus/Status.cs
+++ b/DoubleDeckerBus/Move_Strategy/Status.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DoubleDeckerbus.MovementStrategy
+namespace DoubleDeckerbus.Move_Strategy
{
public enum Status
{
@@ -12,4 +12,4 @@ namespace DoubleDeckerbus.MovementStrategy
InProgress,
Finish
}
-}
+}
\ No newline at end of file
diff --git a/DoubleDeckerBus/Program.cs b/DoubleDeckerBus/Program.cs
index d4e484f..598623f 100644
--- a/DoubleDeckerBus/Program.cs
+++ b/DoubleDeckerBus/Program.cs
@@ -11,7 +11,7 @@ namespace DoubleDeckerbus
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormBusCollection());
+ Application.Run(new FormDoubleDeckerbusCollection());
}
}
}
\ No newline at end of file
diff --git a/DoubleDeckerBus/Properties/Resources.Designer.cs b/DoubleDeckerBus/Properties/Resources.Designer.cs
index cd9ff47..588fb30 100644
--- a/DoubleDeckerBus/Properties/Resources.Designer.cs
+++ b/DoubleDeckerBus/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace DoubleDeckerBus.Properties {
+namespace DoubleDeckerbus.Properties {
using System;
@@ -39,7 +39,7 @@ namespace DoubleDeckerBus.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DoubleDeckerBus.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DoubleDeckerbus.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -63,9 +63,9 @@ namespace DoubleDeckerBus.Properties {
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ArrowDown {
+ internal static System.Drawing.Bitmap стрелка_вверх {
get {
- object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
+ object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
@@ -73,7 +73,7 @@ namespace DoubleDeckerBus.Properties {
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ArrowLeft {
+ internal static System.Drawing.Bitmap стрелка_влево {
get {
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
@@ -83,9 +83,9 @@ namespace DoubleDeckerBus.Properties {
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ArrowRight {
+ internal static System.Drawing.Bitmap стрелка_вниз {
get {
- object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
+ object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
@@ -93,9 +93,9 @@ namespace DoubleDeckerBus.Properties {
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ArrowUp {
+ internal static System.Drawing.Bitmap стрелка_вправо {
get {
- object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
+ object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
diff --git a/DoubleDeckerBus/Properties/Resources.resx b/DoubleDeckerBus/Properties/Resources.resx
index c998c95..aebcb60 100644
--- a/DoubleDeckerBus/Properties/Resources.resx
+++ b/DoubleDeckerBus/Properties/Resources.resx
@@ -118,16 +118,16 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/DoubleDeckerBus/SetGeneric.cs b/DoubleDeckerBus/SetGeneric.cs
deleted file mode 100644
index 6a0415f..0000000
--- a/DoubleDeckerBus/SetGeneric.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DoubleDeckerbus
-{
- internal class SetGeneric
- where T : class
-
- {
- private readonly T?[] _places;
- public int Count => _places.Length - 1;
- public SetGeneric(int count)
- {
- _places = new T?[count];
- }
- public int Insert(T bus)
- {
- int pos = Count - 1;
- if (_places[Count] != null)
- {
- for (int i = pos; i > 0; --i)
- {
- if (_places[i] == null)
- {
- pos = i;
- break;
- }
- }
- for (int i = pos + 1; i <= Count; ++i)
- {
- _places[i - 1] = _places[i];
- }
- }
- _places[Count] = bus;
- return pos;
- }
- public bool Insert(T bus, int position)
- {
- if (position < 0 || position > Count)
- {
- return false;
- }
- if (_places[Count] != null)
- {
- int pos = Count;
- for (int i = Count; i > 0; --i)
- {
-
- if (_places[i] == null)
- {
- pos = i;
- break;
- }
- }
- for (int i = Count; i >= pos; --i)
- {
- _places[i - 1] = _places[i];
- }
- }
- _places[Count] = bus;
- return true;
- }
- public bool Remove(int position)
- {
- if (position < 0 || position > Count)
- {
- return false;
- }
- _places[position] = null;
-
- return true;
- }
- public T? Get(int position)
- {
- if (position < 0 || position > Count)
- {
- return null;
- }
- return _places[position];
- }
- }
-}