ISEbd-12_Osyagina_A.A._Simple_LabWork02 #2
@ -1,171 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat
|
||||
{
|
||||
public class DrawningMotorboat
|
||||
{
|
||||
public EntityMotorboat? EntityMotorboat { get; private set; }
|
||||
|
||||
private int? _pictureWidth;
|
||||
|
||||
private int? _pictureHeight;
|
||||
|
||||
private int? _startPosX;
|
||||
|
||||
private int? _startPosY;
|
||||
private readonly int _drawningMotorboatWidth = 160;
|
||||
|
||||
private readonly int _drawningMotorboatHeight = 60;
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool motor, bool glass)
|
||||
{
|
||||
EntityMotorboat = new EntityMotorboat();
|
||||
EntityMotorboat.Init(speed, weight, bodyColor, additionalColor,
|
||||
motor, glass);
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if (_drawningMotorboatWidth < width && _drawningMotorboatHeight < height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
SetPosition(_startPosX.Value, _startPosY.Value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x + _drawningMotorboatWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningMotorboatWidth;
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
}
|
||||
if (y + _drawningMotorboatHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningMotorboatHeight;
|
||||
}
|
||||
else if (y < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityMotorboat == null || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityMotorboat.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityMotorboat.Step;
|
||||
}
|
||||
return true;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityMotorboat.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityMotorboat.Step;
|
||||
}
|
||||
return true;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + EntityMotorboat.Step + _drawningMotorboatWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityMotorboat.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityMotorboat.Step + _drawningMotorboatHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityMotorboat.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityMotorboat == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{ return; }
|
||||
Pen pen = new(Color.Black, 1);
|
||||
Brush mainBrush = new SolidBrush(EntityMotorboat.BodyColor);
|
||||
|
||||
// корпус
|
||||
Point[] hull = new Point[]
|
||||
{
|
||||
new Point(_startPosX.Value + 5, _startPosY.Value + 0),
|
||||
new Point(_startPosX.Value + 120, _startPosY.Value + 0),
|
||||
new Point(_startPosX.Value + 160, _startPosY.Value + 35),
|
||||
new Point(_startPosX.Value + 120, _startPosY.Value + 70),
|
||||
new Point(_startPosX.Value + 5, _startPosY.Value + 70),
|
||||
};
|
||||
g.FillPolygon(mainBrush, hull);
|
||||
g.DrawPolygon(pen, hull);
|
||||
|
||||
// стекло впереди
|
||||
if (EntityMotorboat.Glass) {
|
||||
Brush glassBrush = new SolidBrush(Color.LightBlue);
|
||||
g.FillEllipse(glassBrush, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40);
|
||||
}
|
||||
|
||||
// основная часть
|
||||
Brush blockBrush = new SolidBrush(EntityMotorboat.AdditionalColor);
|
||||
g.FillRectangle(blockBrush, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40);
|
||||
|
||||
// двигатель
|
||||
if (EntityMotorboat.Motor)
|
||||
{
|
||||
Brush engineBrush = new
|
||||
SolidBrush(EntityMotorboat.AdditionalColor);
|
||||
g.FillRectangle(engineBrush, _startPosX.Value + 0, _startPosY.Value + 10, 5, 50);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 0, _startPosY.Value + 10, 5, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,10 +4,11 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat
|
||||
namespace ProjectMotorboat.Drownings
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
Unknow = -1,
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
170
ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs
Normal file
170
ProjectMotorboat/ProjectMotorboat/Drownings/DrawningBoat.cs
Normal file
@ -0,0 +1,170 @@
|
||||
using ProjectMotorboat.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.Drownings;
|
||||
|
||||
public class DrawningBoat
|
||||
{
|
||||
public EntityBoat? EntityBoat { get; protected set; }
|
||||
|
||||
private int? _pictureWidth;
|
||||
|
||||
private int? _pictureHeight;
|
||||
|
||||
protected int? _startPosX;
|
||||
|
||||
protected int? _startPosY;
|
||||
private readonly int _drawningBoatWidth = 160;
|
||||
|
||||
private readonly int _drawningBoatHeight = 60;
|
||||
|
||||
public int? GetPosX => _startPosX;
|
||||
|
||||
|
||||
public int? GetPosY => _startPosY;
|
||||
|
||||
|
||||
public int GetWidth => _drawningBoatWidth;
|
||||
|
||||
|
||||
public int GetHeight => _drawningBoatHeight;
|
||||
private DrawningBoat()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
|
||||
public DrawningBoat(int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityBoat = new EntityBoat(speed, weight, bodyColor);
|
||||
|
||||
}
|
||||
protected DrawningBoat(int drawningBoatWidth, int drawningBoatHeight) : this()
|
||||
{
|
||||
_drawningBoatWidth = drawningBoatWidth;
|
||||
_drawningBoatHeight = drawningBoatHeight;
|
||||
|
||||
}
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if (_drawningBoatWidth < width && _drawningBoatHeight < height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
SetPosition(_startPosX.Value, _startPosY.Value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x + _drawningBoatWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningBoatWidth;
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
}
|
||||
if (y + _drawningBoatHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningBoatHeight;
|
||||
}
|
||||
else if (y < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityBoat == null || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityBoat.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityBoat.Step;
|
||||
}
|
||||
return true;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityBoat.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityBoat.Step;
|
||||
}
|
||||
return true;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + EntityBoat.Step + _drawningBoatWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityBoat.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityBoat.Step + _drawningBoatHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityBoat.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityBoat == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{ return; }
|
||||
Pen pen = new(Color.Black);
|
||||
Brush mainBrush = new SolidBrush(EntityBoat.BodyColor);
|
||||
|
||||
// корпус
|
||||
Point[] hull = new Point[]
|
||||
{
|
||||
new Point(_startPosX.Value + 5, _startPosY.Value + 0),
|
||||
new Point(_startPosX.Value + 120, _startPosY.Value + 0),
|
||||
new Point(_startPosX.Value + 160, _startPosY.Value + 35),
|
||||
new Point(_startPosX.Value + 120, _startPosY.Value + 70),
|
||||
new Point(_startPosX.Value + 5, _startPosY.Value + 70),
|
||||
};
|
||||
g.FillPolygon(mainBrush, hull);
|
||||
g.DrawPolygon(pen, hull);
|
||||
|
||||
// основная часть
|
||||
Brush blockBrush = new SolidBrush(EntityBoat.BodyColor);
|
||||
g.FillRectangle(blockBrush, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 15, 80, 40);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using ProjectMotorboat.Entities;
|
||||
|
||||
namespace ProjectMotorboat.Drownings;
|
||||
|
||||
public class DrawningMotorboat : DrawningBoat
|
||||
{
|
||||
public DrawningMotorboat(int speed, double weight, Color bodyColor, Color additionalColor, bool motor, bool glass) : base (160, 60)
|
||||
{
|
||||
EntityBoat = new EntityMotorboat(speed, weight, bodyColor, additionalColor, motor, glass);
|
||||
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityBoat == null || EntityBoat is not EntityMotorboat motorboat|| !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(motorboat.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
// стекло впереди
|
||||
if (motorboat.Glass)
|
||||
{
|
||||
Brush glassBrush = new SolidBrush(Color.LightBlue);
|
||||
g.FillEllipse(glassBrush, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 15, 100, 40);
|
||||
}
|
||||
// двигатель
|
||||
if (motorboat.Motor)
|
||||
{
|
||||
Brush engineBrush = new
|
||||
SolidBrush(motorboat.AdditionalColor);
|
||||
g.FillRectangle(engineBrush, _startPosX.Value + 0, _startPosY.Value + 10, 5, 50);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 0, _startPosY.Value + 10, 5, 50);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
24
ProjectMotorboat/ProjectMotorboat/Entities/EntityBoat.cs
Normal file
24
ProjectMotorboat/ProjectMotorboat/Entities/EntityBoat.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.Entities;
|
||||
|
||||
public class EntityBoat
|
||||
{
|
||||
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 EntityBoat(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
namespace ProjectMotorboat.Entities;
|
||||
|
||||
public class EntityMotorboat : EntityBoat
|
||||
{
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public bool Motor { get; private set; }
|
||||
|
||||
public bool Glass { get; private set; }
|
||||
|
||||
public EntityMotorboat(int speed, double weight, Color bodyColor, Color additionalColor, bool motor, bool glass) : base (speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
AdditionalColor = additionalColor;
|
||||
Motor = motor;
|
||||
Glass = glass;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat;
|
||||
|
||||
public class EntityMotorboat
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
|
||||
public double Weight { get; private set; }
|
||||
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public bool Motor { get; private set; }
|
||||
|
||||
public bool Glass { get; private set; }
|
||||
|
||||
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool motor, bool glass )
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Motor = motor;
|
||||
Glass = glass;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -34,6 +34,9 @@
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonCreateBoat = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxMotorboat).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -51,11 +54,11 @@
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(12, 409);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(94, 29);
|
||||
buttonCreate.Size = new Size(240, 29);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать";
|
||||
buttonCreate.Text = "Создать моторную лодку";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
buttonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
@ -106,11 +109,45 @@
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
buttonUp.MouseClick += ButtonMove_Click;
|
||||
//
|
||||
// buttonCreateBoat
|
||||
//
|
||||
buttonCreateBoat.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateBoat.Location = new Point(275, 409);
|
||||
buttonCreateBoat.Name = "buttonCreateBoat";
|
||||
buttonCreateBoat.Size = new Size(240, 29);
|
||||
buttonCreateBoat.TabIndex = 6;
|
||||
buttonCreateBoat.Text = "Создать лодку";
|
||||
buttonCreateBoat.UseVisualStyleBackColor = true;
|
||||
buttonCreateBoat.Click += ButtonBoat_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBoxStrategy.Location = new Point(604, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(184, 28);
|
||||
comboBoxStrategy.TabIndex = 7;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Location = new Point(686, 46);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(93, 28);
|
||||
buttonStrategyStep.TabIndex = 8;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
||||
//
|
||||
// FormMotorboat
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonCreateBoat);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
@ -131,5 +168,8 @@
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonUp;
|
||||
private Button buttonCreateBoat;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
@ -1,85 +1,126 @@
|
||||
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 ProjectMotorboat.Drownings;
|
||||
using ProjectMotorboat.MovementStrategy;
|
||||
|
||||
namespace ProjectMotorboat
|
||||
namespace ProjectMotorboat;
|
||||
|
||||
public partial class FormMotorboat : Form
|
||||
{
|
||||
public partial class FormMotorboat : Form
|
||||
private DrawningBoat? _drawningBoat;
|
||||
private AbstractStrategy? _strategy;
|
||||
public FormMotorboat()
|
||||
{
|
||||
private DrawningMotorboat? _drawningMotorboat;
|
||||
public FormMotorboat()
|
||||
InitializeComponent();
|
||||
_strategy = null;
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningBoat == null)
|
||||
{
|
||||
InitializeComponent();
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxMotorboat.Width, pictureBoxMotorboat.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningBoat.DrawTransport(gr);
|
||||
pictureBoxMotorboat.Image = bmp;
|
||||
}
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
Random random = new();
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningBoat):
|
||||
_drawningBoat = new DrawningBoat(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
break;
|
||||
case nameof(DrawningMotorboat):
|
||||
_drawningBoat = new DrawningMotorboat(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)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningMotorboat = new DrawningMotorboat();
|
||||
_drawningMotorboat.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)));
|
||||
_drawningMotorboat.SetPictureSize(pictureBoxMotorboat.Width, pictureBoxMotorboat.Height);
|
||||
_drawningMotorboat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawningBoat.SetPictureSize(pictureBoxMotorboat.Width, pictureBoxMotorboat.Height);
|
||||
_drawningBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_strategy = null;
|
||||
comboBoxStrategy.Enabled = true;
|
||||
Draw();
|
||||
}
|
||||
private void ButtonCreate_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningMotorboat));
|
||||
|
||||
Bitmap bmp = new(pictureBoxMotorboat.Width, pictureBoxMotorboat.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningMotorboat.DrawTransport(gr);
|
||||
pictureBoxMotorboat.Image = bmp;
|
||||
|
||||
private void ButtonBoat_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBoat));
|
||||
|
||||
|
||||
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
{
|
||||
if (_drawningMotorboat == null)
|
||||
case "buttonUp":
|
||||
result = _drawningBoat.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result = _drawningBoat.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result = _drawningBoat.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result = _drawningBoat.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxMotorboat.Width,
|
||||
pictureBoxMotorboat.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningMotorboat.DrawTransport(gr);
|
||||
pictureBoxMotorboat.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningMotorboat == null)
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new MoveableBoat(_drawningBoat), pictureBoxMotorboat.Width, pictureBoxMotorboat.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
|
||||
comboBoxStrategy.Enabled = false;
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
|
||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||
{
|
||||
case "buttonUp":
|
||||
result = _drawningMotorboat.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result = _drawningMotorboat.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result = _drawningMotorboat.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result = _drawningMotorboat.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.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();
|
||||
}
|
||||
|
||||
|
||||
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||
|
||||
|
||||
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||
|
||||
|
||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
||||
private bool MoveTo(MovementDirection movementDirection)
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
|
||||
public interface IMoveableObject
|
||||
{
|
||||
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
int GetStep { get; }
|
||||
|
||||
|
||||
bool TryMoveObject(MovementDirection direction);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
objParams.DownBorder <= 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using ProjectMotorboat.Drownings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
|
||||
public class MoveableBoat : IMoveableObject
|
||||
{
|
||||
private readonly DrawningBoat? _boat = null;
|
||||
public MoveableBoat(DrawningBoat boat)
|
||||
{
|
||||
_boat = boat;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_boat == null || _boat.EntityBoat == null || !_boat.GetPosX.HasValue || !_boat.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_boat.GetPosX.Value, _boat.GetPosY.Value, _boat.GetWidth, _boat.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_boat?.EntityBoat?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if (_boat == null || _boat.EntityBoat == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _boat.MoveTransport(GetDirectionType(direction));
|
||||
}
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
|
||||
public enum MovementDirection
|
||||
{
|
||||
|
||||
Up = 1,
|
||||
|
||||
|
||||
Down = 2,
|
||||
|
||||
|
||||
Left = 3,
|
||||
|
||||
|
||||
Right = 4
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
|
||||
public class ObjectParameters
|
||||
{
|
||||
|
||||
private readonly int _x;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectMotorboat.MovementStrategy;
|
||||
|
||||
public enum StrategyStatus
|
||||
{
|
||||
NotInit,
|
||||
|
||||
|
||||
InProgress,
|
||||
|
||||
|
||||
Finish
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34525.116
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsApp1", "WinFormsApp1\WinFormsApp1.csproj", "{50092433-6AF5-4E71-9559-079AE2F9901A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{50092433-6AF5-4E71-9559-079AE2F9901A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{50092433-6AF5-4E71-9559-079AE2F9901A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{50092433-6AF5-4E71-9559-079AE2F9901A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{50092433-6AF5-4E71-9559-079AE2F9901A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {59C3FED6-0E53-4AF0-9E1B-5ACF902ED5CE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
39
WinFormsApp1/WinFormsApp1/Form1.Designer.cs
generated
39
WinFormsApp1/WinFormsApp1/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,17 +0,0 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[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 Form1());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user