Compare commits
No commits in common. "Lab6" and "main" have entirely different histories.
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.7.34024.191
|
VisualStudioVersion = 17.3.32901.215
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectGasolineTanker", "ProjectGasolineTanker\ProjectGasolineTanker.csproj", "{D0EC2C7B-1218-45A1-95F1-7697825B93CF}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GasolineTanker", "GasolineTanker\GasolineTanker.csproj", "{07CE8245-8EAE-4397-B520-52291E0FA5E3}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -11,15 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D0EC2C7B-1218-45A1-95F1-7697825B93CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{07CE8245-8EAE-4397-B520-52291E0FA5E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D0EC2C7B-1218-45A1-95F1-7697825B93CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{07CE8245-8EAE-4397-B520-52291E0FA5E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D0EC2C7B-1218-45A1-95F1-7697825B93CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{07CE8245-8EAE-4397-B520-52291E0FA5E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D0EC2C7B-1218-45A1-95F1-7697825B93CF}.Release|Any CPU.Build.0 = Release|Any CPU
|
{07CE8245-8EAE-4397-B520-52291E0FA5E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7BD35329-9874-48AD-A3F4-50BA7A354CF5}
|
SolutionGuid = {2ECAEF3F-3601-44FD-BAC5-49DEF6859A6B}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
39
GasolineTanker/GasolineTanker/Form1.Designer.cs
generated
Normal file
39
GasolineTanker/GasolineTanker/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace GasolineTanker
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
GasolineTanker/GasolineTanker/Form1.cs
Normal file
10
GasolineTanker/GasolineTanker/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace GasolineTanker
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
GasolineTanker/GasolineTanker/GasolineTanker.csproj
Normal file
11
GasolineTanker/GasolineTanker/GasolineTanker.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -1,4 +1,4 @@
|
|||||||
namespace ProjectGasolineTanker
|
namespace GasolineTanker
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
@ -7,11 +7,11 @@ namespace ProjectGasolineTanker
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormTruckCollection());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,51 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Drawings
|
|
||||||
{
|
|
||||||
public class DrawingGasolineTanker : DrawingTruck
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public DrawingGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool tank, bool wheel, int width, int height) : base(speed, weight, bodyColor, width, height, 130, 70)
|
|
||||||
{
|
|
||||||
if (EntityTruck != null)
|
|
||||||
{
|
|
||||||
EntityTruck = new EntityGasolineTanker(speed, weight, bodyColor, additionalColor, tank, wheel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityTruck is not EntityGasolineTanker GasolineTanker)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Pen additionalPen = new(GasolineTanker.Add_Color);
|
|
||||||
Brush additionalBrush = new SolidBrush(GasolineTanker.Add_Color);
|
|
||||||
base.DrawTransport(g);
|
|
||||||
|
|
||||||
if (GasolineTanker.IsTank)
|
|
||||||
{
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 45, _startPosY + 53, 35, 20);
|
|
||||||
g.DrawLine(pen, _startPosX + 45, _startPosY + 53, _startPosX + 80, _startPosY + 73);
|
|
||||||
g.DrawLine(pen, _startPosX + 80, _startPosY + 53, _startPosX + 45, _startPosY + 73);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GasolineTanker.IsWheel)
|
|
||||||
{
|
|
||||||
Brush gr = new SolidBrush(Color.Gray);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 85, _startPosY + 55, 22, 22);
|
|
||||||
g.FillEllipse(gr, _startPosX + 87, _startPosY + 57, 18, 18);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 85, _startPosY + 55, 22, 22);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,188 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
using ProjectGasolineTanker.MovementStratg;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Drawings
|
|
||||||
{
|
|
||||||
|
|
||||||
public class DrawingTruck
|
|
||||||
{
|
|
||||||
public IMoveableObject GetMoveableObject => new DrawingObjectTruck(this);
|
|
||||||
|
|
||||||
public EntityTruck? EntityTruck { get; protected set; }
|
|
||||||
|
|
||||||
private int _pictureWidth;
|
|
||||||
|
|
||||||
private int _pictureHeight;
|
|
||||||
|
|
||||||
protected int _startPosX;
|
|
||||||
|
|
||||||
protected int _startPosY;
|
|
||||||
|
|
||||||
protected readonly int _tankerWidth = 130;
|
|
||||||
|
|
||||||
protected readonly int _tankerHeight = 70;
|
|
||||||
|
|
||||||
public int GetPosX => _startPosX;
|
|
||||||
|
|
||||||
public int GetPosY => _startPosY;
|
|
||||||
|
|
||||||
public int GetWidth => _tankerWidth;
|
|
||||||
|
|
||||||
public int GetHeight => _tankerHeight;
|
|
||||||
|
|
||||||
public DrawingTruck(int speed, double weight, Color bodyColor, int width, int height)
|
|
||||||
{
|
|
||||||
// TODO: Продумать проверки
|
|
||||||
if (width < _tankerWidth || height < _tankerHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected DrawingTruck(int speed, double weight, Color bodyColor, int width, int height, int tankerWidth, int tankerHeight)
|
|
||||||
{
|
|
||||||
// TODO: Продумать проверки
|
|
||||||
if (width < _tankerWidth || height < _tankerHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
_tankerWidth = tankerWidth;
|
|
||||||
_tankerHeight = tankerHeight;
|
|
||||||
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x > _pictureWidth || y > _pictureHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (!CanMove(direction) || EntityTruck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX - EntityTruck.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вверх
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY - EntityTruck.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// вправо
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX + _tankerWidth + EntityTruck.Step < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вниз
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY + _tankerHeight + EntityTruck.Step < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityTruck.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush additionalBrush = new SolidBrush(EntityTruck.BodyColor);
|
|
||||||
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 29, _startPosY + 11, 71, 28); //канистра-бак
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 29, _startPosY + 20, 71, 9); //полосы
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX + 29, _startPosY + 11, 71, 28); //канистра-бак
|
|
||||||
g.DrawRectangle(pen, _startPosX + 29, _startPosY + 20, 71, 9); //полосы
|
|
||||||
|
|
||||||
|
|
||||||
Brush additionalBrush1 = new
|
|
||||||
SolidBrush(EntityTruck.BodyColor);
|
|
||||||
//кабина
|
|
||||||
g.FillRectangle(additionalBrush1, _startPosX + 100, _startPosY + 10, 24, 16);
|
|
||||||
g.FillRectangle(additionalBrush1, _startPosX + 124, _startPosY + 10, 9, 16);
|
|
||||||
g.FillRectangle(additionalBrush1, _startPosX + 100, _startPosY + 10, 33, 16);
|
|
||||||
g.FillRectangle(additionalBrush1, _startPosX + 100, _startPosY + 26, 33, 13);
|
|
||||||
|
|
||||||
g.DrawLine(pen, _startPosX + 100, _startPosY + 26, _startPosX + 133, _startPosY + 39);
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 10, 24, 16);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 124, _startPosY + 10, 9, 16);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 10, 33, 16);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 26, 33, 13);
|
|
||||||
|
|
||||||
Brush additionalBrush2 = new
|
|
||||||
SolidBrush(EntityTruck.BodyColor);
|
|
||||||
|
|
||||||
g.FillRectangle(additionalBrush2, _startPosX + 4, _startPosY + 40, 130, 25);
|
|
||||||
g.DrawLine(pen, _startPosX + 4, _startPosY + 65, _startPosX + 25, _startPosY + 40);
|
|
||||||
|
|
||||||
//колёса
|
|
||||||
Brush gr = new SolidBrush(Color.Gray);
|
|
||||||
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 15, _startPosY + 50, 26, 26);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 110, _startPosY + 55, 22, 22);
|
|
||||||
|
|
||||||
g.FillEllipse(gr, _startPosX + 18, _startPosY + 53, 20, 20);
|
|
||||||
g.FillEllipse(gr, _startPosX + 112, _startPosY + 57, 18, 18);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX + 15, _startPosY + 50, 26, 26);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 110, _startPosY + 55, 22, 22);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanMove(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityTruck == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
DirectionType.Left => _startPosX - EntityTruck.Step > 0,
|
|
||||||
//вверх
|
|
||||||
DirectionType.Up => _startPosY - EntityTruck.Step > 0,
|
|
||||||
// вправо
|
|
||||||
DirectionType.Right => _startPosX + _tankerWidth + EntityTruck.Step < _pictureWidth,// TODO: Продумать логику
|
|
||||||
//вниз
|
|
||||||
DirectionType.Down => _startPosY + _tankerHeight + EntityTruck.Step < _pictureHeight,// TODO: Продумать логику
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangePictureSize(int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Drawings
|
|
||||||
{
|
|
||||||
public static class ExtentionDrawingTruck
|
|
||||||
{
|
|
||||||
// создание объекта из строки
|
|
||||||
public static DrawingTruck? CreateDrawingTruck(this string info, char separatorForObject, int width, int height)
|
|
||||||
{
|
|
||||||
string[] strs = info.Split(separatorForObject);
|
|
||||||
if (strs.Length == 3)
|
|
||||||
{
|
|
||||||
return new DrawingTruck(
|
|
||||||
Convert.ToInt32(strs[0]),
|
|
||||||
Convert.ToInt32(strs[1]),
|
|
||||||
Color.FromName(strs[2]), width, height);
|
|
||||||
}
|
|
||||||
if (strs.Length == 6)
|
|
||||||
{
|
|
||||||
return new DrawingGasolineTanker(
|
|
||||||
Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]),
|
|
||||||
Color.FromName(strs[2]), Color.FromName(strs[3]),
|
|
||||||
Convert.ToBoolean(strs[4]), Convert.ToBoolean(strs[5]),
|
|
||||||
width, height);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Получение данных для сохранения в файл
|
|
||||||
public static string GetDataForSave(this DrawingTruck DrawingTruck, char separatorForObject)
|
|
||||||
{
|
|
||||||
var truck = DrawingTruck.EntityTruck;
|
|
||||||
if (truck == null)
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
var str = $"{truck.Speed}{separatorForObject}{truck.Weight}{separatorForObject}{truck.BodyColor.Name}";
|
|
||||||
if (truck is not EntityGasolineTanker GasolineTanker)
|
|
||||||
{
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
return $"{str}{separatorForObject}{GasolineTanker.Add_Color.Name}{separatorForObject}{GasolineTanker.IsTank}{separatorForObject}{GasolineTanker.IsWheel}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Entities
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Направление перемещения
|
|
||||||
/// </summary>
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Entities
|
|
||||||
{
|
|
||||||
|
|
||||||
public class EntityGasolineTanker : EntityTruck
|
|
||||||
{
|
|
||||||
|
|
||||||
public Color Add_Color { get; private set; }
|
|
||||||
public bool IsTank { get; private set; }
|
|
||||||
public bool IsWheel { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
public EntityGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool tank, bool wheel) : base(speed, weight, bodyColor)
|
|
||||||
{
|
|
||||||
Add_Color = additionalColor;
|
|
||||||
IsTank = tank;
|
|
||||||
IsWheel = wheel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeAdditionalColor(Color additionalColor)
|
|
||||||
{
|
|
||||||
Add_Color = additionalColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Entities
|
|
||||||
{
|
|
||||||
|
|
||||||
public class EntityTruck
|
|
||||||
{
|
|
||||||
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
|
|
||||||
public EntityTruck(int speed, double weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeBodyColor(Color color)
|
|
||||||
{
|
|
||||||
BodyColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,194 +0,0 @@
|
|||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
partial class FormGasolineTanker
|
|
||||||
{
|
|
||||||
/// <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.pictureBoxGasolineTanker = new System.Windows.Forms.PictureBox();
|
|
||||||
this.buttonCreateGasolineTanker = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
|
||||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
|
||||||
this.buttonStep = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCreateTruck = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSelect = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxGasolineTanker)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxGasolineTanker
|
|
||||||
//
|
|
||||||
this.pictureBoxGasolineTanker.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.pictureBoxGasolineTanker.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxGasolineTanker.Name = "pictureBoxGasolineTanker";
|
|
||||||
this.pictureBoxGasolineTanker.Size = new System.Drawing.Size(882, 453);
|
|
||||||
this.pictureBoxGasolineTanker.TabIndex = 5;
|
|
||||||
this.pictureBoxGasolineTanker.TabStop = false;
|
|
||||||
//
|
|
||||||
// buttonCreateGasolineTanker
|
|
||||||
//
|
|
||||||
this.buttonCreateGasolineTanker.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateGasolineTanker.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
|
||||||
this.buttonCreateGasolineTanker.Location = new System.Drawing.Point(11, 365);
|
|
||||||
this.buttonCreateGasolineTanker.Name = "buttonCreateGasolineTanker";
|
|
||||||
this.buttonCreateGasolineTanker.Size = new System.Drawing.Size(120, 73);
|
|
||||||
this.buttonCreateGasolineTanker.TabIndex = 6;
|
|
||||||
this.buttonCreateGasolineTanker.Text = "Создать газовоз";
|
|
||||||
this.buttonCreateGasolineTanker.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateGasolineTanker.Click += new System.EventHandler(this.buttonCreateProjectGasolineTanker_Click);
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUp.BackgroundImage = global::ProjectGasolineTanker.Properties.Resources.стрелка_вверх;
|
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonUp.Location = new System.Drawing.Point(811, 377);
|
|
||||||
this.buttonUp.Name = "buttonUp";
|
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 29);
|
|
||||||
this.buttonUp.TabIndex = 7;
|
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonLeft.BackgroundImage = global::ProjectGasolineTanker.Properties.Resources.стрелка_влево;
|
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(776, 413);
|
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 29);
|
|
||||||
this.buttonLeft.TabIndex = 8;
|
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDown.BackgroundImage = global::ProjectGasolineTanker.Properties.Resources.стрелка_вниз;
|
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonDown.Location = new System.Drawing.Point(811, 413);
|
|
||||||
this.buttonDown.Name = "buttonDown";
|
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 29);
|
|
||||||
this.buttonDown.TabIndex = 9;
|
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonRight.BackgroundImage = global::ProjectGasolineTanker.Properties.Resources.стрелка_вправо;
|
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonRight.Location = new System.Drawing.Point(848, 413);
|
|
||||||
this.buttonRight.Name = "buttonRight";
|
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 29);
|
|
||||||
this.buttonRight.TabIndex = 10;
|
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// comboBoxStrategy
|
|
||||||
//
|
|
||||||
this.comboBoxStrategy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.comboBoxStrategy.FormattingEnabled = true;
|
|
||||||
this.comboBoxStrategy.Items.AddRange(new object[] {
|
|
||||||
"В центр",
|
|
||||||
"В правый нижний угол"});
|
|
||||||
this.comboBoxStrategy.Location = new System.Drawing.Point(719, 12);
|
|
||||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
|
||||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
|
||||||
this.comboBoxStrategy.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// buttonStep
|
|
||||||
//
|
|
||||||
this.buttonStep.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonStep.Location = new System.Drawing.Point(747, 45);
|
|
||||||
this.buttonStep.Name = "buttonStep";
|
|
||||||
this.buttonStep.Size = new System.Drawing.Size(94, 29);
|
|
||||||
this.buttonStep.TabIndex = 12;
|
|
||||||
this.buttonStep.Text = "Шаг";
|
|
||||||
this.buttonStep.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonStep.Click += new System.EventHandler(this.buttonStep_Click);
|
|
||||||
//
|
|
||||||
// buttonCreateTruck
|
|
||||||
//
|
|
||||||
this.buttonCreateTruck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateTruck.Location = new System.Drawing.Point(138, 388);
|
|
||||||
this.buttonCreateTruck.Name = "buttonCreateTruck";
|
|
||||||
this.buttonCreateTruck.Size = new System.Drawing.Size(120, 51);
|
|
||||||
this.buttonCreateTruck.TabIndex = 13;
|
|
||||||
this.buttonCreateTruck.Text = "Создать грузовик";
|
|
||||||
this.buttonCreateTruck.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateTruck.Click += new System.EventHandler(this.buttonCreateTruck_Click);
|
|
||||||
//
|
|
||||||
// buttonSelect
|
|
||||||
//
|
|
||||||
this.buttonSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonSelect.Location = new System.Drawing.Point(264, 365);
|
|
||||||
this.buttonSelect.Name = "buttonSelect";
|
|
||||||
this.buttonSelect.Size = new System.Drawing.Size(120, 74);
|
|
||||||
this.buttonSelect.TabIndex = 14;
|
|
||||||
this.buttonSelect.Text = "Выбрать грузовик";
|
|
||||||
this.buttonSelect.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSelect.Click += new System.EventHandler(this.ButtonSelectTruck_Click);
|
|
||||||
//
|
|
||||||
// FormGasolineTanker
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(882, 453);
|
|
||||||
this.Controls.Add(this.buttonSelect);
|
|
||||||
this.Controls.Add(this.buttonCreateTruck);
|
|
||||||
this.Controls.Add(this.buttonStep);
|
|
||||||
this.Controls.Add(this.comboBoxStrategy);
|
|
||||||
this.Controls.Add(this.buttonRight);
|
|
||||||
this.Controls.Add(this.buttonDown);
|
|
||||||
this.Controls.Add(this.buttonLeft);
|
|
||||||
this.Controls.Add(this.buttonUp);
|
|
||||||
this.Controls.Add(this.buttonCreateGasolineTanker);
|
|
||||||
this.Controls.Add(this.pictureBoxGasolineTanker);
|
|
||||||
this.Name = "FormGasolineTanker";
|
|
||||||
this.Text = "GasolineTanker";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxGasolineTanker)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxGasolineTanker;
|
|
||||||
private Button buttonCreateGasolineTanker;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonRight;
|
|
||||||
private ComboBox comboBoxStrategy;
|
|
||||||
private Button buttonStep;
|
|
||||||
private Button buttonCreateTruck;
|
|
||||||
private Button buttonSelect;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,171 +0,0 @@
|
|||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
using ProjectGasolineTanker.MovementStratg;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Ôîðìà ðàáîòû ñ îáúåêòîì Ãàçîâîç
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public partial class FormGasolineTanker : Form
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
|
||||||
/// </summary>
|
|
||||||
private DrawingTruck? _drawingTruck;
|
|
||||||
/// <summary>
|
|
||||||
/// Ñòðàòåãèÿ ïåðåìåùåíèÿ
|
|
||||||
/// </summary>
|
|
||||||
private AbstractStrategy? _abstractStrategy;
|
|
||||||
/// <summary>
|
|
||||||
/// Âûáðàííûé àâòîìîáèëü
|
|
||||||
/// </summary>
|
|
||||||
public DrawingTruck? SelectedTruck { get; private set; }
|
|
||||||
|
|
||||||
public FormGasolineTanker()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_abstractStrategy = null;
|
|
||||||
SelectedTruck = null;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Ìåòîä ïðîðèñîâêè ãðóçîâèêà
|
|
||||||
/// </summary>
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawingTruck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bitmap bmp = new(pictureBoxGasolineTanker.Width, pictureBoxGasolineTanker.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawingTruck.DrawTransport(gr);
|
|
||||||
pictureBoxGasolineTanker.Image = bmp;
|
|
||||||
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü ãàçîâîç"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void buttonCreateProjectGasolineTanker_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
Color color = Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256));
|
|
||||||
Color color1 = Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256));
|
|
||||||
ColorDialog dialog = new();
|
|
||||||
ColorDialog dialog1 = new();
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK && dialog1.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
color = dialog.Color;
|
|
||||||
color1 = dialog1.Color;
|
|
||||||
}
|
|
||||||
_drawingTruck = new DrawingGasolineTanker(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
color, color1,
|
|
||||||
true, true,
|
|
||||||
pictureBoxGasolineTanker.Width, pictureBoxGasolineTanker.Height);
|
|
||||||
_drawingTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü ProjectGasolineTanker"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void buttonCreateTruck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
Color color = Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256));
|
|
||||||
ColorDialog dialog = new();
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
color = dialog.Color;
|
|
||||||
}
|
|
||||||
_drawingTruck = new DrawingTruck(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
color,
|
|
||||||
pictureBoxGasolineTanker.Width, pictureBoxGasolineTanker.Height);
|
|
||||||
_drawingTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Èçìåíåíèå ïîëîæåíèÿ îáúåêòà
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void buttonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawingTruck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_drawingTruck.MoveTransport(DirectionType.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_drawingTruck.MoveTransport(DirectionType.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_drawingTruck.MoveTransport(DirectionType.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_drawingTruck.MoveTransport(DirectionType.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Øàã"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void buttonStep_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawingTruck == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxStrategy.Enabled)
|
|
||||||
{
|
|
||||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
|
||||||
switch
|
|
||||||
{
|
|
||||||
0 => new MoveToCenter(),
|
|
||||||
1 => new MoveToBorder(),
|
|
||||||
_ => null,
|
|
||||||
};
|
|
||||||
if (_abstractStrategy == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_abstractStrategy.SetData(new DrawingObjectTruck(_drawingTruck), pictureBoxGasolineTanker.Width, pictureBoxGasolineTanker.Height);
|
|
||||||
comboBoxStrategy.Enabled = false;
|
|
||||||
}
|
|
||||||
if (_abstractStrategy == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_abstractStrategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
|
||||||
{
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_abstractStrategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonSelectTruck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SelectedTruck = _drawingTruck;
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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,257 +0,0 @@
|
|||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
partial class FormTruckCollection
|
|
||||||
{
|
|
||||||
/// <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.buttonAddTruck = new System.Windows.Forms.Button();
|
|
||||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
|
||||||
this.labelInstruments = new System.Windows.Forms.Label();
|
|
||||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDeleteTruck = new System.Windows.Forms.Button();
|
|
||||||
this.colorDialog = new System.Windows.Forms.ColorDialog();
|
|
||||||
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.listBoxStorages = new System.Windows.Forms.ListBox();
|
|
||||||
this.buttonAddStorage = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDeleteStorage = new System.Windows.Forms.Button();
|
|
||||||
this.textBoxStorageName = new System.Windows.Forms.TextBox();
|
|
||||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
|
||||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
|
||||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
|
||||||
this.menuStrip.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonAddTruck
|
|
||||||
//
|
|
||||||
this.buttonAddTruck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonAddTruck.Location = new System.Drawing.Point(642, 315);
|
|
||||||
this.buttonAddTruck.Name = "buttonAddTruck";
|
|
||||||
this.buttonAddTruck.Size = new System.Drawing.Size(137, 28);
|
|
||||||
this.buttonAddTruck.TabIndex = 0;
|
|
||||||
this.buttonAddTruck.Text = "Добавить грузовик";
|
|
||||||
this.buttonAddTruck.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAddTruck.Click += new System.EventHandler(this.buttonAddTruck_Click);
|
|
||||||
//
|
|
||||||
// pictureBoxCollection
|
|
||||||
//
|
|
||||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 27);
|
|
||||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
|
||||||
this.pictureBoxCollection.Size = new System.Drawing.Size(626, 436);
|
|
||||||
this.pictureBoxCollection.TabIndex = 1;
|
|
||||||
this.pictureBoxCollection.TabStop = false;
|
|
||||||
//
|
|
||||||
// labelInstruments
|
|
||||||
//
|
|
||||||
this.labelInstruments.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.labelInstruments.AutoSize = true;
|
|
||||||
this.labelInstruments.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
|
||||||
this.labelInstruments.Location = new System.Drawing.Point(659, 9);
|
|
||||||
this.labelInstruments.Name = "labelInstruments";
|
|
||||||
this.labelInstruments.Size = new System.Drawing.Size(108, 21);
|
|
||||||
this.labelInstruments.TabIndex = 2;
|
|
||||||
this.labelInstruments.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
this.buttonUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUpdate.Location = new System.Drawing.Point(648, 129);
|
|
||||||
this.buttonUpdate.Name = "buttonUpdate";
|
|
||||||
this.buttonUpdate.Size = new System.Drawing.Size(131, 25);
|
|
||||||
this.buttonUpdate.TabIndex = 3;
|
|
||||||
this.buttonUpdate.Text = "Обновить набор";
|
|
||||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
|
|
||||||
//
|
|
||||||
// buttonDeleteTruck
|
|
||||||
//
|
|
||||||
this.buttonDeleteTruck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDeleteTruck.Location = new System.Drawing.Point(642, 403);
|
|
||||||
this.buttonDeleteTruck.Name = "buttonDeleteTruck";
|
|
||||||
this.buttonDeleteTruck.Size = new System.Drawing.Size(137, 28);
|
|
||||||
this.buttonDeleteTruck.TabIndex = 4;
|
|
||||||
this.buttonDeleteTruck.Text = "Удалить грузовик";
|
|
||||||
this.buttonDeleteTruck.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDeleteTruck.Click += new System.EventHandler(this.buttonDeleteTruck_Click);
|
|
||||||
//
|
|
||||||
// maskedTextBoxNumber
|
|
||||||
//
|
|
||||||
this.maskedTextBoxNumber.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(642, 360);
|
|
||||||
this.maskedTextBoxNumber.Mask = "00";
|
|
||||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
|
||||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(138, 23);
|
|
||||||
this.maskedTextBoxNumber.TabIndex = 5;
|
|
||||||
this.maskedTextBoxNumber.ValidatingType = typeof(int);
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(648, 47);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(52, 15);
|
|
||||||
this.label1.TabIndex = 7;
|
|
||||||
this.label1.Text = "Наборы";
|
|
||||||
//
|
|
||||||
// listBoxStorages
|
|
||||||
//
|
|
||||||
this.listBoxStorages.FormattingEnabled = true;
|
|
||||||
this.listBoxStorages.ItemHeight = 15;
|
|
||||||
this.listBoxStorages.Location = new System.Drawing.Point(648, 157);
|
|
||||||
this.listBoxStorages.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.listBoxStorages.Name = "listBoxStorages";
|
|
||||||
this.listBoxStorages.Size = new System.Drawing.Size(132, 109);
|
|
||||||
this.listBoxStorages.TabIndex = 8;
|
|
||||||
this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.listBoxObjects_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// buttonAddStorage
|
|
||||||
//
|
|
||||||
this.buttonAddStorage.Location = new System.Drawing.Point(648, 99);
|
|
||||||
this.buttonAddStorage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.buttonAddStorage.Name = "buttonAddStorage";
|
|
||||||
this.buttonAddStorage.Size = new System.Drawing.Size(131, 25);
|
|
||||||
this.buttonAddStorage.TabIndex = 9;
|
|
||||||
this.buttonAddStorage.Text = "Добавить набор";
|
|
||||||
this.buttonAddStorage.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAddStorage.Click += new System.EventHandler(this.buttonAddStorage_Click);
|
|
||||||
//
|
|
||||||
// buttonDeleteStorage
|
|
||||||
//
|
|
||||||
this.buttonDeleteStorage.Location = new System.Drawing.Point(648, 270);
|
|
||||||
this.buttonDeleteStorage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.buttonDeleteStorage.Name = "buttonDeleteStorage";
|
|
||||||
this.buttonDeleteStorage.Size = new System.Drawing.Size(131, 25);
|
|
||||||
this.buttonDeleteStorage.TabIndex = 10;
|
|
||||||
this.buttonDeleteStorage.Text = "Удалить набор";
|
|
||||||
this.buttonDeleteStorage.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDeleteStorage.Click += new System.EventHandler(this.buttonDeleteStorage_Click);
|
|
||||||
//
|
|
||||||
// textBoxStorageName
|
|
||||||
//
|
|
||||||
this.textBoxStorageName.Location = new System.Drawing.Point(648, 74);
|
|
||||||
this.textBoxStorageName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.textBoxStorageName.Name = "textBoxStorageName";
|
|
||||||
this.textBoxStorageName.Size = new System.Drawing.Size(132, 23);
|
|
||||||
this.textBoxStorageName.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// menuStrip
|
|
||||||
//
|
|
||||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.toolStripMenuItem1});
|
|
||||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.menuStrip.Name = "menuStrip";
|
|
||||||
this.menuStrip.Size = new System.Drawing.Size(797, 24);
|
|
||||||
this.menuStrip.TabIndex = 12;
|
|
||||||
this.menuStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// toolStripMenuItem1
|
|
||||||
//
|
|
||||||
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.saveToolStripMenuItem,
|
|
||||||
this.loadToolStripMenuItem});
|
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(48, 20);
|
|
||||||
this.toolStripMenuItem1.Text = "Файл";
|
|
||||||
//
|
|
||||||
// saveToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
|
||||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
|
||||||
this.saveToolStripMenuItem.Text = "Сохранить";
|
|
||||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// loadToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
|
||||||
this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
|
||||||
this.loadToolStripMenuItem.Text = "Загрузить";
|
|
||||||
this.loadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// saveFileDialog
|
|
||||||
//
|
|
||||||
this.saveFileDialog.Filter = "txt file | *.txt";
|
|
||||||
//
|
|
||||||
// openFileDialog
|
|
||||||
//
|
|
||||||
this.openFileDialog.FileName = "openFileDialog1";
|
|
||||||
this.openFileDialog.Filter = "txt file | *.txt";
|
|
||||||
//
|
|
||||||
// FormTruckCollection
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(797, 465);
|
|
||||||
this.Controls.Add(this.textBoxStorageName);
|
|
||||||
this.Controls.Add(this.buttonDeleteStorage);
|
|
||||||
this.Controls.Add(this.buttonAddStorage);
|
|
||||||
this.Controls.Add(this.listBoxStorages);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.buttonAddTruck);
|
|
||||||
this.Controls.Add(this.maskedTextBoxNumber);
|
|
||||||
this.Controls.Add(this.buttonDeleteTruck);
|
|
||||||
this.Controls.Add(this.buttonUpdate);
|
|
||||||
this.Controls.Add(this.labelInstruments);
|
|
||||||
this.Controls.Add(this.pictureBoxCollection);
|
|
||||||
this.Controls.Add(this.menuStrip);
|
|
||||||
this.MainMenuStrip = this.menuStrip;
|
|
||||||
this.Name = "FormTruckCollection";
|
|
||||||
this.Text = "Набор грузовиков";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
|
||||||
this.menuStrip.ResumeLayout(false);
|
|
||||||
this.menuStrip.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonAddTruck;
|
|
||||||
private PictureBox pictureBoxCollection;
|
|
||||||
private Label labelInstruments;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDeleteTruck;
|
|
||||||
private ColorDialog colorDialog;
|
|
||||||
private MaskedTextBox maskedTextBoxNumber;
|
|
||||||
private Label label1;
|
|
||||||
private ListBox listBoxStorages;
|
|
||||||
private Button buttonAddStorage;
|
|
||||||
private Button buttonDeleteStorage;
|
|
||||||
private TextBox textBoxStorageName;
|
|
||||||
private MenuStrip menuStrip;
|
|
||||||
private ToolStripMenuItem toolStripMenuItem1;
|
|
||||||
private ToolStripMenuItem saveToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem loadToolStripMenuItem;
|
|
||||||
private SaveFileDialog saveFileDialog;
|
|
||||||
private OpenFileDialog openFileDialog;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,203 +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 ProjectGasolineTanker.Generic;
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.MovementStratg;
|
|
||||||
using ProjectGasolineTanker;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
public partial class FormTruckCollection : Form
|
|
||||||
{
|
|
||||||
// Набор объектов
|
|
||||||
private readonly TruckGenericStorage _storage;
|
|
||||||
|
|
||||||
public FormTruckCollection()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storage = new TruckGenericStorage(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]?.ShowTruck();
|
|
||||||
}
|
|
||||||
|
|
||||||
// удалить набор
|
|
||||||
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 buttonAddTruck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
var formTruckConfig = new FormTruckConfig();
|
|
||||||
|
|
||||||
// TODO Call method AddEvent from formCarConfig
|
|
||||||
formTruckConfig.AddEvent(AddTruck);
|
|
||||||
formTruckConfig.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddTruck(DrawingTruck selectedTruck)
|
|
||||||
{
|
|
||||||
if (listBoxStorages.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не выбран набор");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selectedTruck.ChangePictureSize(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
|
||||||
if (obj + selectedTruck != -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBoxCollection.Image = obj.ShowTruck();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonDeleteTruck_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.ShowTruck();
|
|
||||||
}
|
|
||||||
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.ShowTruck();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (_storage.SaveData(saveFileDialog.FileName))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Обработка нажатия "Загрузка"
|
|
||||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (_storage.LoadData(openFileDialog.FileName))
|
|
||||||
{
|
|
||||||
ReloadObjects();
|
|
||||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
|
||||||
pictureBoxCollection.Image = obj.ShowTruck();
|
|
||||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
||||||
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>131, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>239, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>375, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>36</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,382 +0,0 @@
|
|||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
partial class FormTruckConfig
|
|
||||||
{
|
|
||||||
/// <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.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
|
||||||
this.labelAdvancedObject = new System.Windows.Forms.Label();
|
|
||||||
this.labelSimpleObject = new System.Windows.Forms.Label();
|
|
||||||
this.groupBoxColor = new System.Windows.Forms.GroupBox();
|
|
||||||
this.panelLightBlue = new System.Windows.Forms.Panel();
|
|
||||||
this.panelBlue = new System.Windows.Forms.Panel();
|
|
||||||
this.panelPurple = new System.Windows.Forms.Panel();
|
|
||||||
this.panelGray = new System.Windows.Forms.Panel();
|
|
||||||
this.panelGreen = new System.Windows.Forms.Panel();
|
|
||||||
this.panelYellow = new System.Windows.Forms.Panel();
|
|
||||||
this.panelOrange = new System.Windows.Forms.Panel();
|
|
||||||
this.panelRed = new System.Windows.Forms.Panel();
|
|
||||||
this.checkBoxWheel = new System.Windows.Forms.CheckBox();
|
|
||||||
this.checkBoxTanker = new System.Windows.Forms.CheckBox();
|
|
||||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.labelWeight = new System.Windows.Forms.Label();
|
|
||||||
this.labelSpeed = new System.Windows.Forms.Label();
|
|
||||||
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
|
||||||
this.panelObject = new System.Windows.Forms.Panel();
|
|
||||||
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
|
||||||
this.labelMainColor = new System.Windows.Forms.Label();
|
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.groupBoxConfig.SuspendLayout();
|
|
||||||
this.groupBoxColor.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
|
||||||
this.panelObject.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBoxConfig
|
|
||||||
//
|
|
||||||
this.groupBoxConfig.Controls.Add(this.labelAdvancedObject);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.labelSimpleObject);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.groupBoxColor);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.checkBoxWheel);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.checkBoxTanker);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.labelWeight);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.labelSpeed);
|
|
||||||
this.groupBoxConfig.Location = new System.Drawing.Point(14, 48);
|
|
||||||
this.groupBoxConfig.Name = "groupBoxConfig";
|
|
||||||
this.groupBoxConfig.Size = new System.Drawing.Size(570, 251);
|
|
||||||
this.groupBoxConfig.TabIndex = 0;
|
|
||||||
this.groupBoxConfig.TabStop = false;
|
|
||||||
this.groupBoxConfig.Text = "Параметры";
|
|
||||||
//
|
|
||||||
// labelAdvancedObject
|
|
||||||
//
|
|
||||||
this.labelAdvancedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelAdvancedObject.Location = new System.Drawing.Point(440, 188);
|
|
||||||
this.labelAdvancedObject.Name = "labelAdvancedObject";
|
|
||||||
this.labelAdvancedObject.Size = new System.Drawing.Size(120, 30);
|
|
||||||
this.labelAdvancedObject.TabIndex = 8;
|
|
||||||
this.labelAdvancedObject.Text = "Продвинутый";
|
|
||||||
this.labelAdvancedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.labelAdvancedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
|
||||||
//
|
|
||||||
// labelSimpleObject
|
|
||||||
//
|
|
||||||
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelSimpleObject.Location = new System.Drawing.Point(283, 188);
|
|
||||||
this.labelSimpleObject.Name = "labelSimpleObject";
|
|
||||||
this.labelSimpleObject.Size = new System.Drawing.Size(120, 30);
|
|
||||||
this.labelSimpleObject.TabIndex = 7;
|
|
||||||
this.labelSimpleObject.Text = "Простой";
|
|
||||||
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
|
||||||
//
|
|
||||||
// groupBoxColor
|
|
||||||
//
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelLightBlue);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelBlue);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelPurple);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelGray);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelGreen);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelYellow);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelOrange);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelRed);
|
|
||||||
this.groupBoxColor.Location = new System.Drawing.Point(283, 32);
|
|
||||||
this.groupBoxColor.Name = "groupBoxColor";
|
|
||||||
this.groupBoxColor.Size = new System.Drawing.Size(277, 145);
|
|
||||||
this.groupBoxColor.TabIndex = 6;
|
|
||||||
this.groupBoxColor.TabStop = false;
|
|
||||||
this.groupBoxColor.Text = "Цвета";
|
|
||||||
//
|
|
||||||
// panelLightBlue
|
|
||||||
//
|
|
||||||
this.panelLightBlue.BackColor = System.Drawing.Color.Indigo;
|
|
||||||
this.panelLightBlue.Location = new System.Drawing.Point(5, 85);
|
|
||||||
this.panelLightBlue.Name = "panelLightBlue";
|
|
||||||
this.panelLightBlue.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelLightBlue.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelBlue
|
|
||||||
//
|
|
||||||
this.panelBlue.BackColor = System.Drawing.Color.Black;
|
|
||||||
this.panelBlue.Location = new System.Drawing.Point(75, 85);
|
|
||||||
this.panelBlue.Name = "panelBlue";
|
|
||||||
this.panelBlue.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelBlue.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelPurple
|
|
||||||
//
|
|
||||||
this.panelPurple.BackColor = System.Drawing.Color.Fuchsia;
|
|
||||||
this.panelPurple.Location = new System.Drawing.Point(145, 85);
|
|
||||||
this.panelPurple.Name = "panelPurple";
|
|
||||||
this.panelPurple.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelPurple.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelGray
|
|
||||||
//
|
|
||||||
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
|
||||||
this.panelGray.Location = new System.Drawing.Point(215, 85);
|
|
||||||
this.panelGray.Name = "panelGray";
|
|
||||||
this.panelGray.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelGray.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelGreen
|
|
||||||
//
|
|
||||||
this.panelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
|
|
||||||
this.panelGreen.Location = new System.Drawing.Point(215, 25);
|
|
||||||
this.panelGreen.Name = "panelGreen";
|
|
||||||
this.panelGreen.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelGreen.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelYellow
|
|
||||||
//
|
|
||||||
this.panelYellow.BackColor = System.Drawing.Color.Gold;
|
|
||||||
this.panelYellow.Location = new System.Drawing.Point(145, 25);
|
|
||||||
this.panelYellow.Name = "panelYellow";
|
|
||||||
this.panelYellow.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelYellow.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelOrange
|
|
||||||
//
|
|
||||||
this.panelOrange.BackColor = System.Drawing.Color.Cyan;
|
|
||||||
this.panelOrange.Location = new System.Drawing.Point(75, 25);
|
|
||||||
this.panelOrange.Name = "panelOrange";
|
|
||||||
this.panelOrange.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelOrange.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelRed
|
|
||||||
//
|
|
||||||
this.panelRed.BackColor = System.Drawing.Color.LawnGreen;
|
|
||||||
this.panelRed.Location = new System.Drawing.Point(5, 25);
|
|
||||||
this.panelRed.Name = "panelRed";
|
|
||||||
this.panelRed.Size = new System.Drawing.Size(50, 40);
|
|
||||||
this.panelRed.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// checkBoxWheel
|
|
||||||
//
|
|
||||||
this.checkBoxWheel.AutoSize = true;
|
|
||||||
this.checkBoxWheel.Location = new System.Drawing.Point(13, 149);
|
|
||||||
this.checkBoxWheel.Name = "checkBoxWheel";
|
|
||||||
this.checkBoxWheel.Size = new System.Drawing.Size(173, 24);
|
|
||||||
this.checkBoxWheel.TabIndex = 5;
|
|
||||||
this.checkBoxWheel.Text = "Наличие доп колеса";
|
|
||||||
this.checkBoxWheel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxTanker
|
|
||||||
//
|
|
||||||
this.checkBoxTanker.AutoSize = true;
|
|
||||||
this.checkBoxTanker.Location = new System.Drawing.Point(13, 119);
|
|
||||||
this.checkBoxTanker.Name = "checkBoxTanker";
|
|
||||||
this.checkBoxTanker.Size = new System.Drawing.Size(128, 24);
|
|
||||||
this.checkBoxTanker.TabIndex = 4;
|
|
||||||
this.checkBoxTanker.Text = "Наличие бака";
|
|
||||||
this.checkBoxTanker.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// numericUpDownSpeed
|
|
||||||
//
|
|
||||||
this.numericUpDownSpeed.Location = new System.Drawing.Point(94, 32);
|
|
||||||
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
|
||||||
1000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
|
||||||
this.numericUpDownSpeed.Size = new System.Drawing.Size(150, 27);
|
|
||||||
this.numericUpDownSpeed.TabIndex = 3;
|
|
||||||
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// numericUpDownWeight
|
|
||||||
//
|
|
||||||
this.numericUpDownWeight.Location = new System.Drawing.Point(94, 83);
|
|
||||||
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
|
||||||
1000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
|
||||||
this.numericUpDownWeight.Size = new System.Drawing.Size(150, 27);
|
|
||||||
this.numericUpDownWeight.TabIndex = 2;
|
|
||||||
this.numericUpDownWeight.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// labelWeight
|
|
||||||
//
|
|
||||||
this.labelWeight.AutoSize = true;
|
|
||||||
this.labelWeight.Location = new System.Drawing.Point(6, 85);
|
|
||||||
this.labelWeight.Name = "labelWeight";
|
|
||||||
this.labelWeight.Size = new System.Drawing.Size(36, 20);
|
|
||||||
this.labelWeight.TabIndex = 1;
|
|
||||||
this.labelWeight.Text = "Вес:";
|
|
||||||
//
|
|
||||||
// labelSpeed
|
|
||||||
//
|
|
||||||
this.labelSpeed.AutoSize = true;
|
|
||||||
this.labelSpeed.Location = new System.Drawing.Point(6, 32);
|
|
||||||
this.labelSpeed.Name = "labelSpeed";
|
|
||||||
this.labelSpeed.Size = new System.Drawing.Size(76, 20);
|
|
||||||
this.labelSpeed.TabIndex = 0;
|
|
||||||
this.labelSpeed.Text = "Скорость:";
|
|
||||||
//
|
|
||||||
// pictureBoxObject
|
|
||||||
//
|
|
||||||
this.pictureBoxObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.pictureBoxObject.Location = new System.Drawing.Point(35, 84);
|
|
||||||
this.pictureBoxObject.Name = "pictureBoxObject";
|
|
||||||
this.pictureBoxObject.Size = new System.Drawing.Size(327, 205);
|
|
||||||
this.pictureBoxObject.TabIndex = 1;
|
|
||||||
this.pictureBoxObject.TabStop = false;
|
|
||||||
//
|
|
||||||
// panelObject
|
|
||||||
//
|
|
||||||
this.panelObject.AllowDrop = true;
|
|
||||||
this.panelObject.Controls.Add(this.labelAdditionalColor);
|
|
||||||
this.panelObject.Controls.Add(this.labelMainColor);
|
|
||||||
this.panelObject.Controls.Add(this.pictureBoxObject);
|
|
||||||
this.panelObject.Location = new System.Drawing.Point(613, 29);
|
|
||||||
this.panelObject.Name = "panelObject";
|
|
||||||
this.panelObject.Size = new System.Drawing.Size(401, 301);
|
|
||||||
this.panelObject.TabIndex = 2;
|
|
||||||
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
|
||||||
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
|
||||||
//
|
|
||||||
// labelAdditionalColor
|
|
||||||
//
|
|
||||||
this.labelAdditionalColor.AllowDrop = true;
|
|
||||||
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelAdditionalColor.Location = new System.Drawing.Point(233, 19);
|
|
||||||
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
|
||||||
this.labelAdditionalColor.Size = new System.Drawing.Size(90, 50);
|
|
||||||
this.labelAdditionalColor.TabIndex = 3;
|
|
||||||
this.labelAdditionalColor.Text = "Доп. цвет";
|
|
||||||
this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAdditionalColor_DragDrop);
|
|
||||||
this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelAdditionalColor_DragEnter);
|
|
||||||
//
|
|
||||||
// labelMainColor
|
|
||||||
//
|
|
||||||
this.labelMainColor.AllowDrop = true;
|
|
||||||
this.labelMainColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelMainColor.Location = new System.Drawing.Point(77, 19);
|
|
||||||
this.labelMainColor.Name = "labelMainColor";
|
|
||||||
this.labelMainColor.Size = new System.Drawing.Size(90, 50);
|
|
||||||
this.labelMainColor.TabIndex = 2;
|
|
||||||
this.labelMainColor.Text = "Цвет";
|
|
||||||
this.labelMainColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.labelMainColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelMainColor_DragDrop);
|
|
||||||
this.labelMainColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelMainColor_DragEnter);
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(689, 337);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(94, 29);
|
|
||||||
this.buttonAdd.TabIndex = 3;
|
|
||||||
this.buttonAdd.Text = "Добавить";
|
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(846, 339);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
|
||||||
this.buttonCancel.TabIndex = 4;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormTruckConfig
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1032, 383);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonAdd);
|
|
||||||
this.Controls.Add(this.panelObject);
|
|
||||||
this.Controls.Add(this.groupBoxConfig);
|
|
||||||
this.Name = "FormTruckConfig";
|
|
||||||
this.Text = "FormTruckConfig";
|
|
||||||
this.groupBoxConfig.ResumeLayout(false);
|
|
||||||
this.groupBoxConfig.PerformLayout();
|
|
||||||
this.groupBoxColor.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
|
||||||
this.panelObject.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBoxConfig;
|
|
||||||
private NumericUpDown numericUpDownSpeed;
|
|
||||||
private NumericUpDown numericUpDownWeight;
|
|
||||||
private Label labelWeight;
|
|
||||||
private Label labelSpeed;
|
|
||||||
private CheckBox checkBoxWheel;
|
|
||||||
private CheckBox checkBoxTanker;
|
|
||||||
private GroupBox groupBoxColor;
|
|
||||||
private Panel panelLightBlue;
|
|
||||||
private Panel panelBlue;
|
|
||||||
private Panel panelPurple;
|
|
||||||
private Panel panelGray;
|
|
||||||
private Panel panelGreen;
|
|
||||||
private Panel panelYellow;
|
|
||||||
private Panel panelOrange;
|
|
||||||
private Panel panelRed;
|
|
||||||
private Label labelAdvancedObject;
|
|
||||||
private Label labelSimpleObject;
|
|
||||||
private PictureBox pictureBoxObject;
|
|
||||||
private Panel panelObject;
|
|
||||||
private Label labelAdditionalColor;
|
|
||||||
private Label labelMainColor;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,177 +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 ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker
|
|
||||||
{
|
|
||||||
public partial class FormTruckConfig : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
DrawingTruck? _truck = null;
|
|
||||||
/// <summary>
|
|
||||||
/// Событие
|
|
||||||
/// </summary>
|
|
||||||
private event Action<DrawingTruck>? EventAddTruck;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
public FormTruckConfig()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
panelRed.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelOrange.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelLightBlue.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
|
||||||
panelGray.MouseDown += PanelColor_MouseDown;
|
|
||||||
buttonCancel.Click += (s, e) => Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Отрисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
private void DrawTruck()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_truck?.SetPosition(5, 5);
|
|
||||||
_truck?.DrawTransport(gr);
|
|
||||||
pictureBoxObject.Image = bmp;
|
|
||||||
}
|
|
||||||
/// <summary>labelSimpleObject
|
|
||||||
/// Добавление события
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ev">Привязанный методlabelSimpleObject</param>labelSimpleObject
|
|
||||||
public void AddEvent(Action<DrawingTruck> ev)
|
|
||||||
{
|
|
||||||
if (EventAddTruck == null)
|
|
||||||
{
|
|
||||||
EventAddTruck = ev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventAddTruck += ev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
|
|
||||||
DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Действия при приеме перетаскиваемой информации (имени Label)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
|
||||||
{
|
|
||||||
case "labelSimpleObject":
|
|
||||||
_truck = new DrawingTruck(
|
|
||||||
(int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value,
|
|
||||||
Color.White,
|
|
||||||
pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "labelAdvancedObject":
|
|
||||||
_truck = new DrawingGasolineTanker(
|
|
||||||
(int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value,
|
|
||||||
Color.White, Color.Black,
|
|
||||||
checkBoxTanker.Checked, checkBoxWheel.Checked,
|
|
||||||
pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DrawTruck();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Передача цвета при нажатии на одну из Panel с цветом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
|
||||||
DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Проверка получаемой информации (ее типа на соответствие требуемому: цвет) для Label с основным цветом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void LabelMainColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)) && _truck != null)
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Действия при приеме перетаскиваемого цвета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void LabelMainColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
var color = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
_truck.EntityTruck.ChangeBodyColor(color);
|
|
||||||
DrawTruck();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)) && _truck != null && _truck is DrawingGasolineTanker)
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
var color = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
|
|
||||||
EntityGasolineTanker? _gasolinetanker = _truck.EntityTruck as EntityGasolineTanker;
|
|
||||||
_gasolinetanker.ChangeAdditionalColor(color);
|
|
||||||
DrawTruck();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
EventAddTruck?.Invoke(_truck);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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,97 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Generic
|
|
||||||
{
|
|
||||||
internal class SetGeneric<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
// список объектов
|
|
||||||
private readonly List<T?> _places;
|
|
||||||
// кол-во объектов
|
|
||||||
public int Count => _places.Count;
|
|
||||||
// максимальное количество
|
|
||||||
private readonly int _maxCount;
|
|
||||||
public SetGeneric(int count)
|
|
||||||
{
|
|
||||||
_maxCount = count;
|
|
||||||
_places = new List<T?>(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Добавление объекта в начало
|
|
||||||
public int Insert(T truck)
|
|
||||||
{
|
|
||||||
_places.Insert(0, truck);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Добавление объекта в набор на конкретную позицию
|
|
||||||
public bool Insert(T truck, int position)
|
|
||||||
{
|
|
||||||
// TODO проверка позиции
|
|
||||||
if (position < 0 || position >= Count || Count >= _maxCount)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO вставка по позиции
|
|
||||||
_places.Insert(position, truck);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Удаление объекта из набора с конкретной позиции
|
|
||||||
public bool Remove(int position)
|
|
||||||
{
|
|
||||||
// TODO проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// TODO удаление объекта из списка
|
|
||||||
_places.RemoveAt(position);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Получение объекта из набора по позиции
|
|
||||||
public T? this[int position]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// TODO проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _places[position];
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
// TODO проверка позиции
|
|
||||||
if (position < 0 || position > Count || Count >= _maxCount)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO вставка в список по позиции
|
|
||||||
_places.Insert(position, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Проход по списку
|
|
||||||
public IEnumerable<T?> GetTruck(int? maxTruck = null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _places.Count; ++i)
|
|
||||||
{
|
|
||||||
yield return _places[i];
|
|
||||||
if (maxTruck.HasValue && i == maxTruck.Value)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.MovementStratg;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Generic
|
|
||||||
{
|
|
||||||
internal class TruckGenericCollection<T, U>
|
|
||||||
where T : DrawingTruck
|
|
||||||
where U : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly int _pictureWidth;
|
|
||||||
private readonly int _pictureHeight;
|
|
||||||
// Размер занимаемого места
|
|
||||||
private readonly int _placeSizeWidth = 200;
|
|
||||||
private readonly int _placeSizeHeight = 80;
|
|
||||||
// коллекция
|
|
||||||
private readonly SetGeneric<T> _collection;
|
|
||||||
|
|
||||||
public TruckGenericCollection(int picWidth, int picHeight)
|
|
||||||
{
|
|
||||||
int width = picWidth / _placeSizeWidth;
|
|
||||||
int height = picHeight / _placeSizeHeight;
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
|
|
||||||
_collection = new SetGeneric<T>(width * height);
|
|
||||||
}
|
|
||||||
public static int operator +(TruckGenericCollection<T, U> collect, T? obj)
|
|
||||||
{
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
return collect._collection.Insert(obj);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
public static bool operator -(TruckGenericCollection<T, U> collect, int pos)
|
|
||||||
{
|
|
||||||
if (collect._collection.GetTruck(pos) == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return collect?._collection.Remove(pos) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// получение объектов коллекции
|
|
||||||
public IEnumerable<T?> GetTruck => _collection.GetTruck();
|
|
||||||
|
|
||||||
// получение объекта IMoveableObjecr
|
|
||||||
public U? GetU(int pos)
|
|
||||||
{
|
|
||||||
return (U?)_collection[pos]?.GetMoveableObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// вывод всего набора
|
|
||||||
public Bitmap ShowTruck()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
DrawBackground(gr);
|
|
||||||
DrawObjects(gr);
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// прорисовка фона
|
|
||||||
private void DrawBackground(Graphics gr)
|
|
||||||
{
|
|
||||||
Pen pen = new(Color.Black, 3);
|
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
|
||||||
{
|
|
||||||
// линия разметки
|
|
||||||
gr.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
|
||||||
gr.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawObjects(Graphics g)
|
|
||||||
{
|
|
||||||
// координаты
|
|
||||||
int x = 0;
|
|
||||||
int y = _pictureHeight / _placeSizeHeight - 1;
|
|
||||||
|
|
||||||
foreach (var truck in _collection.GetTruck())
|
|
||||||
{
|
|
||||||
if (truck != null)
|
|
||||||
{
|
|
||||||
// TODO получение объекта
|
|
||||||
if (x > _pictureWidth / _placeSizeWidth - 1)
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
--y;
|
|
||||||
}
|
|
||||||
// TODO установка позиции
|
|
||||||
truck.SetPosition(_placeSizeWidth * x, _placeSizeHeight * y);
|
|
||||||
// TODO прорисовка объекта
|
|
||||||
truck.DrawTransport(g);
|
|
||||||
++x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,152 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.MovementStratg;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Generic
|
|
||||||
{
|
|
||||||
internal class TruckGenericStorage
|
|
||||||
{
|
|
||||||
//Словарь (хранилище)
|
|
||||||
readonly Dictionary<string, TruckGenericCollection<DrawingTruck, DrawingObjectTruck>> _TruckStorages;
|
|
||||||
//Возвращение списка названий наборов
|
|
||||||
public List<string> Keys => _TruckStorages.Keys.ToList();
|
|
||||||
//Ширина окна отрисовки
|
|
||||||
private readonly int _pictureWidth;
|
|
||||||
//Высота окна отрисовки
|
|
||||||
private readonly int _pictureHeight;
|
|
||||||
|
|
||||||
// Разделитель для записи ключа и значения элемента словаря
|
|
||||||
private static readonly char _separatorForKeyValue = '|';
|
|
||||||
// Разделитель для записей коллекции данных в файл
|
|
||||||
private readonly char _separatorRecords = ';';
|
|
||||||
// Разделитель для записи информации по объекту в файл
|
|
||||||
private static readonly char _separatorForObject = ':';
|
|
||||||
|
|
||||||
public TruckGenericStorage(int pictureWidth, int pictureHeight)
|
|
||||||
{
|
|
||||||
_TruckStorages = new Dictionary<string, TruckGenericCollection<DrawingTruck, DrawingObjectTruck>>();
|
|
||||||
_pictureWidth = pictureWidth;
|
|
||||||
_pictureHeight = pictureHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Добавление набора
|
|
||||||
public void AddSet(string name)
|
|
||||||
{
|
|
||||||
// TODO Прописать логику для добавления
|
|
||||||
// проверка, что нет набора с таким именем
|
|
||||||
foreach (string nameStorage in Keys)
|
|
||||||
{
|
|
||||||
if (nameStorage == name)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Набор с заданным именем уже занят", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_TruckStorages.Add(name, new TruckGenericCollection<DrawingTruck, DrawingObjectTruck>(_pictureWidth, _pictureHeight));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Удаление набора
|
|
||||||
public void DelSet(string name)
|
|
||||||
{
|
|
||||||
// TODO Прописать логику для удаления
|
|
||||||
if (_TruckStorages.ContainsKey(name))
|
|
||||||
{
|
|
||||||
_TruckStorages.Remove(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Доступ к набору
|
|
||||||
public TruckGenericCollection<DrawingTruck, DrawingObjectTruck>? this[string ind]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// TODO Продумать логику получения набора
|
|
||||||
if (_TruckStorages.ContainsKey(ind))
|
|
||||||
{
|
|
||||||
return _TruckStorages[ind];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SaveData(string filename)
|
|
||||||
{
|
|
||||||
if (File.Exists(filename))
|
|
||||||
{
|
|
||||||
File.Delete(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamWriter sw = File.CreateText(filename))
|
|
||||||
{
|
|
||||||
sw.WriteLine($"TruckStorage");
|
|
||||||
foreach (var record in _TruckStorages)
|
|
||||||
{
|
|
||||||
StringBuilder records = new();
|
|
||||||
foreach (DrawingTruck? elem in record.Value.GetTruck)
|
|
||||||
{
|
|
||||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
|
||||||
}
|
|
||||||
sw.WriteLine($"{record.Key}{_separatorForKeyValue}{records}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Загрузка информации по автомобилям в хранилище из файла
|
|
||||||
public bool LoadData(string filename)
|
|
||||||
{
|
|
||||||
if (!File.Exists(filename))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamReader sr = File.OpenText(filename))
|
|
||||||
{
|
|
||||||
// 1-ая строка
|
|
||||||
string? curLine = sr.ReadLine();
|
|
||||||
// пустая или не те данные
|
|
||||||
if (curLine == null || !curLine.Contains("TruckStorage"))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// очищаем
|
|
||||||
_TruckStorages.Clear();
|
|
||||||
|
|
||||||
// загружаем данные построчно
|
|
||||||
curLine = sr.ReadLine();
|
|
||||||
while (curLine != null)
|
|
||||||
{
|
|
||||||
// загружаем запись
|
|
||||||
string[] record = curLine.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
|
|
||||||
// загружаем набор
|
|
||||||
TruckGenericCollection<DrawingTruck, DrawingObjectTruck> collection = new(_pictureWidth, _pictureHeight);
|
|
||||||
// record[0] - название набора, record[1] - куча объектов
|
|
||||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
|
|
||||||
foreach (string elem in set)
|
|
||||||
{
|
|
||||||
DrawingTruck? Truck = elem?.CreateDrawingTruck(_separatorForObject, _pictureWidth, _pictureHeight);
|
|
||||||
// проверяем, не переполнится ли коллекция
|
|
||||||
if (Truck != null)
|
|
||||||
{
|
|
||||||
if (collection + Truck == -1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_TruckStorages.Add(record[0], collection);
|
|
||||||
curLine = sr.ReadLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
|
|
||||||
private IMoveableObject? _moveableObject;
|
|
||||||
|
|
||||||
private Status _state = Status.NotInit;
|
|
||||||
|
|
||||||
protected int FieldWidth { get; private set; }
|
|
||||||
|
|
||||||
protected int FieldHeight { get; private set; }
|
|
||||||
|
|
||||||
public Status GetStatus() { return _state; }
|
|
||||||
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
|
||||||
{
|
|
||||||
if (moveableObject == null)
|
|
||||||
{
|
|
||||||
_state = Status.NotInit;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_state = Status.InProgress;
|
|
||||||
_moveableObject = moveableObject;
|
|
||||||
FieldWidth = width;
|
|
||||||
FieldHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (IsTargetDestinaion())
|
|
||||||
{
|
|
||||||
_state = Status.Finish;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
|
||||||
|
|
||||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
|
||||||
|
|
||||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
|
||||||
|
|
||||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
|
||||||
|
|
||||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
|
||||||
|
|
||||||
protected int? GetStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _moveableObject?.GetStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
|
|
||||||
protected abstract bool IsTargetDestinaion();
|
|
||||||
|
|
||||||
private bool MoveTo(DirectionType directionType)
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
|
||||||
{
|
|
||||||
_moveableObject.MoveObject(directionType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
|
|
||||||
public class DrawingObjectTruck : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly DrawingTruck? _drawingTruck = null;
|
|
||||||
public DrawingObjectTruck(DrawingTruck drawingTruck)
|
|
||||||
{
|
|
||||||
_drawingTruck = drawingTruck;
|
|
||||||
}
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_drawingTruck == null || _drawingTruck.EntityTruck == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ObjectParameters(_drawingTruck.GetPosX, _drawingTruck.GetPosY, _drawingTruck.GetWidth, _drawingTruck.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int GetStep => (int)(_drawingTruck?.EntityTruck?.Step ?? 0);
|
|
||||||
public bool CheckCanMove(DirectionType direction) => _drawingTruck?.CanMove(direction) ?? false;
|
|
||||||
public void MoveObject(DirectionType direction) => _drawingTruck?.MoveTransport(direction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectGasolineTanker.Drawings;
|
|
||||||
using ProjectGasolineTanker.Entities;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
|
|
||||||
public interface IMoveableObject
|
|
||||||
{
|
|
||||||
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
|
|
||||||
int GetStep { get; }
|
|
||||||
|
|
||||||
bool CheckCanMove(DirectionType direction);
|
|
||||||
|
|
||||||
void MoveObject(DirectionType direction);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
internal class MoveToBorder : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var 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()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Стратегия перемещения объекта в центр экрана
|
|
||||||
/// </summary>
|
|
||||||
public class MoveToCenter : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
|
||||||
}
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.MovementStratg
|
|
||||||
{
|
|
||||||
public enum Status
|
|
||||||
{
|
|
||||||
NotInit,
|
|
||||||
InProgress,
|
|
||||||
Finish
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectGasolineTanker.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectGasolineTanker.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap стрелка_вверх {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("стрелка вверх", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap стрелка_влево {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("стрелка влево", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap стрелка_вниз {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("стрелка вниз", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap стрелка_вправо {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("стрелка вправо", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +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>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="стрелка вверх" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\стрелка вверх.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="стрелка влево" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\стрелка влево.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="стрелка вниз" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\стрелка вниз.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="стрелка вправо" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\стрелка вправо.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user