Compare commits

...

8 Commits
main ... Lab8

Author SHA1 Message Date
Arkadiy Radaev
737406f412 "Философия есть познание того, что есть" - Гегель 2023-12-13 11:58:02 +04:00
Arkadiy Radaev
b2c527eccd "Вся суть в деталях" - Гут... 2023-12-13 11:50:29 +04:00
Аркадий Радаев
500c134a0c komit 2023-11-28 13:45:08 +04:00
Аркадий Радаев
5ce4825742 res 2023-11-25 20:02:11 +04:00
Аркадий Радаев
a9f980816e res 2023-11-19 12:36:59 +04:00
Аркадий Радаев
aade6261c5 done 2023-11-12 11:28:15 +04:00
Аркадий Радаев
eda14d9810 res 2023-10-31 12:27:43 +04:00
Аркадий Радаев
c2010846bc done 2023-10-31 12:23:01 +04:00
34 changed files with 3504 additions and 0 deletions

View File

@ -0,0 +1,83 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
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;
}
}
}

View File

@ -0,0 +1,18 @@
<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>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.5" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
</Project>

25
Catamaran/Catamaran.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Catamaran", "Catamaran.csproj", "{8734495B-CED4-4494-9044-77EA6895145A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8734495B-CED4-4494-9044-77EA6895145A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8734495B-CED4-4494-9044-77EA6895145A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8734495B-CED4-4494-9044-77EA6895145A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8734495B-CED4-4494-9044-77EA6895145A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4693C53A-17F9-49D1-B07F-0DF85BF650FB}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaranCollectionInfo : IEquatable<CatamaranCollectionInfo>
{
public string Name { get; private set; }
public string Description { get; private set; }
public CatamaranCollectionInfo(string name, string description)
{
Name = name;
Description = description;
}
public bool Equals(CatamaranCollectionInfo? other)
{
return Name == other.Name;
}
public override int GetHashCode()
{
return this.Name.GetHashCode();
}
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaranCompareByColor: IComparer<DrawningCatamaran?>
{
public int Compare(DrawningCatamaran? x, DrawningCatamaran? y)
{
if (x == null || x.EntityCatamaran == null)
throw new ArgumentNullException(nameof(x));
if (y == null || y.EntityCatamaran == null)
throw new ArgumentNullException(nameof(y));
if (x.EntityCatamaran.BodyColor.Name != y.EntityCatamaran.BodyColor.Name)
{
return x.EntityCatamaran.BodyColor.Name.CompareTo(y.EntityCatamaran.BodyColor.Name);
}
if (x.GetType().Name != y.GetType().Name)
{
if (x is DrawningCatamaran)
return -1;
else
return 1;
}
if (x.GetType().Name == y.GetType().Name && x is DrawningCatamaranPro)
{
EntityCatamaranPro EntityX = (EntityCatamaranPro)x.EntityCatamaran;
EntityCatamaranPro EntityY = (EntityCatamaranPro)y.EntityCatamaran;
if (EntityX.AdditionalColor.Name != EntityY.AdditionalColor.Name)
{
return EntityX.AdditionalColor.Name.CompareTo(EntityY.AdditionalColor.Name);
}
}
var speedCompare = x.EntityCatamaran.Speed.CompareTo(y.EntityCatamaran.Speed);
if (speedCompare != 0)
return speedCompare;
return x.EntityCatamaran.Weight.CompareTo(y.EntityCatamaran.Weight);
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaranCompareByType: IComparer<DrawningCatamaran?>
{
public int Compare(DrawningCatamaran? x, DrawningCatamaran? y)
{
if (x == null || x.EntityCatamaran == null)
{
throw new ArgumentNullException(nameof(x));
}
if (y == null || y.EntityCatamaran == null)
{
throw new ArgumentNullException(nameof(y));
}
if (x.GetType().Name != y.GetType().Name)
{
return x.GetType().Name.CompareTo(y.GetType().Name);
}
var speedCompare = x.EntityCatamaran.Speed.CompareTo(y.EntityCatamaran.Speed);
if (speedCompare != 0)
{
return speedCompare;
}
return x.EntityCatamaran.Weight.CompareTo(y.EntityCatamaran.Weight);
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaranNotFoundException : ApplicationException
{
public CatamaranNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
public CatamaranNotFoundException() : base() { }
public CatamaranNotFoundException(string message) : base(message) { }
public CatamaranNotFoundException(string message, Exception exception) : base(message, exception) { }
protected CatamaranNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic.Logging;
namespace Catamaran
{
internal class CatamaransGenericCollection<T, U>
where T : DrawningCatamaran
where U : IMoveableObject
{
public IEnumerable<T?> GetCatamarans => _collection.GetCatamarans();
private readonly int _pictureWidth;
private readonly int _pictureHeight;
private readonly int _placeSizeWidth = 210;
private readonly int _placeSizeHeight = 90;
private readonly SetGeneric<T> _collection;
public void Sort(IComparer<T?> comparer) => _collection.SortSet(comparer);
public CatamaransGenericCollection(int picWidth, int picHeight)
{
int width = picWidth / _placeSizeWidth;
int height = picHeight / _placeSizeHeight;
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = new SetGeneric<T>(width * height);
}
public static bool operator +(CatamaransGenericCollection<T, U> collect, T? obj)
{
if (obj == null)
return false;
return collect?._collection.Insert(obj, new DrawningCatamaranEqutables()) ?? false;
}
public static T? operator -(CatamaransGenericCollection<T, U> collect, int pos)
{
T? obj = collect._collection[pos];
collect._collection.Remove(pos);
return obj;
}
public U? GetU(int pos)
{
return (U?)_collection[pos]?.GetMoveableObject;
}
public Bitmap ShowCats()
{
Bitmap bmp = new(_pictureWidth, _pictureHeight);
Graphics gr = Graphics.FromImage(bmp);
DrawBackground(gr);
DrawObjects(gr);
return bmp;
}
private void DrawBackground(Graphics g)
{
Pen pen = new(Color.Black, 3);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
1; ++j)
{
g.DrawLine(pen, i * _placeSizeWidth, j *
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
_placeSizeHeight);
}
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
}
}
private void DrawObjects(Graphics g)
{
int i = 0;
foreach (var catamaran in _collection.GetCatamarans())
{
if (catamaran!= null)
{
int inRow = _pictureWidth / _placeSizeWidth;
catamaran.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight);
catamaran.DrawTransport(g);
}
i++;
}
}
}
}

View File

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaransGenericStorage
{
readonly Dictionary<CatamaranCollectionInfo, CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>> _catStorages;
public List<CatamaranCollectionInfo> Keys => _catStorages.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 CatamaransGenericStorage(int pictureWidth, int pictureHeight)
{
_catStorages = new Dictionary<CatamaranCollectionInfo,
CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
public bool SaveData(string filename)
{
if (File.Exists(filename))
{
File.Delete(filename);
}
StringBuilder data = new();
foreach (KeyValuePair<CatamaranCollectionInfo,
CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>> record in _catStorages)
{
StringBuilder records = new();
foreach (DrawningCatamaran? elem in record.Value.GetCatamarans)
{
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
}
data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}");
}
if (data.Length == 0)
{
throw new Exception("Невалиданя операция, нет данных для сохранения");
}
string toWrite = $"CatamaranStorage{Environment.NewLine}{data}";
var strs = toWrite.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
using (StreamWriter sw = new(filename))
{
foreach (var str in strs)
{
sw.WriteLine(str);
}
}
return true;
}
public bool LoadData(string filename)
{
if (!File.Exists(filename))
{
throw new IOException("Файл не найден");
}
using (StreamReader sr = new(filename))
{
string str = sr.ReadLine();
var strs = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
if (strs == null || strs.Length == 0)
{
throw new IOException("Нет данных для загрузки");
}
if (!strs[0].StartsWith("CatamaranStorage"))
{
throw new IOException("Неверный формат данных");
}
_catStorages.Clear();
do
{
string[] record = str.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
if (record.Length != 2)
{
str = sr.ReadLine();
continue;
}
CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran> collection = new(_pictureWidth, _pictureHeight);
string[] set = record[1].Split(_separatorRecords,
StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set)
{
DrawningCatamaran? catamaran =
elem?.CreateDrawningCatamaran(_separatorForObject, _pictureWidth, _pictureHeight);
if (catamaran != null)
{
if (!(collection + catamaran))
{
return false;
}
}
}
_catStorages.Add(new CatamaranCollectionInfo(record[0], string.Empty), collection);
str = sr.ReadLine();
} while (str != null);
}
return true;
}
public void AddSet(string name)
{
_catStorages.Add(new CatamaranCollectionInfo(name, string.Empty), new CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>(_pictureWidth, _pictureHeight));
}
public void DelSet(string name)
{
if (!_catStorages.ContainsKey(new CatamaranCollectionInfo(name, string.Empty)))
return;
_catStorages.Remove(new CatamaranCollectionInfo(name, string.Empty));
}
public CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>? this[string ind]
{
get
{
CatamaranCollectionInfo indObj = new CatamaranCollectionInfo(ind, string.Empty);
if (_catStorages.ContainsKey(indObj))
return _catStorages[indObj];
return null;
}
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public enum DirectionType
{
Up = 1,
Down = 2,
Left = 3,
Right = 4
}
}

View File

@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class DrawningCatamaran
{
public EntityCatamaran? EntityCatamaran { get; set; }
public int _pictureWidth = 800;
public int _pictureHeight = 450;
public int _startPosX = 0;
public int _startPosY = 0;
public readonly int _catamaranWidth = 120;
public readonly int _catamaranHeight = 80;
public IMoveableObject GetMoveableObject => new DrawningObjectCatamaran(this);
public DrawningCatamaran(int speed, double weight, Color bodyColor, int width, int height)
{
if (_pictureHeight < _catamaranWidth && _pictureWidth < _catamaranHeight) return;
_pictureWidth = width;
_pictureHeight = height;
EntityCatamaran = new EntityCatamaran(speed,weight,bodyColor);
}
protected DrawningCatamaran(int speed, double weight, Color bodyColor, int width, int height, int catWidth, int catHeight)
{
if (width <= _catamaranWidth || height <= _catamaranHeight) return;
_pictureWidth = width;
_pictureHeight = height;
_catamaranWidth = catWidth;
_catamaranHeight = catHeight;
EntityCatamaran = new EntityCatamaran(speed, weight, bodyColor);
}
public void ChangeColor(Color col)
{
if (EntityCatamaran == null)
return;
EntityCatamaran.BodyColor = col;
}
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
{
_pictureHeight = pictureBoxHeight;
_pictureWidth = pictureBoxWidth;
}
public void SetPosition(int x, int y)
{
if(EntityCatamaran == null) return;
_startPosX = x;
_startPosY = y;
if (x + _catamaranWidth >= _pictureWidth || y + _catamaranHeight >= _pictureHeight)
{
_startPosX = 1;
_startPosY = 1;
}
}
public int GetPosX => _startPosX;
public int GetPosY => _startPosY;
public int GetWidth => _catamaranWidth;
public int GetHeight => _catamaranHeight;
public bool CanMove(DirectionType direction)
{
if (EntityCatamaran == null)
{
return false;
}
return direction switch
{
DirectionType.Left => _startPosX - EntityCatamaran.Step > 0,
DirectionType.Up => _startPosY - EntityCatamaran.Step > 0,
DirectionType.Right => _startPosX + EntityCatamaran.Step < _pictureWidth,
DirectionType.Down => _startPosY -+EntityCatamaran.Step < _pictureHeight,
_ => false,
};
}
public void MoveTransport(DirectionType direction)
{
if (EntityCatamaran == null)
{
return;
}
switch (direction)
{
case DirectionType.Left:
if (_startPosX - EntityCatamaran.Step > 0)
{
_startPosX -= (int)EntityCatamaran.Step;
}
break;
case DirectionType.Up:
if (_startPosY - EntityCatamaran.Step > 0)
{
_startPosY -= (int)EntityCatamaran.Step;
}
break;
case DirectionType.Right:
if (_startPosX + _catamaranWidth + EntityCatamaran.Step < _pictureWidth)
{
_startPosX += (int)EntityCatamaran.Step;
}
break;
case DirectionType.Down:
if (_startPosY + _catamaranHeight + EntityCatamaran.Step < _pictureHeight)
{
_startPosY += (int)EntityCatamaran.Step;
}
break;
}
}
public virtual void DrawTransport(Graphics g)
{
if (EntityCatamaran is not EntityCatamaran Cat)
{
return;
}
Pen pen = new(Color.Black);
Brush bodyBrush = new SolidBrush(Cat.BodyColor);
Brush ellipseBrush = new SolidBrush(Color.AliceBlue);
g.FillRectangle(bodyBrush, _startPosX+10, _startPosY+10, _catamaranWidth - 50, 60);
g.DrawRectangle(pen, _startPosX+10, _startPosY+10, _catamaranWidth - 50, 60);
g.FillEllipse(ellipseBrush, _startPosX + 15, _startPosY + 25, 60, 30);
g.DrawEllipse(pen, _startPosX + 15, _startPosY + 25, 60, 30);
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 35, 10, 10);
g.DrawEllipse(pen, _startPosX + 35, _startPosY + 35, 10, 10);
g.DrawEllipse(pen, _startPosX + 50, _startPosY + 35, 10, 10);
Point[] pontf = { new Point(_startPosX + _catamaranWidth - 40, _startPosY+10), new Point(_startPosX + _catamaranWidth, _startPosY + 40), new Point(_startPosX + _catamaranWidth - 40, _startPosY + 70) };
g.DrawPolygon(pen, pontf);
}
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class DrawningCatamaranEqutables: IEqualityComparer<DrawningCatamaran?>
{
public bool Equals(DrawningCatamaran? x, DrawningCatamaran? y)
{
if (x == null || x.EntityCatamaran == null)
{
throw new ArgumentNullException(nameof(x));
}
if (y == null || y.EntityCatamaran == null)
{
throw new ArgumentNullException(nameof(y));
}
if (x.GetType().Name != y.GetType().Name)
{
return false;
}
if (x.EntityCatamaran.Speed != y.EntityCatamaran.Speed)
{
return false;
}
if (x.EntityCatamaran.Weight != y.EntityCatamaran.Weight)
{
return false;
}
if (x.EntityCatamaran.BodyColor != y.EntityCatamaran.BodyColor)
{
return false;
}
if (x is DrawningCatamaranPro && y is DrawningCatamaranPro)
{
EntityCatamaranPro EntityX = (EntityCatamaranPro)x.EntityCatamaran;
EntityCatamaranPro EntityY = (EntityCatamaranPro)y.EntityCatamaran;
if (EntityX.Motor != EntityY.Motor)
return false;
if (EntityX.BodyKit != EntityY.BodyKit)
return false;
if (EntityX.Sail != EntityY.Sail)
return false;
if (EntityX.AdditionalColor != EntityY.AdditionalColor)
return false;
}
return true;
}
public int GetHashCode([DisallowNull] DrawningCatamaran obj)
{
return obj.GetHashCode();
}
}
}

View File

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class DrawningCatamaranPro : DrawningCatamaran
{
public DrawningCatamaranPro(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool motor, bool sail, int width, int height) :
base(speed, weight, bodyColor, width, height)
{
if (EntityCatamaran != null)
{
EntityCatamaran = new EntityCatamaranPro(speed, weight, bodyColor, additionalColor,bodyKit, motor, sail);
}
}
public void ChangeAddColor(Color col)
{
((EntityCatamaranPro)EntityCatamaran).AdditionalColor = col;
}
public override void DrawTransport(Graphics g)
{
if (EntityCatamaran is not EntityCatamaranPro CatPro)
{
return;
}
base.DrawTransport(g);
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(CatPro.AdditionalColor);
Brush floatsBrush = new SolidBrush(CatPro.AdditionalColor);
if (CatPro.Motor)
{
g.FillRectangle(additionalBrush, _startPosX, _startPosY+25, 10, 30);
g.DrawRectangle(pen, _startPosX, _startPosY+25, 10, 30);
g.DrawRectangle(pen, _startPosX+5, _startPosY+30, 5, 20);
}
if(CatPro.BodyKit)
{
g.FillRectangle(floatsBrush, _startPosX, _startPosY, _catamaranWidth - 20, 10);
g.DrawRectangle(pen, _startPosX, _startPosY, _catamaranWidth - 20, 10);
g.FillRectangle(floatsBrush, _startPosX, _startPosY + 70, _catamaranWidth - 20, 10);
g.DrawRectangle(pen, _startPosX, _startPosY + 70, _catamaranWidth - 20, 10);
Point[] trig1 = { new Point(_startPosX + _catamaranWidth -20, _startPosY), new Point(_startPosX + _catamaranWidth, _startPosY + 5), new Point(_startPosX+_catamaranWidth - 20, _startPosY+10) };
g.DrawPolygon(pen, trig1);
Point[] trig2 = { new Point(_startPosX + _catamaranWidth - 20, _startPosY + 70), new Point(_startPosX + _catamaranWidth, _startPosY + 75), new Point(_startPosX + _catamaranWidth - 20, _startPosY + 80) };
g.DrawPolygon(pen, trig2);
for (int i = 10; i< 100; i+=10)
{
Point point1 = new Point(_startPosX+i, _startPosY);
Point point2 = new Point(_startPosX+i, _startPosY+10);
g.DrawLine(pen, point1, point2);
}
for (int i = 10; i< 100; i+=10)
{
Point point3 = new Point(_startPosX+i, _startPosY+70);
Point point4 = new Point(_startPosX+i, _startPosY+_catamaranHeight);
g.DrawLine(pen, point3, point4);
}
}
if (CatPro.Sail)
{
SolidBrush machta = new SolidBrush(Color.Brown);
SolidBrush sail = new SolidBrush(Color.White);
Point[] pointf = { new Point(_startPosX+50, _startPosY+40), new Point(_startPosX+60,_startPosY+40), new Point(_startPosX+45, _startPosY+20), new Point(_startPosX+35, _startPosY+20) };
g.FillPolygon(sail,pointf);
g.DrawPolygon(pen,pointf);
g.FillEllipse(machta, _startPosX + 50, _startPosY + 35, 10, 10);
}
Point[] points = { new Point(_startPosX + _catamaranWidth - 35, _startPosY+20), new Point(_startPosX + _catamaranWidth - 10, _startPosY + 40), new Point(_startPosX + _catamaranWidth - 35, _startPosY + 60) };
g.FillPolygon(additionalBrush, points);
g.DrawPolygon(pen, points);
}
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class DrawningObjectCatamaran : IMoveableObject
{
private readonly DrawningCatamaran? _DrawningCatamaran = null;
public DrawningObjectCatamaran(DrawningCatamaran drawningCatamaran)
{
_DrawningCatamaran = drawningCatamaran;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_DrawningCatamaran == null || _DrawningCatamaran.EntityCatamaran == null)
{
return null;
}
return new ObjectParameters(_DrawningCatamaran.GetPosX,
_DrawningCatamaran.GetPosY, _DrawningCatamaran.GetWidth, _DrawningCatamaran.GetHeight);
}
}
public int GetStep => (int)(_DrawningCatamaran?.EntityCatamaran?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) =>
_DrawningCatamaran?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) =>
_DrawningCatamaran?.MoveTransport(direction);
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class EntityCatamaran
{
public int Speed { get; private set; }
public double Weight { get; private set; }
public Color BodyColor { get; set; }
public double Step => (double)Speed * 100 / Weight;
public EntityCatamaran(int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
}
}
}

View File

@ -0,0 +1,28 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class EntityCatamaranPro : EntityCatamaran
{
public Color AdditionalColor { get; set; }
public bool Motor { get; private set; }
public bool BodyKit { get; private set; }
public bool Sail { get; private set; }
public EntityCatamaranPro(int speed, double weight, Color bodyColor,Color additionalColor, bool bodykit, bool motor, bool sail) :
base(speed, weight, bodyColor)
{
AdditionalColor = additionalColor;
Motor = motor;
Sail = sail;
BodyKit = bodykit;
}
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public static class ExtentionDrawningCatamaran
{
public static DrawningCatamaran? CreateDrawningCatamaran(this string info, char
separatorForObject, int width, int height)
{
string[] strs = info.Split(separatorForObject);
if (strs.Length == 3)
{
return new DrawningCatamaran(Convert.ToInt32(strs[0]),
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
}
if (strs.Length == 7)
{
return new DrawningCatamaranPro(Convert.ToInt32(strs[0]),
Convert.ToInt32(strs[1]),
Color.FromName(strs[2]),
Color.FromName(strs[3]),
Convert.ToBoolean(strs[4]),
Convert.ToBoolean(strs[5]),
Convert.ToBoolean(strs[6]), width, height);
}
return null;
}
public static string GetDataForSave(this DrawningCatamaran DrawningCatamaran,
char separatorForObject)
{
var catamaran = DrawningCatamaran.EntityCatamaran;
if (catamaran == null)
{
return string.Empty;
}
var str = $"{catamaran.Speed}{separatorForObject}{catamaran.Weight}{separatorForObject}{catamaran.BodyColor.Name}";
if (catamaran is not EntityCatamaranPro CatPro)
{
return str;
}
return $"{str}{separatorForObject}{CatPro.AdditionalColor.Name}{separatorForObject}{CatPro.BodyKit}{separatorForObject}{CatPro.Motor}{separatorForObject}{CatPro.Sail}";
}
}
}

185
Catamaran/FormCatamaran.Designer.cs generated Normal file
View File

@ -0,0 +1,185 @@
namespace Catamaran
{
partial class FormCatamaran
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
pictureBox=new PictureBox();
buttonCreateBasic=new Button();
buttonUp=new Button();
buttonRight=new Button();
buttonDown=new Button();
buttonLeft=new Button();
buttonCreatePro=new Button();
comboBox=new ComboBox();
buttonStep=new Button();
buttonSelect=new Button();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// pictureBox
//
pictureBox.Dock=DockStyle.Fill;
pictureBox.Location=new Point(0, 0);
pictureBox.Margin=new Padding(4, 5, 4, 5);
pictureBox.Name="pictureBox";
pictureBox.Size=new Size(1143, 750);
pictureBox.TabIndex=5;
pictureBox.TabStop=false;
pictureBox.Click+=ButtonMove_Click;
//
// buttonCreateBasic
//
buttonCreateBasic.Anchor=AnchorStyles.Bottom|AnchorStyles.Left;
buttonCreateBasic.Location=new Point(34, 638);
buttonCreateBasic.Margin=new Padding(4, 5, 4, 5);
buttonCreateBasic.Name="buttonCreateBasic";
buttonCreateBasic.Size=new Size(167, 73);
buttonCreateBasic.TabIndex=6;
buttonCreateBasic.Text="Создать база";
buttonCreateBasic.UseVisualStyleBackColor=true;
buttonCreateBasic.Click+=buttonCreate_Click;
//
// buttonUp
//
buttonUp.Anchor=AnchorStyles.Bottom|AnchorStyles.Right;
buttonUp.Location=new Point(979, 597);
buttonUp.Margin=new Padding(4, 5, 4, 5);
buttonUp.Name="buttonUp";
buttonUp.Size=new Size(43, 50);
buttonUp.TabIndex=10;
buttonUp.Text="⬆️";
buttonUp.UseVisualStyleBackColor=true;
buttonUp.Click+=ButtonMove_Click;
//
// buttonRight
//
buttonRight.Anchor=AnchorStyles.Bottom|AnchorStyles.Right;
buttonRight.Location=new Point(1030, 657);
buttonRight.Margin=new Padding(4, 5, 4, 5);
buttonRight.Name="buttonRight";
buttonRight.Size=new Size(43, 50);
buttonRight.TabIndex=9;
buttonRight.Text="➞";
buttonRight.UseVisualStyleBackColor=true;
buttonRight.Click+=ButtonMove_Click;
//
// buttonDown
//
buttonDown.Anchor=AnchorStyles.Bottom|AnchorStyles.Right;
buttonDown.Location=new Point(979, 657);
buttonDown.Margin=new Padding(4, 5, 4, 5);
buttonDown.Name="buttonDown";
buttonDown.Size=new Size(43, 50);
buttonDown.TabIndex=8;
buttonDown.Text="⬇️";
buttonDown.UseVisualStyleBackColor=true;
buttonDown.Click+=ButtonMove_Click;
//
// buttonLeft
//
buttonLeft.Anchor=AnchorStyles.Bottom|AnchorStyles.Right;
buttonLeft.Location=new Point(927, 657);
buttonLeft.Margin=new Padding(4, 5, 4, 5);
buttonLeft.Name="buttonLeft";
buttonLeft.Size=new Size(43, 50);
buttonLeft.TabIndex=7;
buttonLeft.Text="⬅️";
buttonLeft.UseVisualStyleBackColor=true;
buttonLeft.Click+=ButtonMove_Click;
//
// buttonCreatePro
//
buttonCreatePro.Anchor=AnchorStyles.Bottom|AnchorStyles.Left;
buttonCreatePro.Location=new Point(240, 638);
buttonCreatePro.Margin=new Padding(4, 5, 4, 5);
buttonCreatePro.Name="buttonCreatePro";
buttonCreatePro.Size=new Size(167, 73);
buttonCreatePro.TabIndex=11;
buttonCreatePro.Text="Создать про";
buttonCreatePro.UseVisualStyleBackColor=true;
buttonCreatePro.Click+=buttonCreatePro_Click;
//
// comboBox
//
comboBox.FormattingEnabled=true;
comboBox.Items.AddRange(new object[] { "центр", "прав. ниж. гр." });
comboBox.Location=new Point(953, 20);
comboBox.Margin=new Padding(4, 5, 4, 5);
comboBox.Name="comboBox";
comboBox.Size=new Size(170, 33);
comboBox.TabIndex=12;
//
// buttonStep
//
buttonStep.Location=new Point(953, 68);
buttonStep.Margin=new Padding(4, 5, 4, 5);
buttonStep.Name="buttonStep";
buttonStep.Size=new Size(173, 42);
buttonStep.TabIndex=13;
buttonStep.Text="шаг";
buttonStep.UseVisualStyleBackColor=true;
buttonStep.Click+=buttonStep_Click;
//
// buttonSelect
//
buttonSelect.ImageAlign=ContentAlignment.TopCenter;
buttonSelect.Location=new Point(431, 638);
buttonSelect.Name="buttonSelect";
buttonSelect.Size=new Size(197, 73);
buttonSelect.TabIndex=14;
buttonSelect.Text="Выбрать катамаран";
buttonSelect.UseVisualStyleBackColor=true;
buttonSelect.Click+=buttonSelect_Click;
//
// FormCatamaran
//
AutoScaleDimensions=new SizeF(10F, 25F);
AutoScaleMode=AutoScaleMode.Font;
ClientSize=new Size(1143, 750);
Controls.Add(buttonSelect);
Controls.Add(buttonStep);
Controls.Add(comboBox);
Controls.Add(buttonCreatePro);
Controls.Add(buttonUp);
Controls.Add(buttonRight);
Controls.Add(buttonDown);
Controls.Add(buttonLeft);
Controls.Add(buttonCreateBasic);
Controls.Add(pictureBox);
Margin=new Padding(4, 5, 4, 5);
Name="FormCatamaran";
Text="FormCatamaran";
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private Button UpBut;
private PictureBox pictureBox;
private Button buttonCreateBasic;
private Button buttonUp;
private Button buttonRight;
private Button buttonDown;
private Button buttonLeft;
private Button buttonCreatePro;
private ComboBox comboBox;
private Button buttonStep;
public Button buttonSelect;
}
}

138
Catamaran/FormCatamaran.cs Normal file
View File

@ -0,0 +1,138 @@
namespace Catamaran
{
public partial class FormCatamaran : Form
{
public FormCatamaran()
{
InitializeComponent();
}
private DrawningCatamaran? _DrawningCatamaran;
private AbstractStrategy? _abstractStrategy;
public DrawningCatamaran? SelectedCatamaran { get; private set; }
private void Draw()
{
if (_DrawningCatamaran == null)
{
return;
}
Bitmap bmp = new(pictureBox.Width, pictureBox.Height);
Graphics gr = Graphics.FromImage(bmp);
_DrawningCatamaran.DrawTransport(gr);
pictureBox.Image = bmp;
}
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_DrawningCatamaran == null)
{
return;
}
string name = ((Button)sender)?.Name ?? string.Empty;
switch (name)
{
case "buttonUp":
_DrawningCatamaran.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
_DrawningCatamaran.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
_DrawningCatamaran.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
_DrawningCatamaran.MoveTransport(DirectionType.Right);
break;
}
Draw();
}
private void buttonCreate_Click(object sender, EventArgs e)
{
Random random = new();
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
Color additionalColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
bodyColor = dialog.Color;
}
_DrawningCatamaran = new DrawningCatamaran(random.Next(10, 30), random.Next(100, 300), bodyColor, pictureBox.Width, pictureBox.Height);
_DrawningCatamaran.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
private void buttonCreatePro_Click(object sender, EventArgs e)
{
Random random = new();
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
Color additionalColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
Color otherColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
bodyColor = dialog.Color;
}
if (dialog.ShowDialog() == DialogResult.OK)
{
additionalColor = dialog.Color;
}
_DrawningCatamaran = new DrawningCatamaranPro(random.Next(100, 300),
random.Next(1000, 3000), bodyColor, additionalColor, true, true, true, pictureBox.Width, pictureBox.Height);
_DrawningCatamaran.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
private void buttonStep_Click(object sender, EventArgs e)
{
if (_DrawningCatamaran == null)
{
return;
}
if (comboBox.Enabled)
{
_abstractStrategy = comboBox.SelectedIndex
switch
{
0 => new MoveToCenter(),
1 => new MoveToRightBorder(),
_ => null,
};
if (_abstractStrategy == null)
{
return;
}
_abstractStrategy.SetData(new
DrawningObjectCatamaran(_DrawningCatamaran), pictureBox.Width,
pictureBox.Height);
comboBox.Enabled = false;
}
if (_abstractStrategy == null)
{
return;
}
_abstractStrategy.MakeStep();
Draw();
if (_abstractStrategy.GetStatus() == Status.Finish)
{
comboBox.Enabled = true;
_abstractStrategy = null;
}
}
private void buttonSelect_Click(object sender, EventArgs e)
{
SelectedCatamaran = _DrawningCatamaran;
DialogResult = DialogResult.OK;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,691 @@
namespace Catamaran
{
partial class FormCatamaranCollection
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCatamaranCollection));
groupBoxCollection=new GroupBox();
buttonSortByColor=new Button();
buttonSortByType=new Button();
setsBox=new GroupBox();
DeleteSetButton=new Button();
SetslistBox=new ListBox();
setAddBox=new TextBox();
AddSetButton=new Button();
maskedTextBox=new MaskedTextBox();
buttonUpdateCollection=new Button();
buttonDeleteCat=new Button();
buttonAddCat=new Button();
pictureBoxCollection=new PictureBox();
содержимоеToolStripMenuItem1=new ToolStripMenuItem();
индексToolStripMenuItem1=new ToolStripMenuItem();
поискToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator11=new ToolStripSeparator();
опрограммеToolStripMenuItem1=new ToolStripMenuItem();
настройкиToolStripMenuItem1=new ToolStripMenuItem();
параметрыToolStripMenuItem1=new ToolStripMenuItem();
отменитьToolStripMenuItem1=new ToolStripMenuItem();
повторитьToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator9=new ToolStripSeparator();
вырезатьToolStripMenuItem1=new ToolStripMenuItem();
копироватьToolStripMenuItem1=new ToolStripMenuItem();
вставитьToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator10=new ToolStripSeparator();
выбратьвсеToolStripMenuItem1=new ToolStripMenuItem();
создатьToolStripMenuItem1=new ToolStripMenuItem();
открытьToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator6=new ToolStripSeparator();
сохранитьToolStripMenuItem1=new ToolStripMenuItem();
сохранитькакToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator7=new ToolStripSeparator();
печатьToolStripMenuItem1=new ToolStripMenuItem();
предварительныйпросмотрToolStripMenuItem1=new ToolStripMenuItem();
toolStripSeparator8=new ToolStripSeparator();
выходToolStripMenuItem1=new ToolStripMenuItem();
содержимоеToolStripMenuItem=new ToolStripMenuItem();
индексToolStripMenuItem=new ToolStripMenuItem();
поискToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator5=new ToolStripSeparator();
опрограммеToolStripMenuItem=new ToolStripMenuItem();
настройкиToolStripMenuItem=new ToolStripMenuItem();
параметрыToolStripMenuItem=new ToolStripMenuItem();
отменитьToolStripMenuItem=new ToolStripMenuItem();
повторитьToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator3=new ToolStripSeparator();
вырезатьToolStripMenuItem=new ToolStripMenuItem();
копироватьToolStripMenuItem=new ToolStripMenuItem();
вставитьToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator4=new ToolStripSeparator();
выбратьвсеToolStripMenuItem=new ToolStripMenuItem();
создатьToolStripMenuItem=new ToolStripMenuItem();
открытьToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator=new ToolStripSeparator();
сохранитьToolStripMenuItem=new ToolStripMenuItem();
сохранитькакToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator1=new ToolStripSeparator();
печатьToolStripMenuItem=new ToolStripMenuItem();
предварительныйпросмотрToolStripMenuItem=new ToolStripMenuItem();
toolStripSeparator2=new ToolStripSeparator();
выходToolStripMenuItem=new ToolStripMenuItem();
openFileDialog=new OpenFileDialog();
saveFileDialog=new SaveFileDialog();
menuStrip=new MenuStrip();
файлToolStripMenuItem=new ToolStripMenuItem();
сохранитьToolStripMenuItem2=new ToolStripMenuItem();
загрузитьToolStripMenuItem=new ToolStripMenuItem();
groupBoxCollection.SuspendLayout();
setsBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
//
// groupBoxCollection
//
groupBoxCollection.Controls.Add(buttonSortByColor);
groupBoxCollection.Controls.Add(buttonSortByType);
groupBoxCollection.Controls.Add(setsBox);
groupBoxCollection.Controls.Add(maskedTextBox);
groupBoxCollection.Controls.Add(buttonUpdateCollection);
groupBoxCollection.Controls.Add(buttonDeleteCat);
groupBoxCollection.Controls.Add(buttonAddCat);
groupBoxCollection.Location=new Point(889, 39);
groupBoxCollection.Name="groupBoxCollection";
groupBoxCollection.Size=new Size(242, 648);
groupBoxCollection.TabIndex=0;
groupBoxCollection.TabStop=false;
groupBoxCollection.Text="Инструменты";
//
// buttonSortByColor
//
buttonSortByColor.Location=new Point(21, 410);
buttonSortByColor.Name="buttonSortByColor";
buttonSortByColor.Size=new Size(204, 34);
buttonSortByColor.TabIndex=5;
buttonSortByColor.Text="Сортировать по цвету";
buttonSortByColor.UseVisualStyleBackColor=true;
buttonSortByColor.Click+=ButtonSortByColor_Click;
//
// buttonSortByType
//
buttonSortByType.Location=new Point(21, 361);
buttonSortByType.Name="buttonSortByType";
buttonSortByType.Size=new Size(204, 34);
buttonSortByType.TabIndex=4;
buttonSortByType.Text="Сортировать по типу";
buttonSortByType.UseVisualStyleBackColor=true;
buttonSortByType.Click+=ButtonSortByType_Click;
//
// setsBox
//
setsBox.Controls.Add(DeleteSetButton);
setsBox.Controls.Add(SetslistBox);
setsBox.Controls.Add(setAddBox);
setsBox.Controls.Add(AddSetButton);
setsBox.Location=new Point(6, 30);
setsBox.Name="setsBox";
setsBox.RightToLeft=RightToLeft.No;
setsBox.Size=new Size(219, 305);
setsBox.TabIndex=3;
setsBox.TabStop=false;
setsBox.Text="Наборы";
//
// DeleteSetButton
//
DeleteSetButton.Location=new Point(15, 253);
DeleteSetButton.Name="DeleteSetButton";
DeleteSetButton.Size=new Size(190, 36);
DeleteSetButton.TabIndex=3;
DeleteSetButton.Text="Удалить набор";
DeleteSetButton.UseVisualStyleBackColor=true;
DeleteSetButton.Click+=ButtonDeleteStorage_Click;
//
// SetslistBox
//
SetslistBox.FormattingEnabled=true;
SetslistBox.ItemHeight=25;
SetslistBox.Location=new Point(15, 127);
SetslistBox.Name="SetslistBox";
SetslistBox.Size=new Size(190, 104);
SetslistBox.TabIndex=2;
SetslistBox.SelectedIndexChanged+=ListBoxObjects_SelectedIndexChanged;
//
// setAddBox
//
setAddBox.Location=new Point(15, 30);
setAddBox.Name="setAddBox";
setAddBox.Size=new Size(190, 31);
setAddBox.TabIndex=1;
//
// AddSetButton
//
AddSetButton.Location=new Point(15, 67);
AddSetButton.Name="AddSetButton";
AddSetButton.Size=new Size(190, 40);
AddSetButton.TabIndex=0;
AddSetButton.Text="Добавить набор";
AddSetButton.UseVisualStyleBackColor=true;
AddSetButton.Click+=ButtonAddStorage_Click;
//
// maskedTextBox
//
maskedTextBox.Location=new Point(21, 525);
maskedTextBox.Name="maskedTextBox";
maskedTextBox.Size=new Size(204, 31);
maskedTextBox.TabIndex=2;
//
// buttonUpdateCollection
//
buttonUpdateCollection.Location=new Point(21, 606);
buttonUpdateCollection.Name="buttonUpdateCollection";
buttonUpdateCollection.Size=new Size(204, 39);
buttonUpdateCollection.TabIndex=2;
buttonUpdateCollection.Text="Обновить коллекцию";
buttonUpdateCollection.UseVisualStyleBackColor=true;
buttonUpdateCollection.Click+=ButtonRefreshCollection_Click;
//
// buttonDeleteCat
//
buttonDeleteCat.Location=new Point(21, 562);
buttonDeleteCat.Name="buttonDeleteCat";
buttonDeleteCat.Size=new Size(204, 38);
buttonDeleteCat.TabIndex=1;
buttonDeleteCat.Text="Удалить катамаран";
buttonDeleteCat.UseVisualStyleBackColor=true;
buttonDeleteCat.Click+=ButtonRemoveCatamaran_Click;
//
// buttonAddCat
//
buttonAddCat.Location=new Point(21, 481);
buttonAddCat.Name="buttonAddCat";
buttonAddCat.Size=new Size(204, 38);
buttonAddCat.TabIndex=0;
buttonAddCat.Text="Добавить катамаран";
buttonAddCat.UseVisualStyleBackColor=true;
buttonAddCat.Click+=ButtonAddCatamaran_Click;
//
// pictureBoxCollection
//
pictureBoxCollection.Location=new Point(0, 39);
pictureBoxCollection.Name="pictureBoxCollection";
pictureBoxCollection.Size=new Size(883, 648);
pictureBoxCollection.TabIndex=1;
pictureBoxCollection.TabStop=false;
//
// содержимоеToolStripMenuItem1
//
содержимоеToolStripMenuItem1.Name="содержимоеToolStripMenuItem1";
содержимоеToolStripMenuItem1.Size=new Size(32, 19);
содержимоеToolStripMenuItem1.Text="&Содержимое";
//
// индексToolStripMenuItem1
//
индексToolStripMenuItem1.Name="индексToolStripMenuItem1";
индексToolStripMenuItem1.Size=new Size(32, 19);
индексToolStripMenuItem1.Text="&Индекс";
//
// поискToolStripMenuItem1
//
поискToolStripMenuItem1.Name="поискToolStripMenuItem1";
поискToolStripMenuItem1.Size=new Size(32, 19);
поискToolStripMenuItem1.Text="&Поиск";
//
// toolStripSeparator11
//
toolStripSeparator11.Name="toolStripSeparator11";
toolStripSeparator11.Size=new Size(6, 6);
//
// опрограммеToolStripMenuItem1
//
опрограммеToolStripMenuItem1.Name="опрограммеToolStripMenuItem1";
опрограммеToolStripMenuItem1.Size=new Size(32, 19);
опрограммеToolStripMenuItem1.Text="&О программе…";
//
// настройкиToolStripMenuItem1
//
настройкиToolStripMenuItem1.Name=астройкиToolStripMenuItem1";
настройкиToolStripMenuItem1.Size=new Size(32, 19);
настройкиToolStripMenuItem1.Text="&Настройки";
//
// параметрыToolStripMenuItem1
//
параметрыToolStripMenuItem1.Name="параметрыToolStripMenuItem1";
параметрыToolStripMenuItem1.Size=new Size(32, 19);
параметрыToolStripMenuItem1.Text="&Параметры";
//
// отменитьToolStripMenuItem1
//
отменитьToolStripMenuItem1.Name="отменитьToolStripMenuItem1";
отменитьToolStripMenuItem1.Size=new Size(32, 19);
отменитьToolStripMenuItem1.Text="&Отменить";
//
// повторитьToolStripMenuItem1
//
повторитьToolStripMenuItem1.Name="повторитьToolStripMenuItem1";
повторитьToolStripMenuItem1.Size=new Size(32, 19);
повторитьToolStripMenuItem1.Text="&Повторить";
//
// toolStripSeparator9
//
toolStripSeparator9.Name="toolStripSeparator9";
toolStripSeparator9.Size=new Size(6, 6);
//
// вырезатьToolStripMenuItem1
//
вырезатьToolStripMenuItem1.Image=(Image)resources.GetObject("вырезатьToolStripMenuItem1.Image");
вырезатьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
вырезатьToolStripMenuItem1.Name="вырезатьToolStripMenuItem1";
вырезатьToolStripMenuItem1.Size=new Size(32, 19);
вырезатьToolStripMenuItem1.Text="В&ырезать";
//
// копироватьToolStripMenuItem1
//
копироватьToolStripMenuItem1.Image=(Image)resources.GetObject(опироватьToolStripMenuItem1.Image");
копироватьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
копироватьToolStripMenuItem1.Name=опироватьToolStripMenuItem1";
копироватьToolStripMenuItem1.Size=new Size(32, 19);
копироватьToolStripMenuItem1.Text="&Копировать";
//
// вставитьToolStripMenuItem1
//
вставитьToolStripMenuItem1.Image=(Image)resources.GetObject(ставитьToolStripMenuItem1.Image");
вставитьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
вставитьToolStripMenuItem1.Name=ставитьToolStripMenuItem1";
вставитьToolStripMenuItem1.Size=new Size(32, 19);
вставитьToolStripMenuItem1.Text="&Вставить";
//
// toolStripSeparator10
//
toolStripSeparator10.Name="toolStripSeparator10";
toolStripSeparator10.Size=new Size(6, 6);
//
// выбратьвсеToolStripMenuItem1
//
выбратьвсеToolStripMenuItem1.Name="выбратьвсеToolStripMenuItem1";
выбратьвсеToolStripMenuItem1.Size=new Size(32, 19);
выбратьвсеToolStripMenuItem1.Text="Выбрать &все";
//
// создатьToolStripMenuItem1
//
создатьToolStripMenuItem1.Image=(Image)resources.GetObject("создатьToolStripMenuItem1.Image");
создатьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
создатьToolStripMenuItem1.Name="создатьToolStripMenuItem1";
создатьToolStripMenuItem1.Size=new Size(32, 19);
создатьToolStripMenuItem1.Text="&Создать";
//
// открытьToolStripMenuItem1
//
открытьToolStripMenuItem1.Image=(Image)resources.GetObject("открытьToolStripMenuItem1.Image");
открытьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
открытьToolStripMenuItem1.Name="открытьToolStripMenuItem1";
открытьToolStripMenuItem1.Size=new Size(32, 19);
открытьToolStripMenuItem1.Text="&Открыть";
//
// toolStripSeparator6
//
toolStripSeparator6.Name="toolStripSeparator6";
toolStripSeparator6.Size=new Size(6, 6);
//
// сохранитьToolStripMenuItem1
//
сохранитьToolStripMenuItem1.Image=(Image)resources.GetObject("сохранитьToolStripMenuItem1.Image");
сохранитьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
сохранитьToolStripMenuItem1.Name="сохранитьToolStripMenuItem1";
сохранитьToolStripMenuItem1.Size=new Size(32, 19);
сохранитьToolStripMenuItem1.Text="&Сохранить";
//
// сохранитькакToolStripMenuItem1
//
сохранитькакToolStripMenuItem1.Name="сохранитькакToolStripMenuItem1";
сохранитькакToolStripMenuItem1.Size=new Size(32, 19);
сохранитькакToolStripMenuItem1.Text="Сохранить &как";
//
// toolStripSeparator7
//
toolStripSeparator7.Name="toolStripSeparator7";
toolStripSeparator7.Size=new Size(6, 6);
//
// печатьToolStripMenuItem1
//
печатьToolStripMenuItem1.Image=(Image)resources.GetObject("печатьToolStripMenuItem1.Image");
печатьToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
печатьToolStripMenuItem1.Name="печатьToolStripMenuItem1";
печатьToolStripMenuItem1.Size=new Size(32, 19);
печатьToolStripMenuItem1.Text="&Печать";
//
// предварительныйпросмотрToolStripMenuItem1
//
предварительныйпросмотрToolStripMenuItem1.Image=(Image)resources.GetObject("предварительныйпросмотрToolStripMenuItem1.Image");
предварительныйпросмотрToolStripMenuItem1.ImageTransparentColor=Color.Magenta;
предварительныйпросмотрToolStripMenuItem1.Name="предварительныйпросмотрToolStripMenuItem1";
предварительныйпросмотрToolStripMenuItem1.Size=new Size(32, 19);
предварительныйпросмотрToolStripMenuItem1.Text="Предварительный про&смотр";
//
// toolStripSeparator8
//
toolStripSeparator8.Name="toolStripSeparator8";
toolStripSeparator8.Size=new Size(6, 6);
//
// выходToolStripMenuItem1
//
выходToolStripMenuItem1.Name="выходToolStripMenuItem1";
выходToolStripMenuItem1.Size=new Size(32, 19);
выходToolStripMenuItem1.Text="Вы&ход";
//
// содержимоеToolStripMenuItem
//
содержимоеToolStripMenuItem.Name="содержимоеToolStripMenuItem";
содержимоеToolStripMenuItem.Size=new Size(32, 19);
содержимоеToolStripMenuItem.Text="&Содержимое";
//
// индексToolStripMenuItem
//
индексToolStripMenuItem.Name="индексToolStripMenuItem";
индексToolStripMenuItem.Size=new Size(32, 19);
индексToolStripMenuItem.Text="&Индекс";
//
// поискToolStripMenuItem
//
поискToolStripMenuItem.Name="поискToolStripMenuItem";
поискToolStripMenuItem.Size=new Size(32, 19);
поискToolStripMenuItem.Text="&Поиск";
//
// toolStripSeparator5
//
toolStripSeparator5.Name="toolStripSeparator5";
toolStripSeparator5.Size=new Size(6, 6);
//
// опрограммеToolStripMenuItem
//
опрограммеToolStripMenuItem.Name="опрограммеToolStripMenuItem";
опрограммеToolStripMenuItem.Size=new Size(32, 19);
опрограммеToolStripMenuItem.Text="&О программе…";
//
// настройкиToolStripMenuItem
//
настройкиToolStripMenuItem.Name=астройкиToolStripMenuItem";
настройкиToolStripMenuItem.Size=new Size(32, 19);
настройкиToolStripMenuItem.Text="&Настройки";
//
// параметрыToolStripMenuItem
//
параметрыToolStripMenuItem.Name="параметрыToolStripMenuItem";
параметрыToolStripMenuItem.Size=new Size(32, 19);
параметрыToolStripMenuItem.Text="&Параметры";
//
// отменитьToolStripMenuItem
//
отменитьToolStripMenuItem.Name="отменитьToolStripMenuItem";
отменитьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.Z;
отменитьToolStripMenuItem.Size=new Size(32, 19);
отменитьToolStripMenuItem.Text="&Отменить";
//
// повторитьToolStripMenuItem
//
повторитьToolStripMenuItem.Name="повторитьToolStripMenuItem";
повторитьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.Y;
повторитьToolStripMenuItem.Size=new Size(32, 19);
повторитьToolStripMenuItem.Text="&Повторить";
//
// toolStripSeparator3
//
toolStripSeparator3.Name="toolStripSeparator3";
toolStripSeparator3.Size=new Size(6, 6);
//
// вырезатьToolStripMenuItem
//
вырезатьToolStripMenuItem.Image=(Image)resources.GetObject("вырезатьToolStripMenuItem.Image");
вырезатьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
вырезатьToolStripMenuItem.Name="вырезатьToolStripMenuItem";
вырезатьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.X;
вырезатьToolStripMenuItem.Size=new Size(32, 19);
вырезатьToolStripMenuItem.Text="В&ырезать";
//
// копироватьToolStripMenuItem
//
копироватьToolStripMenuItem.Image=(Image)resources.GetObject(опироватьToolStripMenuItem.Image");
копироватьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
копироватьToolStripMenuItem.Name=опироватьToolStripMenuItem";
копироватьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.C;
копироватьToolStripMenuItem.Size=new Size(32, 19);
копироватьToolStripMenuItem.Text="&Копировать";
//
// вставитьToolStripMenuItem
//
вставитьToolStripMenuItem.Image=(Image)resources.GetObject(ставитьToolStripMenuItem.Image");
вставитьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
вставитьToolStripMenuItem.Name=ставитьToolStripMenuItem";
вставитьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.V;
вставитьToolStripMenuItem.Size=new Size(32, 19);
вставитьToolStripMenuItem.Text="&Вставить";
//
// toolStripSeparator4
//
toolStripSeparator4.Name="toolStripSeparator4";
toolStripSeparator4.Size=new Size(6, 6);
//
// выбратьвсеToolStripMenuItem
//
выбратьвсеToolStripMenuItem.Name="выбратьвсеToolStripMenuItem";
выбратьвсеToolStripMenuItem.Size=new Size(32, 19);
выбратьвсеToolStripMenuItem.Text="Выбрать &все";
//
// создатьToolStripMenuItem
//
создатьToolStripMenuItem.Image=(Image)resources.GetObject("создатьToolStripMenuItem.Image");
создатьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
создатьToolStripMenuItem.Name="создатьToolStripMenuItem";
создатьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.N;
создатьToolStripMenuItem.Size=new Size(32, 19);
создатьToolStripMenuItem.Text="&Создать";
//
// открытьToolStripMenuItem
//
открытьToolStripMenuItem.Image=(Image)resources.GetObject("открытьToolStripMenuItem.Image");
открытьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
открытьToolStripMenuItem.Name="открытьToolStripMenuItem";
открытьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.O;
открытьToolStripMenuItem.Size=new Size(32, 19);
открытьToolStripMenuItem.Text="&Открыть";
//
// toolStripSeparator
//
toolStripSeparator.Name="toolStripSeparator";
toolStripSeparator.Size=new Size(6, 6);
//
// сохранитьToolStripMenuItem
//
сохранитьToolStripMenuItem.Image=(Image)resources.GetObject("сохранитьToolStripMenuItem.Image");
сохранитьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
сохранитьToolStripMenuItem.Name="сохранитьToolStripMenuItem";
сохранитьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.S;
сохранитьToolStripMenuItem.Size=new Size(32, 19);
сохранитьToolStripMenuItem.Text="&Сохранить";
//
// сохранитькакToolStripMenuItem
//
сохранитькакToolStripMenuItem.Name="сохранитькакToolStripMenuItem";
сохранитькакToolStripMenuItem.Size=new Size(32, 19);
сохранитькакToolStripMenuItem.Text="Сохранить &как";
//
// toolStripSeparator1
//
toolStripSeparator1.Name="toolStripSeparator1";
toolStripSeparator1.Size=new Size(6, 6);
//
// печатьToolStripMenuItem
//
печатьToolStripMenuItem.Image=(Image)resources.GetObject("печатьToolStripMenuItem.Image");
печатьToolStripMenuItem.ImageTransparentColor=Color.Magenta;
печатьToolStripMenuItem.Name="печатьToolStripMenuItem";
печатьToolStripMenuItem.ShortcutKeys=Keys.Control|Keys.P;
печатьToolStripMenuItem.Size=new Size(32, 19);
печатьToolStripMenuItem.Text="&Печать";
//
// предварительныйпросмотрToolStripMenuItem
//
предварительныйпросмотрToolStripMenuItem.Image=(Image)resources.GetObject("предварительныйпросмотрToolStripMenuItem.Image");
предварительныйпросмотрToolStripMenuItem.ImageTransparentColor=Color.Magenta;
предварительныйпросмотрToolStripMenuItem.Name="предварительныйпросмотрToolStripMenuItem";
предварительныйпросмотрToolStripMenuItem.Size=new Size(32, 19);
предварительныйпросмотрToolStripMenuItem.Text="Предварительный про&смотр";
//
// toolStripSeparator2
//
toolStripSeparator2.Name="toolStripSeparator2";
toolStripSeparator2.Size=new Size(6, 6);
//
// выходToolStripMenuItem
//
выходToolStripMenuItem.Name="выходToolStripMenuItem";
выходToolStripMenuItem.Size=new Size(32, 19);
выходToolStripMenuItem.Text="Вы&ход";
//
// openFileDialog
//
openFileDialog.Filter="txt file | *.txt";
//
// saveFileDialog
//
saveFileDialog.Filter="txt file | *.txt";
//
// menuStrip
//
menuStrip.ImageScalingSize=new Size(24, 24);
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
menuStrip.Location=new Point(0, 0);
menuStrip.Name="menuStrip";
menuStrip.Size=new Size(1143, 33);
menuStrip.TabIndex=2;
menuStrip.Text="menuStrip";
//
// файлToolStripMenuItem
//
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { сохранитьToolStripMenuItem2, загрузитьToolStripMenuItem });
файлToolStripMenuItem.Name=айлToolStripMenuItem";
файлToolStripMenuItem.Size=new Size(69, 29);
файлToolStripMenuItem.Text="Файл";
//
// сохранитьToolStripMenuItem2
//
сохранитьToolStripMenuItem2.Name="сохранитьToolStripMenuItem2";
сохранитьToolStripMenuItem2.Size=new Size(197, 34);
сохранитьToolStripMenuItem2.Text="сохранить";
сохранитьToolStripMenuItem2.Click+=SaveToolStripMenuItem_Click;
//
// загрузитьToolStripMenuItem
//
загрузитьToolStripMenuItem.Name=агрузитьToolStripMenuItem";
загрузитьToolStripMenuItem.Size=new Size(197, 34);
загрузитьToolStripMenuItem.Text="загрузить";
загрузитьToolStripMenuItem.Click+=LoadToolStripMenuItem_Click;
//
// FormCatamaranCollection
//
AutoScaleDimensions=new SizeF(10F, 25F);
AutoScaleMode=AutoScaleMode.Font;
ClientSize=new Size(1143, 693);
Controls.Add(pictureBoxCollection);
Controls.Add(groupBoxCollection);
Controls.Add(menuStrip);
Name="FormCatamaranCollection";
Text="FormCatamaranCollection";
groupBoxCollection.ResumeLayout(false);
groupBoxCollection.PerformLayout();
setsBox.ResumeLayout(false);
setsBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private GroupBox groupBoxCollection;
private Button buttonAddCat;
private Button buttonUpdateCollection;
private Button buttonDeleteCat;
private MaskedTextBox maskedTextBox;
public PictureBox pictureBoxCollection;
private GroupBox setsBox;
private Button DeleteSetButton;
private ListBox SetslistBox;
private TextBox setAddBox;
private Button AddSetButton;
private ToolStripMenuItem содержимоеToolStripMenuItem1;
private ToolStripMenuItem индексToolStripMenuItem1;
private ToolStripMenuItem поискToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator11;
private ToolStripMenuItem опрограммеToolStripMenuItem1;
private ToolStripMenuItem настройкиToolStripMenuItem1;
private ToolStripMenuItem параметрыToolStripMenuItem1;
private ToolStripMenuItem отменитьToolStripMenuItem1;
private ToolStripMenuItem повторитьToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator9;
private ToolStripMenuItem вырезатьToolStripMenuItem1;
private ToolStripMenuItem копироватьToolStripMenuItem1;
private ToolStripMenuItem вставитьToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator10;
private ToolStripMenuItem выбратьвсеToolStripMenuItem1;
private ToolStripMenuItem создатьToolStripMenuItem1;
private ToolStripMenuItem открытьToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator6;
private ToolStripMenuItem сохранитьToolStripMenuItem1;
private ToolStripMenuItem сохранитькакToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator7;
private ToolStripMenuItem печатьToolStripMenuItem1;
private ToolStripMenuItem предварительныйпросмотрToolStripMenuItem1;
private ToolStripSeparator toolStripSeparator8;
private ToolStripMenuItem выходToolStripMenuItem1;
private ToolStripMenuItem содержимоеToolStripMenuItem;
private ToolStripMenuItem индексToolStripMenuItem;
private ToolStripMenuItem поискToolStripMenuItem;
private ToolStripSeparator toolStripSeparator5;
private ToolStripMenuItem опрограммеToolStripMenuItem;
private ToolStripMenuItem настройкиToolStripMenuItem;
private ToolStripMenuItem параметрыToolStripMenuItem;
private ToolStripMenuItem отменитьToolStripMenuItem;
private ToolStripMenuItem повторитьToolStripMenuItem;
private ToolStripSeparator toolStripSeparator3;
private ToolStripMenuItem вырезатьToolStripMenuItem;
private ToolStripMenuItem копироватьToolStripMenuItem;
private ToolStripMenuItem вставитьToolStripMenuItem;
private ToolStripSeparator toolStripSeparator4;
private ToolStripMenuItem выбратьвсеToolStripMenuItem;
private ToolStripMenuItem создатьToolStripMenuItem;
private ToolStripMenuItem открытьToolStripMenuItem;
private ToolStripSeparator toolStripSeparator;
private ToolStripMenuItem сохранитьToolStripMenuItem;
private ToolStripMenuItem сохранитькакToolStripMenuItem;
private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem печатьToolStripMenuItem;
private ToolStripMenuItem предварительныйпросмотрToolStripMenuItem;
private ToolStripSeparator toolStripSeparator2;
private ToolStripMenuItem выходToolStripMenuItem;
private OpenFileDialog openFileDialog;
private SaveFileDialog saveFileDialog;
private MenuStrip menuStrip;
private ToolStripMenuItem файлToolStripMenuItem;
private ToolStripMenuItem сохранитьToolStripMenuItem2;
private ToolStripMenuItem загрузитьToolStripMenuItem;
private Button buttonSortByType;
private Button buttonSortByColor;
}
}

View File

@ -0,0 +1,234 @@
using Microsoft.Extensions.Logging;
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 Serilog;
namespace Catamaran
{
public partial class FormCatamaranCollection : Form
{
private readonly CatamaransGenericStorage _storage;
public FormCatamaranCollection()
{
InitializeComponent();
_storage = new CatamaransGenericStorage(pictureBoxCollection.Width,
pictureBoxCollection.Height);
}
private void ReloadObjects()
{
int index = SetslistBox.SelectedIndex;
SetslistBox.Items.Clear();
for (int i = 0; i < _storage.Keys.Count; i++)
{
SetslistBox.Items.Add(_storage.Keys[i].Name);
}
if (SetslistBox.Items.Count > 0 && (index == -1 || index
>= SetslistBox.Items.Count))
{
SetslistBox.SelectedIndex = 0;
}
else if (SetslistBox.Items.Count > 0 && index > -1 &&
index < SetslistBox.Items.Count)
{
SetslistBox.SelectedIndex = index;
}
}
private void ButtonAddStorage_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(setAddBox.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_storage.AddSet(setAddBox.Text);
ReloadObjects();
Log.Information($"Добавлен набор: {setAddBox.Text}");
}
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBoxCollection.Image =
_storage[SetslistBox.SelectedItem?.ToString() ?? string.Empty]?.ShowCats();
}
private void ButtonDeleteStorage_Click(object sender, EventArgs e)
{
if (SetslistBox.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить набор {SetslistBox.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string name = SetslistBox.SelectedItem.ToString()
?? string.Empty;
_storage.DelSet(name);
ReloadObjects();
Log.Information($"Удален набор: {name}");
}
}
private void ButtonAddCatamaran_Click(object sender, EventArgs e)
{
if (SetslistBox.SelectedIndex == -1)
{
return;
}
var obj = _storage[SetslistBox.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
FormCatamaranConfig form = new();
form.Show();
Action<DrawningCatamaran>? catamaranDelegate = new((c) =>
{
try
{
bool q = obj + c;
MessageBox.Show("Объект добавлен");
Log.Information($"Добавлен объект в коллекцию {SetslistBox.SelectedItem.ToString() ?? string.Empty}");
c.ChangePictureBoxSize(pictureBoxCollection.Width, pictureBoxCollection.Height);
pictureBoxCollection.Image = obj.ShowCats();
}
catch (StorageOverflowException ex)
{
Log.Warning($"Коллекция {SetslistBox.SelectedItem.ToString() ?? string.Empty} переполнена");
MessageBox.Show(ex.Message);
}
catch (ArgumentException)
{
Log.Warning($"Добавляемый объект уже существует в коллекции {SetslistBox.SelectedItem.ToString() ?? string.Empty}");
MessageBox.Show("Добавляемый объект уже сущесвует в коллекции");
}
});
form.AddEvent(catamaranDelegate);
}
private void ButtonRemoveCatamaran_Click(object sender, EventArgs e)
{
if (SetslistBox.SelectedIndex == -1)
{
return;
}
var obj = _storage[SetslistBox.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
try
{
int pos = Convert.ToInt32(maskedTextBox.Text);
var q = obj - pos;
MessageBox.Show("Объект удален");
Log.Information($"Удален объект из коллекции {SetslistBox.SelectedItem.ToString() ?? string.Empty} по номеру {pos}");
pictureBoxCollection.Image = obj.ShowCats();
}
catch (CatamaranNotFoundException ex)
{
Log.Warning($"Не получилось удалить объект из коллекции {SetslistBox.SelectedItem.ToString() ?? string.Empty}");
MessageBox.Show(ex.Message);
}
catch (FormatException)
{
Log.Warning($"Было введено не число");
MessageBox.Show("Введите число");
}
}
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
{
if (SetslistBox.SelectedIndex == -1)
{
return;
}
var obj = _storage[SetslistBox.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
pictureBoxCollection.Image = obj.ShowCats();
}
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
_storage.SaveData(saveFileDialog.FileName);
MessageBox.Show("Сохранение прошло успешно",
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
Log.Information($"Файл {saveFileDialog.FileName} успешно сохранен");
}
catch (Exception ex)
{
Log.Warning("Не удалось сохранить");
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
_storage.LoadData(openFileDialog.FileName);
MessageBox.Show("Загрузка прошла успешно",
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
Log.Information($"Файл {openFileDialog.FileName} успешно загружен");
foreach (var collection in _storage.Keys)
{
SetslistBox.Items.Add(collection);
}
ReloadObjects();
}
catch (Exception ex)
{
Log.Warning("Не удалось загрузить");
MessageBox.Show($"Не загрузилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ButtonSortByType_Click(object sender, EventArgs e) => CompareCatamarans(new CatamaranCompareByType());
private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareCatamarans(new CatamaranCompareByColor());
private void CompareCatamarans(IComparer<DrawningCatamaran?> comparer)
{
if (SetslistBox.SelectedIndex == -1)
{
return;
}
var obj = _storage[SetslistBox.SelectedItem.ToString() ??
string.Empty];
if (obj == null)
{
return;
}
obj.Sort(comparer);
pictureBoxCollection.Image = obj.ShowCats();
}
}
}

View File

@ -0,0 +1,282 @@
<?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.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="вырезатьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN
z0LrCKU0nQt6UodIOIifkuy3zKAlWORJI3bnvZk3s7bnouu6l2EY7kTTNE+S9jhrHo2ktzDkRxzHU5Zl
U9/3qaQ9zuTg0Eh6C+Mw+b4/hWE46RTqTg4Ojci3aNv2M4oiK9Qp1J0cHBqRb4E4z/PVFK57URSr1R4C
B3bVKdSd3K67wji8lmW5TKHu5OBEtg8z9u1wONhCIkkS1rkJ/T94aUa+XgsbQRDsvz4wgjMiDYoul3fb
gClczsRZymaQYEeKEOvXDZdDu2pCV4j4LZ7qr2/7eyOu69oGZ5dDS42Uzw1sgRHcmx/75V5VlRU+4mg8
juPz0oCux+PJCtI0XVz2OFsMzGXzBrrnHiflM0S8uLp/2b8c95nxvF92DupZ7oH5WgAAAABJRU5ErkJg
gg==
</value>
</data>
<data name="копироватьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq
oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk
iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII=
</value>
</data>
<data name="вставитьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof
/MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy
yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY
J5nBJhUlLbsqAAAAAElFTkSuQmCC
</value>
</data>
<data name="создатьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb
NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P
wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg==
</value>
</data>
<data name="открытьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAFUSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22mqj
paVlxCKCoBaClUQLESNRC4OE4EKQrAbcYBKy62Z/ynHOzUwcMzuyDhzYGc795tw7y2ZXFEVLSZI8p2la
kkf5lywO1vZr/MH54LkhwlgQKsZxvC4AfHHjjM+tHOaDiKIKiqDqk0s6rbUJoCDCsy3t5kJh+bJFZrZ8
YGhh9ZjgSIeUUgVZPgHot2HfGwbTNu4aTf75UuW+50wVhSMAKwRwugO6aevokYohfQbDzj1/vdj8pffb
PfJREpUAEPSOvXoFBdSFBIDgmxIgTr3lEkRPYZMOwDwYDtzrXToATPVp06B9QwB8o4YAipjVr02dqx0T
gOHMGm3qNc8nL6EAX33XMP2l8cj7mQEOvMaJYbKpWy/zMAzf6BVE9ADF6CnLnCXMCn8mAUSMEiCYwX/k
+/48Y4x9AwxhsnXBwZZBAAAAAElFTkSuQmCC
</value>
</data>
<data name="сохранитьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD
9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI
hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC
</value>
</data>
<data name="печатьToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt
098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7
2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C
YII=
</value>
</data>
<data name="предварительныйпросмотрToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT
BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5
WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B
7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR
9AE47sSEPD2a+wAAAABJRU5ErkJggg==
</value>
</data>
<data name="вырезатьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN
z0LrCKU0nQt6UodIOIifkuy3zKAlWORJI3bnvZk3s7bnouu6l2EY7kTTNE+S9jhrHo2ktzDkRxzHU5Zl
U9/3qaQ9zuTg0Eh6C+Mw+b4/hWE46RTqTg4Ojci3aNv2M4oiK9Qp1J0cHBqRb4E4z/PVFK57URSr1R4C
B3bVKdSd3K67wji8lmW5TKHu5OBEtg8z9u1wONhCIkkS1rkJ/T94aUa+XgsbQRDsvz4wgjMiDYoul3fb
gClczsRZymaQYEeKEOvXDZdDu2pCV4j4LZ7qr2/7eyOu69oGZ5dDS42Uzw1sgRHcmx/75V5VlRU+4mg8
juPz0oCux+PJCtI0XVz2OFsMzGXzBrrnHiflM0S8uLp/2b8c95nxvF92DupZ7oH5WgAAAABJRU5ErkJg
gg==
</value>
</data>
<data name="копироватьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq
oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk
iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII=
</value>
</data>
<data name="вставитьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof
/MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy
yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY
J5nBJhUlLbsqAAAAAElFTkSuQmCC
</value>
</data>
<data name="создатьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb
NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P
wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg==
</value>
</data>
<data name="открытьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAFUSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22mqj
paVlxCKCoBaClUQLESNRC4OE4EKQrAbcYBKy62Z/ynHOzUwcMzuyDhzYGc795tw7y2ZXFEVLSZI8p2la
kkf5lywO1vZr/MH54LkhwlgQKsZxvC4AfHHjjM+tHOaDiKIKiqDqk0s6rbUJoCDCsy3t5kJh+bJFZrZ8
YGhh9ZjgSIeUUgVZPgHot2HfGwbTNu4aTf75UuW+50wVhSMAKwRwugO6aevokYohfQbDzj1/vdj8pffb
PfJREpUAEPSOvXoFBdSFBIDgmxIgTr3lEkRPYZMOwDwYDtzrXToATPVp06B9QwB8o4YAipjVr02dqx0T
gOHMGm3qNc8nL6EAX33XMP2l8cj7mQEOvMaJYbKpWy/zMAzf6BVE9ADF6CnLnCXMCn8mAUSMEiCYwX/k
+/48Y4x9AwxhsnXBwZZBAAAAAElFTkSuQmCC
</value>
</data>
<data name="сохранитьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD
9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI
hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC
</value>
</data>
<data name="печатьToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt
098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7
2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C
YII=
</value>
</data>
<data name="предварительныйпросмотрToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT
BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5
WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B
7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR
9AE47sSEPD2a+wAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>165, 17</value>
</metadata>
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>361, 17</value>
</metadata>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>548, 35</value>
</metadata>
</root>

356
Catamaran/FormCatamaranConfig.Designer.cs generated Normal file
View File

@ -0,0 +1,356 @@
namespace Catamaran
{
partial class FormCatamaranConfig
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
groupBoxParam=new GroupBox();
ColorBox=new GroupBox();
panelOrange=new Panel();
panelBlue=new Panel();
panelGray=new Panel();
panelWhite=new Panel();
panelPurple=new Panel();
panelGreen=new Panel();
panelBlack=new Panel();
panelRed=new Panel();
labelHardObject=new Label();
labelSimpleObject=new Label();
checkBoSail=new CheckBox();
checkBoxMotor=new CheckBox();
checkBoxBodyKit=new CheckBox();
numericUpDownWeight=new NumericUpDown();
numericUpDownSpeed=new NumericUpDown();
LabelWeight=new Label();
LabelSpeed=new Label();
PanelObject=new Panel();
labelAdditionalColor=new Label();
labelColourMain=new Label();
pictureBoxObject=new PictureBox();
buttonAddObject=new Button();
buttonRepeal=new Button();
groupBoxParam.SuspendLayout();
ColorBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
PanelObject.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
SuspendLayout();
//
// groupBoxParam
//
groupBoxParam.Controls.Add(ColorBox);
groupBoxParam.Controls.Add(labelHardObject);
groupBoxParam.Controls.Add(labelSimpleObject);
groupBoxParam.Controls.Add(checkBoSail);
groupBoxParam.Controls.Add(checkBoxMotor);
groupBoxParam.Controls.Add(checkBoxBodyKit);
groupBoxParam.Controls.Add(numericUpDownWeight);
groupBoxParam.Controls.Add(numericUpDownSpeed);
groupBoxParam.Controls.Add(LabelWeight);
groupBoxParam.Controls.Add(LabelSpeed);
groupBoxParam.Location=new Point(12, 12);
groupBoxParam.Name="groupBoxParam";
groupBoxParam.Size=new Size(781, 384);
groupBoxParam.TabIndex=0;
groupBoxParam.TabStop=false;
groupBoxParam.Text="Параметры";
//
// ColorBox
//
ColorBox.Controls.Add(panelOrange);
ColorBox.Controls.Add(panelBlue);
ColorBox.Controls.Add(panelGray);
ColorBox.Controls.Add(panelWhite);
ColorBox.Controls.Add(panelPurple);
ColorBox.Controls.Add(panelGreen);
ColorBox.Controls.Add(panelBlack);
ColorBox.Controls.Add(panelRed);
ColorBox.Location=new Point(302, 30);
ColorBox.Name="ColorBox";
ColorBox.Size=new Size(415, 252);
ColorBox.TabIndex=10;
ColorBox.TabStop=false;
ColorBox.Text="Цвета";
//
// panelOrange
//
panelOrange.BackColor=Color.Orange;
panelOrange.Location=new Point(319, 143);
panelOrange.Name="panelOrange";
panelOrange.Size=new Size(60, 60);
panelOrange.TabIndex=2;
//
// panelBlue
//
panelBlue.BackColor=Color.Blue;
panelBlue.Location=new Point(217, 143);
panelBlue.Name="panelBlue";
panelBlue.Size=new Size(60, 60);
panelBlue.TabIndex=2;
//
// panelGray
//
panelGray.BackColor=Color.Gray;
panelGray.Location=new Point(113, 143);
panelGray.Name="panelGray";
panelGray.Size=new Size(60, 60);
panelGray.TabIndex=2;
//
// panelWhite
//
panelWhite.BackColor=Color.White;
panelWhite.Location=new Point(16, 143);
panelWhite.Name="panelWhite";
panelWhite.Size=new Size(60, 60);
panelWhite.TabIndex=2;
//
// panelPurple
//
panelPurple.BackColor=Color.Purple;
panelPurple.Location=new Point(319, 49);
panelPurple.Name="panelPurple";
panelPurple.Size=new Size(60, 60);
panelPurple.TabIndex=1;
//
// panelGreen
//
panelGreen.BackColor=Color.FromArgb(0, 192, 0);
panelGreen.Location=new Point(217, 49);
panelGreen.Name="panelGreen";
panelGreen.Size=new Size(60, 60);
panelGreen.TabIndex=1;
//
// panelBlack
//
panelBlack.BackColor=Color.Black;
panelBlack.Location=new Point(113, 49);
panelBlack.Name="panelBlack";
panelBlack.Size=new Size(60, 60);
panelBlack.TabIndex=1;
//
// panelRed
//
panelRed.BackColor=Color.Red;
panelRed.Location=new Point(16, 49);
panelRed.Name="panelRed";
panelRed.Size=new Size(60, 60);
panelRed.TabIndex=0;
//
// labelHardObject
//
labelHardObject.AllowDrop=true;
labelHardObject.BackColor=SystemColors.Control;
labelHardObject.BorderStyle=BorderStyle.FixedSingle;
labelHardObject.Location=new Point(567, 293);
labelHardObject.Name="labelHardObject";
labelHardObject.Size=new Size(150, 50);
labelHardObject.TabIndex=9;
labelHardObject.Text="Продвинутый";
labelHardObject.TextAlign=ContentAlignment.MiddleCenter;
//
// labelSimpleObject
//
labelSimpleObject.AllowDrop=true;
labelSimpleObject.BackColor=SystemColors.Control;
labelSimpleObject.BorderStyle=BorderStyle.FixedSingle;
labelSimpleObject.Location=new Point(302, 293);
labelSimpleObject.Name="labelSimpleObject";
labelSimpleObject.Size=new Size(150, 50);
labelSimpleObject.TabIndex=8;
labelSimpleObject.Text="Простой";
labelSimpleObject.TextAlign=ContentAlignment.MiddleCenter;
labelSimpleObject.MouseDown+=LabelObject_MouseDown;
//
// checkBoSail
//
checkBoSail.AutoSize=true;
checkBoSail.Location=new Point(22, 253);
checkBoSail.Name="checkBoSail";
checkBoSail.Size=new Size(241, 29);
checkBoSail.TabIndex=6;
checkBoSail.Text="Признак наличия паруса";
checkBoSail.UseVisualStyleBackColor=true;
//
// checkBoxMotor
//
checkBoxMotor.AutoSize=true;
checkBoxMotor.Location=new Point(22, 204);
checkBoxMotor.Name="checkBoxMotor";
checkBoxMotor.Size=new Size(247, 29);
checkBoxMotor.TabIndex=5;
checkBoxMotor.Text="Признак наличия мотора";
checkBoxMotor.UseVisualStyleBackColor=true;
//
// checkBoxBodyKit
//
checkBoxBodyKit.AutoSize=true;
checkBoxBodyKit.Location=new Point(22, 158);
checkBoxBodyKit.Name="checkBoxBodyKit";
checkBoxBodyKit.Size=new Size(274, 29);
checkBoxBodyKit.TabIndex=4;
checkBoxBodyKit.Text="Признак наличия поплавков";
checkBoxBodyKit.UseVisualStyleBackColor=true;
//
// numericUpDownWeight
//
numericUpDownWeight.Location=new Point(117, 93);
numericUpDownWeight.Name="numericUpDownWeight";
numericUpDownWeight.Size=new Size(87, 31);
numericUpDownWeight.TabIndex=3;
//
// numericUpDownSpeed
//
numericUpDownSpeed.Location=new Point(117, 50);
numericUpDownSpeed.Name="numericUpDownSpeed";
numericUpDownSpeed.Size=new Size(87, 31);
numericUpDownSpeed.TabIndex=2;
//
// LabelWeight
//
LabelWeight.AutoSize=true;
LabelWeight.Location=new Point(22, 95);
LabelWeight.Name="LabelWeight";
LabelWeight.Size=new Size(39, 25);
LabelWeight.TabIndex=1;
LabelWeight.Text="Вес";
//
// LabelSpeed
//
LabelSpeed.AutoSize=true;
LabelSpeed.Location=new Point(22, 50);
LabelSpeed.Name="LabelSpeed";
LabelSpeed.Size=new Size(89, 25);
LabelSpeed.TabIndex=0;
LabelSpeed.Text="Скорость";
//
// PanelObject
//
PanelObject.AllowDrop=true;
PanelObject.Controls.Add(labelAdditionalColor);
PanelObject.Controls.Add(labelColourMain);
PanelObject.Controls.Add(pictureBoxObject);
PanelObject.Location=new Point(799, 12);
PanelObject.Name="PanelObject";
PanelObject.Size=new Size(471, 310);
PanelObject.TabIndex=1;
PanelObject.DragDrop+=PanelObject_DragDrop;
PanelObject.DragEnter+=PanelObject_DragEnter;
//
// labelAdditionalColor
//
labelAdditionalColor.AllowDrop=true;
labelAdditionalColor.BorderStyle=BorderStyle.FixedSingle;
labelAdditionalColor.Location=new Point(257, 18);
labelAdditionalColor.Name="labelAdditionalColor";
labelAdditionalColor.Size=new Size(200, 50);
labelAdditionalColor.TabIndex=2;
labelAdditionalColor.Text="Дополнительный цвет";
labelAdditionalColor.TextAlign=ContentAlignment.MiddleCenter;
labelAdditionalColor.DragDrop+=ColorLabel_DragDrop;
labelAdditionalColor.DragEnter+=ColorLabel_DragEnter;
//
// labelColourMain
//
labelColourMain.AllowDrop=true;
labelColourMain.BorderStyle=BorderStyle.FixedSingle;
labelColourMain.Location=new Point(15, 18);
labelColourMain.Name="labelColourMain";
labelColourMain.Size=new Size(200, 50);
labelColourMain.TabIndex=1;
labelColourMain.Text="Основной цвет";
labelColourMain.TextAlign=ContentAlignment.MiddleCenter;
labelColourMain.DragDrop+=ColorLabel_DragDrop;
labelColourMain.DragEnter+=ColorLabel_DragEnter;
//
// pictureBoxObject
//
pictureBoxObject.Location=new Point(15, 79);
pictureBoxObject.Name="pictureBoxObject";
pictureBoxObject.Size=new Size(442, 212);
pictureBoxObject.TabIndex=0;
pictureBoxObject.TabStop=false;
//
// buttonAddObject
//
buttonAddObject.Location=new Point(814, 346);
buttonAddObject.Name="buttonAddObject";
buttonAddObject.Size=new Size(182, 50);
buttonAddObject.TabIndex=2;
buttonAddObject.Text="Добавить";
buttonAddObject.UseVisualStyleBackColor=true;
buttonAddObject.Click+=ButtonOk_Click;
//
// buttonRepeal
//
buttonRepeal.Location=new Point(1074, 346);
buttonRepeal.Name="buttonRepeal";
buttonRepeal.Size=new Size(182, 50);
buttonRepeal.TabIndex=3;
buttonRepeal.Text="Отмена";
buttonRepeal.UseVisualStyleBackColor=true;
//
// FormCatamaranConfig
//
AutoScaleDimensions=new SizeF(10F, 25F);
AutoScaleMode=AutoScaleMode.Font;
ClientSize=new Size(1281, 420);
Controls.Add(buttonRepeal);
Controls.Add(buttonAddObject);
Controls.Add(PanelObject);
Controls.Add(groupBoxParam);
Name="FormCatamaranConfig";
Text="FormCatamaranConfig";
groupBoxParam.ResumeLayout(false);
groupBoxParam.PerformLayout();
ColorBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
PanelObject.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBoxParam;
private Label LabelSpeed;
private Label LabelWeight;
private CheckBox checkBoSail;
private CheckBox checkBoxMotor;
private CheckBox checkBoxBodyKit;
private NumericUpDown numericUpDownWeight;
private NumericUpDown numericUpDownSpeed;
private Label labelHardObject;
private Label labelSimpleObject;
private Panel PanelObject;
private Label labelColourMain;
private PictureBox pictureBoxObject;
private Label labelAdditionalColor;
private Button buttonAddObject;
private Button buttonRepeal;
private GroupBox ColorBox;
private Panel panelOrange;
private Panel panelBlue;
private Panel panelGray;
private Panel panelWhite;
private Panel panelPurple;
private Panel panelGreen;
private Panel panelBlack;
private Panel panelRed;
}
}

View File

@ -0,0 +1,138 @@
using System;
using System.Collections;
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;
namespace Catamaran
{
public partial class FormCatamaranConfig : Form
{
DrawningCatamaran? _catamaran = null;
private event Action<DrawningCatamaran>? EventAddCatamaran;
public void AddEvent(Action<DrawningCatamaran> ev)
{
if (EventAddCatamaran == null)
{
EventAddCatamaran = ev;
}
else
{
EventAddCatamaran += ev;
}
}
public FormCatamaranConfig()
{
InitializeComponent();
panelBlack.MouseDown += PanelColor_MouseDown;
panelPurple.MouseDown += PanelColor_MouseDown;
panelGray.MouseDown += PanelColor_MouseDown;
panelGreen.MouseDown += PanelColor_MouseDown;
panelRed.MouseDown += PanelColor_MouseDown;
panelWhite.MouseDown += PanelColor_MouseDown;
panelOrange.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown;
labelSimpleObject.MouseDown += LabelObject_MouseDown;
labelHardObject.MouseDown += LabelObject_MouseDown;
buttonRepeal.Click += (s, e) => Close();
}
private void DrawCatamaran()
{
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp);
_catamaran?.SetPosition(5, 5);
_catamaran?.DrawTransport(gr);
pictureBoxObject.Image = bmp;
}
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text).ToString())
{
case "labelSimpleObject":
_catamaran = new DrawningCatamaran((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
pictureBoxObject.Height);
break;
case "labelHardObject":
_catamaran = new DrawningCatamaranPro((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBodyKit.Checked,
checkBoxMotor.Checked, checkBoSail.Checked, pictureBoxObject.Width,
pictureBoxObject.Height);
break;
}
DrawCatamaran();
}
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void ButtonOk_Click(object sender, EventArgs e)
{
EventAddCatamaran?.Invoke(_catamaran);
Close();
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
DragDropEffects.Move | DragDropEffects.Copy);
}
private void ColorLabel_DragDrop(object sender, DragEventArgs e)
{
string senderName = ((Label)sender).Name;
if (_catamaran == null || e.Data.GetDataPresent(typeof(Color)) == false)
return;
Color droppedColor = (Color)e.Data.GetData(typeof(Color));
if (senderName == "labelColourMain")
{
labelColourMain.BackColor = droppedColor;
((DrawningCatamaran)_catamaran).ChangeColor(labelColourMain.BackColor);
}
else if (senderName == "labelAdditionalColor" && _catamaran is DrawningCatamaran)
{
labelAdditionalColor.BackColor = droppedColor;
((DrawningCatamaranPro)_catamaran).ChangeAddColor(labelAdditionalColor.BackColor);
}
DrawCatamaran();
}
private void ColorLabel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,20 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public interface IMoveableObject
{
ObjectParameters? GetObjectPosition { get; }
int GetStep { get; }
bool CheckCanMove(DirectionType direction);
void MoveObject(DirectionType direction);
}
}

56
Catamaran/MoveToCenter.cs Normal file
View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
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();
}
}
}
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class MoveToRightBorder : 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();
}
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
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;
}
}
}

23
Catamaran/Program.cs Normal file
View File

@ -0,0 +1,23 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Serilog;
namespace Catamaran
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Log.Logger = new LoggerConfiguration().WriteTo.File("log.txt").MinimumLevel.Debug().CreateLogger();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormCatamaranCollection());
}
}
}

81
Catamaran/SetGeneric.cs Normal file
View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
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 void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
public bool Insert(T catamaran, IEqualityComparer<T?>? equal = null)
{
if (_places.Count == _maxCount)
throw new StorageOverflowException(_maxCount);
Insert(catamaran, 0, equal);
return true;
}
public bool Insert(T catamaran, int position, IEqualityComparer<T?>? equal = null)
{
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
throw new StorageOverflowException(_maxCount);
if (!(position >= 0 && position <= Count))
return false;
if (equal != null)
{
if (_places.Contains(catamaran, equal))
throw new ArgumentException(nameof(catamaran));
}
_places.Insert(position, catamaran);
return true;
}
public bool Remove(int position)
{
if (!(position >= 0 && position < Count) || _places[position] == null)
throw new CatamaranNotFoundException(position);
_places[position] = null;
return true;
}
public T? this[int position]
{
get
{
if (!(position >= 0 && position < Count))
return null;
return _places[position];
}
set
{
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
return;
_places.Insert(position, value);
return;
}
}
public IEnumerable<T?> GetCatamarans(int? maxCatamarans = null)
{
for (int i = 0; i < _places.Count; ++i)
{
yield return _places[i];
if (maxCatamarans.HasValue && i == maxCatamarans.Value)
{
yield break;
}
}
}
}
}

15
Catamaran/Status.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public enum Status
{
NotInit,
InProgress,
Finish
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
[Serializable]
internal class StorageOverflowException : ApplicationException
{
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { }
public StorageOverflowException() : base() { }
public StorageOverflowException(string message) : base(message) { }
public StorageOverflowException(string message, Exception exception) : base(message, exception) { }
protected StorageOverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}