diff --git a/LabOOP_1/LabOOP_1/DirectionType.cs b/LabOOP_1/LabOOP_1/DirectionType.cs deleted file mode 100644 index b2f3d36..0000000 --- a/LabOOP_1/LabOOP_1/DirectionType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LabOOP_1 -{ - public enum DirectionType - { - /// - /// Вверх - /// - Up = 1, - - /// - /// Вниз - /// - Down = 2, - - /// - /// Влево - /// - Left = 3, - - /// - /// Вправо - /// - Right = 4 - } -} - diff --git a/LabOOP_1/LabOOP_1/Drawnings/DirectionType.cs b/LabOOP_1/LabOOP_1/Drawnings/DirectionType.cs new file mode 100644 index 0000000..e1f8a2d --- /dev/null +++ b/LabOOP_1/LabOOP_1/Drawnings/DirectionType.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.Drawnings; + +public enum DirectionType +{ + + /// + /// Вверх + /// + Unknow = -1, + + + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} + diff --git a/LabOOP_1/LabOOP_1/Drawnings/DrawningCatamaran.cs b/LabOOP_1/LabOOP_1/Drawnings/DrawningCatamaran.cs new file mode 100644 index 0000000..9e842c9 --- /dev/null +++ b/LabOOP_1/LabOOP_1/Drawnings/DrawningCatamaran.cs @@ -0,0 +1,81 @@ +using Project_Catamaran.Entities; +using System.Runtime.InteropServices; +using System.Xml.Resolvers; + +namespace Project_Catamaran.Drawnings; + +/// +/// Класс, отвечающий за прорисовку и перемещение объекта-сущности +/// +public class DrawningCatamaran : DrawningSimpleCatamaran + +/// +/// Конструктор +/// +/// Скорость +/// Вес катамарана +/// Основной цвет +/// Дополнительный цвет +/// Признак наличия палубы +/// Признак наличия мачты +/// Признак наличия поплавков + + +{ + + + + public DrawningCatamaran(int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool sail, bool deck) : base(100, 90, bodyColor) + { + EntitySimpleCatamaran = new EntityCatamaran(speed, weight, bodyColor, additionalColor, floats, sail, deck); + } + + + + public override void DrawTransport(Graphics g) + { + if (EntitySimpleCatamaran == null || EntitySimpleCatamaran is not EntityCatamaran catamaran || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + pen.Width = 2; + Brush additionalBrush = new SolidBrush(catamaran.AdditionalColor); + + // палуба + if (catamaran.Deck) + { + g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 40, 60, 20); + } + + + if (catamaran.Sail) + { + g.DrawLine(pen, _startPosX.Value + 40, _startPosY.Value + 50, _startPosX.Value + 75, _startPosY.Value + 30); + g.DrawLine(pen, _startPosX.Value + 75, _startPosY.Value + 30, _startPosX.Value + 110, _startPosY.Value + 35); + g.DrawLine(pen, _startPosX.Value + 110, _startPosY.Value + 35, _startPosX.Value + 50, _startPosY.Value + 40); + } + + _startPosX += 10; + _startPosY += 10; + + base.DrawTransport(g); + + _startPosX -= 10; + _startPosY -= 10; + + if (catamaran.Floats) + { + g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 60, _startPosX.Value + 45, _startPosY.Value + 75); + g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 40, _startPosX.Value + 45, _startPosY.Value + 25); + g.DrawEllipse(pen, _startPosX.Value + 0, _startPosY.Value + 75, 100, 15); + g.DrawEllipse(pen, _startPosX.Value + 0, _startPosY.Value + 10, 100, 15); + + g.FillEllipse(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 75, 100, 15); + g.FillEllipse(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 10, 100, 15); + + + } + } +} \ No newline at end of file diff --git a/LabOOP_1/LabOOP_1/DrawningCatamaran.cs b/LabOOP_1/LabOOP_1/Drawnings/DrawningSimpleCatamaran.cs similarity index 50% rename from LabOOP_1/LabOOP_1/DrawningCatamaran.cs rename to LabOOP_1/LabOOP_1/Drawnings/DrawningSimpleCatamaran.cs index 1a75fa1..157da07 100644 --- a/LabOOP_1/LabOOP_1/DrawningCatamaran.cs +++ b/LabOOP_1/LabOOP_1/Drawnings/DrawningSimpleCatamaran.cs @@ -1,17 +1,18 @@ -using LabOOP_1; -using System.Xml.Resolvers; +using Project_Catamaran.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -namespace ProjectCatamaran; +namespace Project_Catamaran.Drawnings; -/// -/// Класс, отвечающий за прорисовку и перемещение объекта-сущности -/// -public class DrawningCatamaran +public class DrawningSimpleCatamaran { /// /// Класс-сущность /// - public EntityCatamaran? EntityCatamaran { get; private set; } + public EntitySimpleCatamaran? EntitySimpleCatamaran { get; protected set; } /// /// Ширина окна @@ -26,43 +27,88 @@ public class DrawningCatamaran /// /// Левая координата прорисовки катамарана /// - private int? _startPosX; + protected int? _startPosX; /// /// Верхняя кооридната прорисовки катамарана /// - private int? _startPosY; + protected int? _startPosY; /// /// Ширина прорисовки катамарана /// - private readonly int _drawningCatamaranWidth = 110; + private readonly int _drawningCatamaranWidth = 100; /// /// Высота прорисовки катамарана /// - private readonly int _drawningCatamaranHeight = 90; + private readonly int _drawningCatamaranHeight = 85; + /// - /// Инициализация свойств + /// Координата X объекта /// - /// Скорость - /// Вес - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия обвеса - /// Признак наличия мачты - /// Признак наличия поплавков - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool sail, bool floats) + public int? GetPosX => _startPosX; + + /// + /// Координата Y объекта + /// + public int? GetPosY => _startPosY; + + /// + /// Ширина объекта + /// + public int GetWidth => _drawningCatamaranWidth; + + /// + /// Высота объекта + /// + public int GetHeight => _drawningCatamaranHeight; + + /// + /// Пустой конструктор + /// + + + /// + /// Пустой конструктор + /// + /// + private DrawningSimpleCatamaran() { - EntityCatamaran = new EntityCatamaran(); - EntityCatamaran.Init(speed, weight, bodyColor, additionalColor, bodyKit, sail, floats); _pictureWidth = null; _pictureHeight = null; _startPosX = null; _startPosY = null; } + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + + public DrawningSimpleCatamaran(int speed, double weight, Color bodyColor) : this() + { + EntitySimpleCatamaran = new EntitySimpleCatamaran(speed, weight, bodyColor); + + } + + /// + /// Конструктор для наследников + /// + /// Ширина прорисовки автомобиля + /// Высота прорисовки автомобиля + + protected DrawningSimpleCatamaran(int drawningCatamaranWidth, int drawningCatamaranHeight) : this() + { + _drawningCatamaranWidth = drawningCatamaranWidth; + _drawningCatamaranHeight = drawningCatamaranHeight; + + } + + /// /// Установка границ поля /// @@ -122,11 +168,11 @@ public class DrawningCatamaran } } - - // TODO если при установке объекта в эти координаты, он будет "выходить" за границы формы - // то надо изменить координаты, чтобы он оставался в этих границах - _startPosX = x; - _startPosY = y; + + // TODO если при установке объекта в эти координаты, он будет "выходить" за границы формы + // то надо изменить координаты, чтобы он оставался в этих границах + _startPosX = x; + _startPosY = y; } /// @@ -136,7 +182,7 @@ public class DrawningCatamaran /// true - перемещене выполнено, false - перемещение невозможно public bool MoveTransport(DirectionType direction) { - if (EntityCatamaran == null || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntitySimpleCatamaran == null || !_startPosX.HasValue || !_startPosY.HasValue) { return false; } @@ -145,31 +191,31 @@ public class DrawningCatamaran { //влево case DirectionType.Left: - if (_startPosX.Value - EntityCatamaran.Step > 0) + if (_startPosX.Value - EntitySimpleCatamaran.Step > 0) { - _startPosX -= (int)EntityCatamaran.Step; + _startPosX -= (int)EntitySimpleCatamaran.Step; } return true; //вверх case DirectionType.Up: - if (_startPosY.Value - EntityCatamaran.Step > 0) + if (_startPosY.Value - EntitySimpleCatamaran.Step > 0) { - _startPosY -= (int)EntityCatamaran.Step; + _startPosY -= (int)EntitySimpleCatamaran.Step; } return true; // вправо case DirectionType.Right: - if (_startPosX.Value + EntityCatamaran.Step + _drawningCatamaranWidth < _pictureWidth) + if (_startPosX.Value + EntitySimpleCatamaran.Step + _drawningCatamaranWidth < _pictureWidth) { - _startPosX += (int)EntityCatamaran.Step; + _startPosX += (int)EntitySimpleCatamaran.Step; } return true; //вниз case DirectionType.Down: - if (_startPosY.Value + EntityCatamaran.Step + _drawningCatamaranHeight < _pictureHeight) + if (_startPosY.Value + EntitySimpleCatamaran.Step + _drawningCatamaranHeight < _pictureHeight) { - _startPosY += (int)EntityCatamaran.Step; + _startPosY += (int)EntitySimpleCatamaran.Step; } return true; default: @@ -181,57 +227,30 @@ public class DrawningCatamaran /// Прорисовка объекта /// /// - public void DrawTransport(Graphics g) + public virtual void DrawTransport(Graphics g) { - if (EntityCatamaran == null || !_startPosX.HasValue || !_startPosY.HasValue) - { - return; - } + Pen pen = new(Color.Black); pen.Width = 2; - Brush additionalBrush = new SolidBrush(EntityCatamaran.AdditionalColor); - - // палуба - if (EntityCatamaran.Deck) - { - g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 40, 60, 20); - } + Brush simpleBrush = new SolidBrush(EntitySimpleCatamaran.BodyColor); - if (EntityCatamaran.Sail) - { - g.DrawLine(pen, _startPosX.Value + 40, _startPosY.Value + 50, _startPosX.Value + 75, _startPosY.Value + 30); - g.DrawLine(pen, _startPosX.Value + 75, _startPosY.Value + 30, _startPosX.Value + 110, _startPosY.Value + 35); - g.DrawLine(pen, _startPosX.Value + 110, _startPosY.Value + 35, _startPosX.Value + 50, _startPosY.Value + 40); - } - //границы судна - g.DrawLine(pen, _startPosX.Value + 10, _startPosY.Value + 60, _startPosX.Value + 80, _startPosY.Value + 60); - g.DrawLine(pen, _startPosX.Value + 10, _startPosY.Value + 60, _startPosX.Value + 10, _startPosY.Value + 40); - g.DrawLine(pen, _startPosX.Value + 10, _startPosY.Value + 40, _startPosX.Value + 80, _startPosY.Value + 40); - g.DrawLine(pen, _startPosX.Value + 80, _startPosY.Value + 40, _startPosX.Value + 100, _startPosY.Value + 50); - g.DrawLine(pen, _startPosX.Value + 80, _startPosY.Value + 60, _startPosX.Value + 100, _startPosY.Value + 50); + g.DrawLine(pen, _startPosX.Value, _startPosY.Value + 50, _startPosX.Value + 70, _startPosY.Value + 50); + g.DrawLine(pen, _startPosX.Value, _startPosY.Value + 50, _startPosX.Value, _startPosY.Value + 30); + g.DrawLine(pen, _startPosX.Value, _startPosY.Value + 30, _startPosX.Value + 70, _startPosY.Value + 30); + g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 30, _startPosX.Value + 90, _startPosY.Value + 40); + g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 50, _startPosX.Value + 90, _startPosY.Value + 40); //отрисовка цвета палубы - g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 40, 60, 20); - /// g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 40, 60, 20); + g.FillEllipse(simpleBrush, _startPosX.Value + 5, _startPosY.Value + 30, 60, 20); // отрисовка поплавков - if (EntityCatamaran.Floats) - { - g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 60, _startPosX.Value + 45, _startPosY.Value + 75); - g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 40, _startPosX.Value + 45, _startPosY.Value + 25); - g.DrawEllipse(pen, _startPosX.Value + 0, _startPosY.Value + 75, 100, 15); - g.DrawEllipse(pen, _startPosX.Value + 0, _startPosY.Value + 10, 100, 15); - g.FillEllipse(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 75, 100, 15); - g.FillEllipse(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 10, 100, 15); - - } } -} \ No newline at end of file +} diff --git a/LabOOP_1/LabOOP_1/EntityCatamaran.cs b/LabOOP_1/LabOOP_1/Entities/EntityCatamaran.cs similarity index 60% rename from LabOOP_1/LabOOP_1/EntityCatamaran.cs rename to LabOOP_1/LabOOP_1/Entities/EntityCatamaran.cs index 90870ce..82021e8 100644 --- a/LabOOP_1/LabOOP_1/EntityCatamaran.cs +++ b/LabOOP_1/LabOOP_1/Entities/EntityCatamaran.cs @@ -4,24 +4,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LabOOP_1; +namespace Project_Catamaran.Entities; -public class EntityCatamaran +public class EntityCatamaran : EntitySimpleCatamaran { - /// - /// Скорость - /// - public int Speed { get; private set; } - - /// - /// Вес - /// - public double Weight { get; private set; } - - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } /// /// Доп цвет @@ -34,19 +20,17 @@ public class EntityCatamaran public bool Deck { get; private set; } /// - /// Признак (опция) наличия + /// Признак (опция) наличия паруса /// public bool Sail { get; private set; } /// - /// Признак (опция) наличия мачты + /// Признак (опция) наличия поплавков /// public bool Floats { get; private set; } - /// - /// Шаг перемещения катамарана - /// - public double Step => Speed * 100 / Weight; + + /// /// Инициализация полей объекта-класса катамарана @@ -58,15 +42,13 @@ public class EntityCatamaran /// Признак наличия палубы /// Признак наличия мачты /// Признак наличия поплавков - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool deck, bool sail, bool floats) + public EntityCatamaran(int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool sail, bool deck) : base(speed, weight, bodyColor) { - Speed = speed; - Weight = weight; - BodyColor = bodyColor; AdditionalColor = additionalColor; Deck = deck; Sail = sail; Floats = floats; + } } diff --git a/LabOOP_1/LabOOP_1/Entities/EntitySimpleCatamaran.cs b/LabOOP_1/LabOOP_1/Entities/EntitySimpleCatamaran.cs new file mode 100644 index 0000000..59824bf --- /dev/null +++ b/LabOOP_1/LabOOP_1/Entities/EntitySimpleCatamaran.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.Entities; + +/// +/// Класс-сущность Простой Катамаран +/// + +public class EntitySimpleCatamaran +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + + /// + /// Вес + /// + public double Weight { get; private set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения катамарана + /// + public double Step => Speed * 100 / Weight; + + + /// + /// Конструктор сущности + /// + /// Скорость + /// Вес катамарана + /// Основной цвет + + public EntitySimpleCatamaran(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + } +} + + diff --git a/LabOOP_1/LabOOP_1/FormCatamaran.Designer.cs b/LabOOP_1/LabOOP_1/FormCatamaran.Designer.cs index 51942c9..7f1ba4e 100644 --- a/LabOOP_1/LabOOP_1/FormCatamaran.Designer.cs +++ b/LabOOP_1/LabOOP_1/FormCatamaran.Designer.cs @@ -1,133 +1,172 @@ -namespace LabOOP_1 +namespace Project_Catamaran; + +partial class FormCatamaran { - partial class FormCatamaran + /// + /// 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) { - /// - /// 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)) { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); + components.Dispose(); } - - #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() - { - buttonCreate = new Button(); - buttonLeft = new Button(); - buttonDown = new Button(); - buttonUp = new Button(); - buttonRight = new Button(); - pictureBoxCatamaran = new PictureBox(); - ((System.ComponentModel.ISupportInitialize)pictureBoxCatamaran).BeginInit(); - SuspendLayout(); - // - // buttonCreate - // - buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonCreate.Location = new Point(12, 404); - buttonCreate.Name = "buttonCreate"; - buttonCreate.Size = new Size(112, 34); - buttonCreate.TabIndex = 1; - buttonCreate.Text = "Заспавнить"; - buttonCreate.UseVisualStyleBackColor = true; - buttonCreate.Click += buttonCreate_Click; - // - // buttonLeft - // - buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonLeft.BackgroundImage = Properties.Resources.left; - buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; - buttonLeft.Location = new Point(641, 394); - buttonLeft.Name = "buttonLeft"; - buttonLeft.Size = new Size(35, 35); - buttonLeft.TabIndex = 2; - buttonLeft.UseVisualStyleBackColor = true; - buttonLeft.Click += ButtonMove_Click; - // - // buttonDown - // - buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonDown.BackgroundImage = Properties.Resources.down; - buttonDown.BackgroundImageLayout = ImageLayout.Stretch; - buttonDown.Location = new Point(682, 394); - buttonDown.Name = "buttonDown"; - buttonDown.Size = new Size(35, 35); - buttonDown.TabIndex = 3; - buttonDown.UseVisualStyleBackColor = true; - buttonDown.Click += ButtonMove_Click; - // - // buttonUp - // - buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonUp.BackgroundImage = Properties.Resources.up; - buttonUp.BackgroundImageLayout = ImageLayout.Stretch; - buttonUp.Location = new Point(682, 353); - buttonUp.Name = "buttonUp"; - buttonUp.Size = new Size(35, 35); - buttonUp.TabIndex = 4; - buttonUp.UseVisualStyleBackColor = true; - buttonUp.Click += ButtonMove_Click; - // - // buttonRight - // - buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonRight.BackgroundImage = Properties.Resources.right; - buttonRight.BackgroundImageLayout = ImageLayout.Stretch; - buttonRight.Location = new Point(723, 394); - buttonRight.Name = "buttonRight"; - buttonRight.Size = new Size(35, 35); - buttonRight.TabIndex = 5; - buttonRight.UseVisualStyleBackColor = true; - buttonRight.Click += ButtonMove_Click; - // - // pictureBoxCatamaran - // - pictureBoxCatamaran.Dock = DockStyle.Fill; - pictureBoxCatamaran.Location = new Point(0, 0); - pictureBoxCatamaran.Name = "pictureBoxCatamaran"; - pictureBoxCatamaran.Size = new Size(800, 450); - pictureBoxCatamaran.TabIndex = 6; - pictureBoxCatamaran.TabStop = false; - // - // FormCatamaran - // - AutoScaleDimensions = new SizeF(10F, 25F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(buttonRight); - Controls.Add(buttonUp); - Controls.Add(buttonDown); - Controls.Add(buttonLeft); - Controls.Add(buttonCreate); - Controls.Add(pictureBoxCatamaran); - Name = "FormCatamaran"; - Text = "Катамаран"; - ((System.ComponentModel.ISupportInitialize)pictureBoxCatamaran).EndInit(); - ResumeLayout(false); - } - - #endregion - private Button buttonCreate; - private Button buttonLeft; - private Button buttonDown; - private Button buttonUp; - private Button buttonRight; - private PictureBox pictureBoxCatamaran; + 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() + { + buttonCreateSimpleCatamaran = new Button(); + buttonLeft = new Button(); + buttonDown = new Button(); + buttonUp = new Button(); + buttonRight = new Button(); + pictureBoxCatamaran = new PictureBox(); + buttonCreateCatamaran = new Button(); + comboBoxStrategy = new ComboBox(); + buttonStrategyStep = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxCatamaran).BeginInit(); + SuspendLayout(); + // + // buttonCreateSimpleCatamaran + // + buttonCreateSimpleCatamaran.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreateSimpleCatamaran.Location = new Point(12, 404); + buttonCreateSimpleCatamaran.Name = "buttonCreateSimpleCatamaran"; + buttonCreateSimpleCatamaran.Size = new Size(260, 34); + buttonCreateSimpleCatamaran.TabIndex = 1; + buttonCreateSimpleCatamaran.Text = "Создать простой катамаран"; + buttonCreateSimpleCatamaran.UseVisualStyleBackColor = true; + buttonCreateSimpleCatamaran.Click += buttonCreateSimpleCatamaran_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.left; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(641, 394); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(35, 35); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.down; + buttonDown.BackgroundImageLayout = ImageLayout.Stretch; + buttonDown.Location = new Point(682, 394); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(35, 35); + buttonDown.TabIndex = 3; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.up; + buttonUp.BackgroundImageLayout = ImageLayout.Stretch; + buttonUp.Location = new Point(682, 353); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(35, 35); + buttonUp.TabIndex = 4; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.right; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(723, 394); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(35, 35); + buttonRight.TabIndex = 5; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // pictureBoxCatamaran + // + pictureBoxCatamaran.Dock = DockStyle.Fill; + pictureBoxCatamaran.Location = new Point(0, 0); + pictureBoxCatamaran.Name = "pictureBoxCatamaran"; + pictureBoxCatamaran.Size = new Size(800, 450); + pictureBoxCatamaran.TabIndex = 6; + pictureBoxCatamaran.TabStop = false; + // + // buttonCreateCatamaran + // + buttonCreateCatamaran.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreateCatamaran.Location = new Point(291, 404); + buttonCreateCatamaran.Name = "buttonCreateCatamaran"; + buttonCreateCatamaran.Size = new Size(202, 34); + buttonCreateCatamaran.TabIndex = 7; + buttonCreateCatamaran.Text = "Создать катамаран"; + buttonCreateCatamaran.UseVisualStyleBackColor = true; + buttonCreateCatamaran.Click += buttonCreateCatamaran_Click; + // + // comboBoxStrategy + // + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(606, 12); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(182, 33); + comboBoxStrategy.TabIndex = 8; + // + // buttonStrategyStep + // + buttonStrategyStep.Location = new Point(676, 51); + buttonStrategyStep.Name = "buttonStrategyStep"; + buttonStrategyStep.Size = new Size(112, 34); + buttonStrategyStep.TabIndex = 9; + buttonStrategyStep.Text = "Шаг"; + buttonStrategyStep.UseVisualStyleBackColor = true; + buttonStrategyStep.Click += buttonStrategyStep_Click; + // + // FormCatamaran + // + AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(buttonStrategyStep); + Controls.Add(comboBoxStrategy); + Controls.Add(buttonCreateCatamaran); + Controls.Add(buttonRight); + Controls.Add(buttonUp); + Controls.Add(buttonDown); + Controls.Add(buttonLeft); + Controls.Add(buttonCreateSimpleCatamaran); + Controls.Add(pictureBoxCatamaran); + Name = "FormCatamaran"; + Text = "Катамаран"; + ((System.ComponentModel.ISupportInitialize)pictureBoxCatamaran).EndInit(); + ResumeLayout(false); + } + + #endregion + private Button buttonCreateSimpleCatamaran; + private Button buttonLeft; + private Button buttonDown; + private Button buttonUp; + private Button buttonRight; + private PictureBox pictureBoxCatamaran; + private Button buttonCreateCatamaran; + private ComboBox comboBoxStrategy; + private Button buttonStrategyStep; } \ No newline at end of file diff --git a/LabOOP_1/LabOOP_1/FormCatamaran.cs b/LabOOP_1/LabOOP_1/FormCatamaran.cs index 5208354..b3b8fec 100644 --- a/LabOOP_1/LabOOP_1/FormCatamaran.cs +++ b/LabOOP_1/LabOOP_1/FormCatamaran.cs @@ -1,4 +1,5 @@ -using ProjectCatamaran; +using Project_Catamaran.Drawnings; +using Project_Catamaran.MovementStrategy; using System; using System.Collections.Generic; using System.ComponentModel; @@ -9,83 +10,155 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace LabOOP_1 +namespace Project_Catamaran; + +public partial class FormCatamaran : Form { - public partial class FormCatamaran : Form + + private DrawningSimpleCatamaran? _drawningSimpleCatamaran; + + /// + /// Стратегия перемещения + /// + + private AbstractStrategy? _strategy; + + public FormCatamaran() { - private DrawningCatamaran? _drawningCatamaran; + InitializeComponent(); + _strategy = null; + } - public FormCatamaran() + private void Draw() + { + if (_drawningSimpleCatamaran == null) { - InitializeComponent(); + return; } - private void Draw() + Bitmap bmp = new(pictureBoxCatamaran.Width, pictureBoxCatamaran.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningSimpleCatamaran.DrawTransport(gr); + pictureBoxCatamaran.Image = bmp; + } + + /// + /// Обработка нажатия кнопки "Создать" + /// + /// + /// + private void CreateObject(string type) + { + Random random = new(); + switch (type) { - if (_drawningCatamaran == null) - { + case nameof(DrawningSimpleCatamaran): + _drawningSimpleCatamaran = new DrawningSimpleCatamaran(random.Next(30, 70), random.Next(100, 500), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); + break; + case nameof(DrawningCatamaran): + _drawningSimpleCatamaran = new DrawningCatamaran(random.Next(30, 70), random.Next(100, 500), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); + break; + default: return; - } - Bitmap bmp = new(pictureBoxCatamaran.Width, pictureBoxCatamaran.Height); - Graphics gr = Graphics.FromImage(bmp); - _drawningCatamaran.DrawTransport(gr); - pictureBoxCatamaran.Image = bmp; + } + _drawningSimpleCatamaran.SetPictureSize(pictureBoxCatamaran.Width, pictureBoxCatamaran.Height); + _drawningSimpleCatamaran.SetPosition(random.Next(10, 100), random.Next(10, 100)); + _strategy = null; + comboBoxStrategy.Enabled = true; + Draw(); + + } + /// + /// Обработка кнопки "Создать обычнвй катамаран" + /// + /// + /// + + private void buttonCreateSimpleCatamaran_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSimpleCatamaran)); + /// + /// Обработка кнопки "Создать катамаран" + /// + /// + /// + + private void buttonCreateCatamaran_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCatamaran)); + + + /// + /// Перемещение объекта по форме (нажатие кнопок навигации) + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningSimpleCatamaran == null) + { + return; } - /// - /// Обработка нажатия кнопки "Создать" - /// - /// - /// - private void buttonCreate_Click(object sender, EventArgs e) + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = _drawningSimpleCatamaran.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = _drawningSimpleCatamaran.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = _drawningSimpleCatamaran.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = _drawningSimpleCatamaran.MoveTransport(DirectionType.Right); + break; + } + + if (result) { - Random random = new(); - _drawningCatamaran = new DrawningCatamaran(); - _drawningCatamaran.Init(random.Next(100, 300), random.Next(1000, 3000), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), - Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); - _drawningCatamaran.SetPictureSize(pictureBoxCatamaran.Width, pictureBoxCatamaran.Height); - _drawningCatamaran.SetPosition(random.Next(10, 100), random.Next(10, 100)); Draw(); } - - /// - /// Перемещение объекта по форме (нажатие кнопок навигации) - /// - /// - /// - private void ButtonMove_Click(object sender, EventArgs e) - { - if (_drawningCatamaran == null) - { - return; - } - - string name = ((Button)sender)?.Name ?? string.Empty; - bool result = false; - switch (name) - { - case "buttonUp": - result = _drawningCatamaran.MoveTransport(DirectionType.Up); - break; - case "buttonDown": - result = _drawningCatamaran.MoveTransport(DirectionType.Down); - break; - case "buttonLeft": - result = _drawningCatamaran.MoveTransport(DirectionType.Left); - break; - case "buttonRight": - result = _drawningCatamaran.MoveTransport(DirectionType.Right); - break; - } - - if (result) - { - Draw(); - } - } } -} + private void buttonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningSimpleCatamaran == null) + { + return; + } + + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) + { + return; + } + _strategy.SetData(new MoveableSimpleCatamaran(_drawningSimpleCatamaran), pictureBoxCatamaran.Width, pictureBoxCatamaran.Height); + } + + if (_strategy == null) + { + return; + } + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + + if (_strategy.GetStatus() == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } +} \ No newline at end of file diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/AbstractStrategy.cs b/LabOOP_1/LabOOP_1/MovementStrategy/AbstractStrategy.cs new file mode 100644 index 0000000..0f8d6ee --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/AbstractStrategy.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public abstract class AbstractStrategy +{ + /// + /// Перемещаемый объект + /// + private IMoveableObject? _moveableObject; + + /// + /// Статус перемещения + /// + private StrategyStatus _state = StrategyStatus.NotInit; + + /// + /// Ширина поля + /// + protected int FieldWidth { get; private set; } + + /// + /// Высота поля + /// + protected int FieldHeight { get; private set; } + + /// + /// Статус перемещения + /// + public StrategyStatus GetStatus() { return _state; } + + /// + /// Установка данных + /// + /// Перемещаемый объект + /// Ширина поля + /// Высота поля + public void SetData(IMoveableObject moveableObject, int width, int height) + { + if (moveableObject == null) + { + _state = StrategyStatus.NotInit; + return; + } + + _state = StrategyStatus.InProgress; + _moveableObject = moveableObject; + FieldWidth = width; + FieldHeight = height; + } + + /// + /// Шаг перемещения + /// + public void MakeStep() + { + if (_state != StrategyStatus.InProgress) + { + return; + } + + if (IsTargetDestinaion()) + { + _state = StrategyStatus.Finish; + return; + } + + MoveToTarget(); + } + + /// + /// Перемещение влево + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveLeft() => MoveTo(MovementDirection.Left); + + /// + /// Перемещение вправо + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveRight() => MoveTo(MovementDirection.Right); + + /// + /// Перемещение вверх + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveUp() => MoveTo(MovementDirection.Up); + + /// + /// Перемещение вниз + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveDown() => MoveTo(MovementDirection.Down); + + /// + /// Параметры объекта + /// + protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition; + + /// + /// Шаг объекта + /// + /// + protected int? GetStep() + { + if (_state != StrategyStatus.InProgress) + { + return null; + } + return _moveableObject?.GetStep; + } + + /// + /// Перемещение к цели + /// + protected abstract void MoveToTarget(); + + /// + /// Достигнута ли цель + /// + /// + protected abstract bool IsTargetDestinaion(); + + /// + /// Попытка перемещения в требуемом направлении + /// + /// Направление + /// Результат попытки (true - удалось переместиться, false - неудача) + private bool MoveTo(MovementDirection movementDirection) + { + if (_state != StrategyStatus.InProgress) + { + return false; + } + + return _moveableObject?.TryMoveObject(movementDirection) ?? false; + } +} + diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/IMoveableObject.cs b/LabOOP_1/LabOOP_1/MovementStrategy/IMoveableObject.cs new file mode 100644 index 0000000..e79d8a2 --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/IMoveableObject.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public interface IMoveableObject +{ + /// + /// Получение координаты объекта + /// + ObjectParameters? GetObjectPosition { get; } + + /// + /// Шаг объекта + /// + int GetStep { get; } + + /// + /// Попытка переместить объект в указанном направлении + /// + /// Направление + /// true - объект перемещен, false - перемещение невозможно + bool TryMoveObject(MovementDirection direction); +} diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/MoveToBorder.cs b/LabOOP_1/LabOOP_1/MovementStrategy/MoveToBorder.cs new file mode 100644 index 0000000..898e0a6 --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/MoveToBorder.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public class MoveToBorder : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + + return objParams.RightBorder - GetStep() <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && + objParams.DownBorder - GetStep() <= FieldHeight && objParams.DownBorder + GetStep() >= FieldHeight; + } + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + + int diffX = objParams.RightBorder - FieldWidth; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + int diffY = objParams.DownBorder - FieldHeight; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + + } + } +} \ No newline at end of file diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/MoveToCenter.cs b/LabOOP_1/LabOOP_1/MovementStrategy/MoveToCenter.cs new file mode 100644 index 0000000..43dc551 --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/MoveToCenter.cs @@ -0,0 +1,59 @@ +using Project_Catamaran.MovementStrategy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public class MoveToCenter : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + + int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} + diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/MoveableSimpleCatamaran.cs b/LabOOP_1/LabOOP_1/MovementStrategy/MoveableSimpleCatamaran.cs new file mode 100644 index 0000000..30d8b90 --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/MoveableSimpleCatamaran.cs @@ -0,0 +1,66 @@ +using Project_Catamaran.Drawnings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public class MoveableSimpleCatamaran : IMoveableObject +{ + /// + /// Поле-объект класса DrawningSimpleCatamaran или его наследника + /// + private readonly DrawningSimpleCatamaran? _catamaran = null; + + /// + /// Конструктор + /// + /// Объект класса DrawningSimpleCatamaran + public MoveableSimpleCatamaran(DrawningSimpleCatamaran catamaran) + { + _catamaran = catamaran; + } + + public ObjectParameters? GetObjectPosition + { + get + { + if (_catamaran == null || _catamaran.EntitySimpleCatamaran == null || !_catamaran.GetPosX.HasValue || !_catamaran.GetPosY.HasValue) + { + return null; + } + return new ObjectParameters(_catamaran.GetPosX.Value, _catamaran.GetPosY.Value, _catamaran.GetWidth, _catamaran.GetHeight); + } + } + + public int GetStep => (int)(_catamaran?.EntitySimpleCatamaran?.Step ?? 0); + + public bool TryMoveObject(MovementDirection direction) + { + if (_catamaran == null || _catamaran.EntitySimpleCatamaran == null) + { + return false; + } + + return _catamaran.MoveTransport(GetDirectionType(direction)); + } + + /// + /// Конвертация из MovementDirection в DirectionType + /// + /// MovementDirection + /// DirectionType + private static DirectionType GetDirectionType(MovementDirection direction) + { + return direction switch + { + MovementDirection.Left => DirectionType.Left, + MovementDirection.Right => DirectionType.Right, + MovementDirection.Up => DirectionType.Up, + MovementDirection.Down => DirectionType.Down, + _ => DirectionType.Unknow, + }; + } +} diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/MovementDirection.cs b/LabOOP_1/LabOOP_1/MovementStrategy/MovementDirection.cs new file mode 100644 index 0000000..ad83e2f --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/MovementDirection.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public enum MovementDirection +{ + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} + diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/ObjectParameters.cs b/LabOOP_1/LabOOP_1/MovementStrategy/ObjectParameters.cs new file mode 100644 index 0000000..fd1337f --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/ObjectParameters.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + namespace Project_Catamaran.MovementStrategy; + +public class ObjectParameters +{ + + /// + /// Координата X + /// + private readonly int _x; + + /// + /// Координата Y + /// + private readonly int _y; + + /// + /// Ширина объекта + /// + private readonly int _width; + + /// + /// Высота объекта + /// + private readonly int _height; + + /// + /// Левая граница + /// + public int LeftBorder => _x; + + /// + /// Верхняя граница + /// + public int TopBorder => _y; + + /// + /// Правая граница + /// + public int RightBorder => _x + _width; + + /// + /// Нижняя граница + /// + public int DownBorder => _y + _height; + + /// + /// Середина объекта + /// + public int ObjectMiddleHorizontal => _x + _width / 2; + + /// + /// Середина объекта + /// + public int ObjectMiddleVertical => _y + _height / 2; + + /// + /// Конструктор + /// + /// Координата X + /// Координата Y + /// Ширина объекта + /// Высота объекта + public ObjectParameters(int x, int y, int width, int height) + { + _x = x; + _y = y; + _width = width; + _height = height; + } +} + diff --git a/LabOOP_1/LabOOP_1/MovementStrategy/StrategyStatus.cs b/LabOOP_1/LabOOP_1/MovementStrategy/StrategyStatus.cs new file mode 100644 index 0000000..5374ad0 --- /dev/null +++ b/LabOOP_1/LabOOP_1/MovementStrategy/StrategyStatus.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Project_Catamaran.MovementStrategy; + +public enum StrategyStatus +{ + /// + /// Все готово к началу + /// + NotInit, + + /// + /// Выполняется + /// + InProgress, + + /// + /// Завершено + /// + Finish + +} diff --git a/LabOOP_1/LabOOP_1/Program.cs b/LabOOP_1/LabOOP_1/Program.cs index 1352ff5..ede9231 100644 --- a/LabOOP_1/LabOOP_1/Program.cs +++ b/LabOOP_1/LabOOP_1/Program.cs @@ -1,17 +1,16 @@ -namespace LabOOP_1 +namespace Project_Catamaran; + +internal static class Program { - internal static class Program + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new FormCatamaran()); - } + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new FormCatamaran()); } } \ No newline at end of file diff --git a/LabOOP_1/LabOOP_1/LabOOP_1.csproj b/LabOOP_1/LabOOP_1/Project Catamaran.csproj similarity index 100% rename from LabOOP_1/LabOOP_1/LabOOP_1.csproj rename to LabOOP_1/LabOOP_1/Project Catamaran.csproj diff --git a/LabOOP_1/LabOOP_1/Properties/Resources.Designer.cs b/LabOOP_1/LabOOP_1/Properties/Resources.Designer.cs index 507e171..22e2e00 100644 --- a/LabOOP_1/LabOOP_1/Properties/Resources.Designer.cs +++ b/LabOOP_1/LabOOP_1/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace LabOOP_1.Properties { +namespace Project_Catamaran.Properties { using System; @@ -39,7 +39,7 @@ namespace LabOOP_1.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LabOOP_1.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Project_Catamaran.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/LabOOP_1/ProjectCatamaran.sln b/LabOOP_1/ProjectCatamaran.sln index 026f454..36c33eb 100644 --- a/LabOOP_1/ProjectCatamaran.sln +++ b/LabOOP_1/ProjectCatamaran.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34322.80 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabOOP_1", "LabOOP_1\LabOOP_1.csproj", "{0DC6AC2D-A965-444A-8795-FFA43F376E96}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Project Catamaran", "LabOOP_1\Project Catamaran.csproj", "{0DC6AC2D-A965-444A-8795-FFA43F376E96}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution