в
This commit is contained in:
parent
a3dd44a3e6
commit
be3914ce2e
@ -49,7 +49,7 @@ namespace ProjectPlane.CollectionGenericObjects
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = collection;
|
||||
_collection.SetMaxCount = GetMaxCount;
|
||||
_collection.MaxCount = GetMaxCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -15,7 +15,7 @@
|
||||
/// <summary>
|
||||
/// Установка максимального количества элементов
|
||||
/// </summary>
|
||||
int SetMaxCount { set; }
|
||||
int MaxCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию
|
||||
@ -45,6 +45,17 @@
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>Объект</returns>
|
||||
T? Get(int position);
|
||||
|
||||
/// <summary>
|
||||
/// Получение типа коллекции
|
||||
/// </summary>
|
||||
CollectionType GetCollectionType { get; }
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции по одному
|
||||
/// </summary>
|
||||
/// <returns>Поэлементый вывод элементов коллекции</returns>
|
||||
IEnumerable<T?> GetItems();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,20 @@
|
||||
/// </summary>
|
||||
private int _maxCount;
|
||||
public int Count => _collection.Count;
|
||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||
public int MaxCount
|
||||
{
|
||||
get => _maxCount;
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
_maxCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.List;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -61,5 +74,13 @@
|
||||
_collection.RemoveAt(position);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Count; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,12 @@ namespace ProjectPlane.CollectionGenericObjects
|
||||
/// </summary>
|
||||
private T?[] _collection;
|
||||
public int Count => _collection.Length;
|
||||
public int SetMaxCount
|
||||
public int MaxCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _collection.Length;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
@ -32,6 +36,8 @@ namespace ProjectPlane.CollectionGenericObjects
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.Massive;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -111,5 +117,13 @@ namespace ProjectPlane.CollectionGenericObjects
|
||||
_collection[position] = null;
|
||||
return obj;
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetItems()
|
||||
{
|
||||
for (int i = 0; i < _collection.Length; ++i)
|
||||
{
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
namespace ProjectPlane.CollectionGenericObjects
|
||||
using ProjectPlane.Drawnings;
|
||||
using System.Text;
|
||||
|
||||
namespace ProjectPlane.CollectionGenericObjects
|
||||
{
|
||||
// Класс-хранилище коллекций
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class StorageCollection<T>
|
||||
where T : class
|
||||
where T : DrawningPlane
|
||||
{
|
||||
/// <summary>
|
||||
/// Словарь (хранилище) с коллекциями
|
||||
@ -16,6 +19,21 @@
|
||||
/// </summary>
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Ключевое слово, с которого должен начинаться файл
|
||||
/// </summary>
|
||||
private readonly string _collectionKey = "CollectionsStorage";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private readonly string _separatorForKeyValue = "|";
|
||||
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly string _separatorItems = ";";
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -69,5 +87,126 @@
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение информации по автомобилям в хранилище в файл
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
public bool SaveData(string filename)
|
||||
{
|
||||
if (_storages.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
using (StreamWriter writer = new StreamWriter(filename))
|
||||
{
|
||||
writer.Write(_collectionKey);
|
||||
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> value in _storages)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
sb.Append(Environment.NewLine);
|
||||
// не сохраняем пустые коллекции
|
||||
if (value.Value.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.Append(value.Key);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
sb.Append(value.Value.GetCollectionType);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
sb.Append(value.Value.MaxCount);
|
||||
sb.Append(_separatorForKeyValue);
|
||||
foreach (T? item in value.Value.GetItems())
|
||||
{
|
||||
string data = item?.GetDataForSave() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sb.Append(data);
|
||||
sb.Append(_separatorItems);
|
||||
}
|
||||
writer.Write(sb);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка информации по автомобилям в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public bool LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (StreamReader fs = File.OpenText(filename))
|
||||
{
|
||||
string str = fs.ReadLine();
|
||||
if (str == null || str.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!str.StartsWith(_collectionKey))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_storages.Clear();
|
||||
string strs = "";
|
||||
while ((strs = fs.ReadLine()) != null)
|
||||
{
|
||||
string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
||||
if (collection == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
collection.MaxCount = Convert.ToInt32(record[2]);
|
||||
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
if (elem?.CreateDrawningPlane() is T plane)
|
||||
{
|
||||
if (collection.Insert(plane) == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
_storages.Add(record[0], collection);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание коллекции по типу
|
||||
/// </summary>
|
||||
/// <param name="collectionType"></param>
|
||||
/// <returns></returns>
|
||||
private static ICollectionGenericObjects<T>? CreateCollection(CollectionType collectionType)
|
||||
{
|
||||
return collectionType switch
|
||||
{
|
||||
CollectionType.Massive => new MassiveGenericObjects<T>(),
|
||||
CollectionType.List => new ListGenericObjects<T>(),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using ProjectPlane.Entities;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace ProjectPlane.Drawnings;
|
||||
/// <summary>
|
||||
@ -20,11 +19,11 @@ public class DrawningPlane
|
||||
/// </summary>
|
||||
private int? _pictureHeight;
|
||||
/// <summary>
|
||||
/// Левая координата прорисовки автомобиля
|
||||
/// Левая координата прорисовки самолета
|
||||
/// </summary>
|
||||
protected int? _startPosX;
|
||||
/// <summary>
|
||||
/// Верхняя кооридната прорисовки автомобиля
|
||||
/// Верхняя кооридната прорисовки самолета
|
||||
/// </summary>
|
||||
protected int? _startPosY;
|
||||
|
||||
@ -58,7 +57,7 @@ public class DrawningPlane
|
||||
/// <summary>
|
||||
/// Пустой онструктор
|
||||
/// </summary>
|
||||
private DrawningPlane()
|
||||
public DrawningPlane()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
@ -87,6 +86,15 @@ public class DrawningPlane
|
||||
_pictureHeight = drawningCarHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// конструктор
|
||||
/// </summary>
|
||||
/// <param name="entityPlane"></param>
|
||||
public DrawningPlane(EntityPlane entityPlane)
|
||||
{
|
||||
EntityPlane = entityPlane;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
/// </summary>
|
||||
@ -184,6 +192,7 @@ public class DrawningPlane
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
@ -195,61 +204,27 @@ public class DrawningPlane
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen3 = new(EntityPlane.BodyColor, 2);
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Pen pen5 = new(Color.Black, 4);
|
||||
Pen pen2 = new(Color.Black, 6);
|
||||
Pen pen4 = new(Color.White, 4);
|
||||
Pen pen6 = new(Color.Black, 1);
|
||||
Brush Brush = new SolidBrush(EntityPlane.BodyColor);
|
||||
Brush Brush2 = new SolidBrush(Color.Black);
|
||||
Brush glassBrush = new SolidBrush(Color.SkyBlue);
|
||||
//Brush glassBrush2 = new SolidBrush(EntityPlane.AdditionalColor);
|
||||
//Brush boatBrush = new HatchBrush(HatchStyle.ZigZag, EntityPlane.AdditionalColor, Color.FromArgb(163, 163, 163));
|
||||
//Brush additionalBrush = new SolidBrush(EntityPlane.AdditionalColor);
|
||||
Pen pen = new(EntityPlane.BodyColor, 2);
|
||||
Brush additionalBrush = new SolidBrush(Color.Black);
|
||||
|
||||
//границы самолета
|
||||
g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value + 105, _startPosY.Value);
|
||||
g.DrawLine(pen, _startPosX.Value + 105, _startPosY.Value, _startPosX.Value + 147, _startPosY.Value + 24);
|
||||
|
||||
Point[] points = { new Point(_startPosX.Value + 5, _startPosY.Value + 20), new Point(_startPosX.Value + 20, _startPosY.Value + 15), new Point(_startPosX.Value + 35, _startPosY.Value + 15), new Point(_startPosX.Value + 50, _startPosY.Value), new Point(_startPosX.Value + 70, _startPosY.Value), new Point(_startPosX.Value + 80, _startPosY.Value + 10), new Point(_startPosX.Value + 135, _startPosY.Value + 20), new Point(_startPosX.Value + 143, _startPosY.Value), new Point(_startPosX.Value + 150, _startPosY.Value), new Point(_startPosX.Value + 150, _startPosY.Value + 25), new Point(_startPosX.Value + 90, _startPosY.Value + 30), new Point(_startPosX.Value + 15, _startPosY.Value + 30), new Point(_startPosX.Value + 10, _startPosY.Value + 25) };
|
||||
g.FillPolygon(Brush, points);
|
||||
g.DrawPolygon(pen, points);
|
||||
g.DrawLine(pen, _startPosX.Value, _startPosY.Value + 49, _startPosX.Value + 105, _startPosY.Value + 49);
|
||||
g.DrawLine(pen, _startPosX.Value + 105, _startPosY.Value + 49, _startPosX.Value + 147, _startPosY.Value + 24);
|
||||
|
||||
//стёкла
|
||||
Point[] glass1 = { new Point(_startPosX.Value + 35, _startPosY.Value + 15), new Point(_startPosX.Value + 50, _startPosY.Value), new Point(_startPosX.Value + 42, _startPosY.Value + 15) };
|
||||
g.FillPolygon(glassBrush, glass1);
|
||||
g.DrawPolygon(pen, glass1);
|
||||
g.DrawLine(pen, _startPosX.Value, _startPosY.Value, _startPosX.Value, _startPosY.Value + 49);
|
||||
|
||||
Point[] glass2 = { new Point(_startPosX.Value + 47, _startPosY.Value + 15), new Point(_startPosX.Value + 55, _startPosY.Value), new Point(_startPosX.Value + 55, _startPosY.Value + 15) };
|
||||
g.FillPolygon(glassBrush, glass2);
|
||||
g.DrawPolygon(pen, glass2);
|
||||
//внутренности самолета
|
||||
g.DrawEllipse(pen, _startPosX.Value + 94, _startPosY.Value + 14, 19, 19);
|
||||
|
||||
Point[] glass3 = { new Point(_startPosX.Value + 60, _startPosY.Value + 15), new Point(_startPosX.Value + 65, _startPosY.Value + 7), new Point(_startPosX.Value + 70, _startPosY.Value + 7), new Point(_startPosX.Value + 75, _startPosY.Value + 15) };
|
||||
g.FillPolygon(glassBrush, glass3);
|
||||
g.DrawPolygon(pen, glass3);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 63, _startPosY.Value + 11, 21, 28);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 17, 28, 14);
|
||||
|
||||
//крылья
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 47, _startPosY.Value - 2, 32, 7);
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value, _startPosX.Value + 60, _startPosY.Value + 20);
|
||||
g.DrawLine(pen4, _startPosX.Value + 40, _startPosY.Value - 3, _startPosX.Value + 80, _startPosY.Value - 3);
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 137, _startPosY.Value + 17, 15, 5);
|
||||
//зад
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value - 3, _startPosY.Value + 7, 3, 14);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value - 3, _startPosY.Value + 26, 3, 14);
|
||||
|
||||
|
||||
//пропелер
|
||||
Point[] points2 = { new Point(_startPosX.Value + 10, _startPosY.Value + 20), new Point(_startPosX.Value + 10, _startPosY.Value + 25), new Point(_startPosX.Value + 3, _startPosY.Value + 22) };
|
||||
g.DrawPolygon(pen, points2);
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 1, _startPosY.Value + 10, 5, 13);
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 1, _startPosY.Value + 21, 5, 13);
|
||||
|
||||
//колёса
|
||||
g.DrawLine(pen, _startPosX.Value + 20, _startPosY.Value + 30, _startPosX.Value + 30, _startPosY.Value + 40);
|
||||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 30, _startPosX.Value + 40, _startPosY.Value + 40);
|
||||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 30, _startPosX.Value + 70, _startPosY.Value + 40);
|
||||
g.DrawLine(pen, _startPosX.Value + 80, _startPosY.Value + 30, _startPosX.Value + 90, _startPosY.Value + 40);
|
||||
g.DrawLine(pen5, _startPosX.Value + 10, _startPosY.Value + 41, _startPosX.Value + 90, _startPosY.Value + 41);
|
||||
g.DrawLine(pen, _startPosX.Value + 10, _startPosY.Value + 40, _startPosX.Value + 5, _startPosY.Value + 45);
|
||||
g.DrawLine(pen, _startPosX.Value + 5, _startPosY.Value + 45, _startPosX.Value + 10, _startPosY.Value + 47);
|
||||
g.DrawLine(pen, _startPosX.Value + 90, _startPosY.Value + 40, _startPosX.Value + 90, _startPosY.Value + 50);
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 7, _startPosY.Value + 43, 8, 8);
|
||||
g.FillEllipse(Brush2, _startPosX.Value + 85, _startPosY.Value + 43, 8, 8);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
using ProjectPlane.Entities;
|
||||
|
||||
namespace ProjectPlane.Drawnings
|
||||
{
|
||||
public class DrawningSeaPlane : DrawningPlane
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="line">Признак наличия линии</param>
|
||||
/// <param name="boat">Признак наличия шлюпки</param>
|
||||
/// <param name="floats">Признак наличия поплавков</param>
|
||||
|
||||
public DrawningSeaPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool line, bool boat, bool floats)
|
||||
: base(150, 50)
|
||||
{
|
||||
EntityPlane = new EntitySeaPlane(speed, weight, bodyColor, additionalColor, line, boat, floats);
|
||||
}
|
||||
|
||||
public DrawningSeaPlane(EntityPlane entityPlane)
|
||||
{
|
||||
if (entityPlane != null)
|
||||
{
|
||||
EntityPlane = entityPlane;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityPlane == null || EntityPlane is not EntitySeaPlane entitySeaPlane || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(entitySeaPlane.BodyColor, 2);
|
||||
Brush additionalBrush = new SolidBrush(Color.Black);
|
||||
Brush floatsBrush = new SolidBrush(Color.Black);
|
||||
Brush floatsBrush2 = new SolidBrush(entitySeaPlane.AdditionalColor);
|
||||
Brush lineBrush = new HatchBrush(HatchStyle.ZigZag, entitySeaPlane.AdditionalColor, Color.FromArgb(163, 163, 163));
|
||||
Brush boatBrush = new SolidBrush(entitySeaPlane.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (entitySeaPlane.Line)
|
||||
{
|
||||
g.FillEllipse(lineBrush, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
|
||||
}
|
||||
|
||||
if (entitySeaPlane.Boat)
|
||||
{
|
||||
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
|
||||
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7);
|
||||
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7);
|
||||
}
|
||||
|
||||
if (entitySeaPlane.Floats)
|
||||
{
|
||||
g.DrawEllipse(pen, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
|
||||
g.FillEllipse(floatsBrush2, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
|
||||
|
||||
g.FillRectangle(floatsBrush, _startPosX.Value + 107, _startPosY.Value + 40, 15, 5);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
using ProjectPlane.Entities;
|
||||
|
||||
namespace ProjectPlane.Drawnings
|
||||
{
|
||||
public class DrawningSeaPlane : DrawningPlane
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="line">Признак наличия линии</param>
|
||||
/// <param name="boat">Признак наличия шлюпки</param>
|
||||
/// <param name="floats">Признак наличия поплавков</param>
|
||||
|
||||
public DrawningSeaPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool line, bool boat, bool floats)
|
||||
: base(150, 50)
|
||||
{
|
||||
EntityPlane = new EntitySeaPlane(speed, weight, bodyColor, additionalColor, line, boat, floats);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityPlane == null || EntityPlane is not EntitySeaPlane entitySeaPlane || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen3 = new(EntityPlane.BodyColor, 2);
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Pen pen5 = new(Color.Black, 4);
|
||||
Pen pen2 = new(Color.Black, 6);
|
||||
Pen pen4 = new(Color.White, 4);
|
||||
Pen pen6 = new(Color.Black, 1);
|
||||
Brush Brush = new SolidBrush(EntityPlane.BodyColor);
|
||||
Brush Brush2 = new SolidBrush(Color.Black);
|
||||
Brush glassBrush = new SolidBrush(Color.SkyBlue);
|
||||
Brush glassBrush2 = new SolidBrush(entitySeaPlane.AdditionalColor);
|
||||
Brush boatBrush = new HatchBrush(HatchStyle.ZigZag, entitySeaPlane.AdditionalColor, Color.FromArgb(163, 163, 163));
|
||||
Brush additionalBrush = new SolidBrush(entitySeaPlane.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
//внутренности самолета
|
||||
|
||||
//g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10, 80, 30);
|
||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 10, 80, 30);
|
||||
|
||||
|
||||
|
||||
|
||||
if (entitySeaPlane.Line)
|
||||
{
|
||||
Point[] points3 = { new Point(_startPosX.Value + 35, _startPosY.Value + 15), new Point(_startPosX.Value + 20, _startPosY.Value + 15), new Point(_startPosX.Value + 10, _startPosY.Value + 20), new Point(_startPosX.Value + 10, _startPosY.Value + 25), new Point(_startPosX.Value + 15, _startPosY.Value + 30), new Point(_startPosX.Value + 145, _startPosY.Value + 20), new Point(_startPosX.Value + 140, _startPosY.Value + 20), new Point(_startPosX.Value + 140, _startPosY.Value + 10), new Point(_startPosX.Value + 135, _startPosY.Value + 20), new Point(_startPosX.Value + 30, _startPosY.Value + 20) };
|
||||
g.FillPolygon(additionalBrush, points3);
|
||||
g.DrawPolygon(pen6, points3);
|
||||
|
||||
}
|
||||
|
||||
if (entitySeaPlane.Floats)
|
||||
{
|
||||
Point[] points4 = { new Point(_startPosX.Value + 10, _startPosY.Value + 40), new Point(_startPosX.Value + 110, _startPosY.Value + 40), new Point(_startPosX.Value + 110, _startPosY.Value + 41), new Point(_startPosX.Value + 70, _startPosY.Value + 50), new Point(_startPosX.Value + 30, _startPosY.Value + 50) };
|
||||
g.FillPolygon(additionalBrush, points4);
|
||||
g.DrawPolygon(pen, points4);
|
||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 45, _startPosX.Value + 80, _startPosY.Value + 45);
|
||||
}
|
||||
|
||||
if (entitySeaPlane.Boat)
|
||||
{
|
||||
g.DrawRectangle(pen, _startPosX.Value + 85, _startPosY.Value + 15, 25, 10);
|
||||
g.FillRectangle(boatBrush, _startPosX.Value + 85, _startPosY.Value + 15, 25, 10);
|
||||
Point[] points5 = { new Point(_startPosX.Value + 80, _startPosY.Value + 15), new Point(_startPosX.Value + 85, _startPosY.Value + 10), new Point(_startPosX.Value + 115, _startPosY.Value + 10), new Point(_startPosX.Value + 115, _startPosY.Value + 15), new Point(_startPosX.Value + 85, _startPosY.Value + 15), new Point(_startPosX.Value + 85, _startPosY.Value + 25), new Point(_startPosX.Value + 115, _startPosY.Value + 25), new Point(_startPosX.Value + 115, _startPosY.Value + 30), new Point(_startPosX.Value + 85, _startPosY.Value + 30), new Point(_startPosX.Value + 80, _startPosY.Value + 25) };
|
||||
g.FillPolygon(additionalBrush, points5);
|
||||
g.DrawPolygon(pen, points5);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using ProjectPlane.Entities;
|
||||
|
||||
namespace ProjectPlane.Drawnings
|
||||
{
|
||||
public static class ExtentionDrawningPlane
|
||||
{
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly string _separatorForObject = ":";
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из строки
|
||||
/// </summary>
|
||||
/// <param name="info">Строка с данными для создания объекта</param>
|
||||
/// <returns>Объект</returns>
|
||||
public static DrawningPlane? CreateDrawningPlane(this string info)
|
||||
{
|
||||
string[] strs = info.Split(_separatorForObject);
|
||||
EntityPlane? plane = EntitySeaPlane.CreateEntitySeaPlane(strs);
|
||||
if (plane != null)
|
||||
{
|
||||
return new DrawningSeaPlane(plane);
|
||||
}
|
||||
|
||||
plane = EntityPlane.CreateEntityPlane(strs);
|
||||
if (plane != null)
|
||||
{
|
||||
return new DrawningPlane(plane);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение данных для сохранения в файл
|
||||
/// </summary>
|
||||
/// <param name="drawningCrusier">Сохраняемый объект</param>
|
||||
/// <returns>Строка с данными по объекту</returns>
|
||||
public static string GetDataForSave(this DrawningPlane drawningCrusier)
|
||||
{
|
||||
string[]? array = drawningCrusier?.EntityPlane?.GetStringRepresentation();
|
||||
if (array == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Join(_separatorForObject, array);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,10 +10,12 @@ public class EntityPlane
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
@ -22,10 +24,12 @@ public class EntityPlane
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса самолета
|
||||
/// </summary>
|
||||
@ -38,4 +42,28 @@ public class EntityPlane
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение строк со значениями свойств объекта класса-сущности
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityPlane), Speed.ToString(), Weight.ToString(), BodyColor.Name };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityPlane? CreateEntityPlane(string[] strs)
|
||||
{
|
||||
if (strs.Length != 4 || strs[0] != nameof(EntityPlane))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new EntityPlane(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
|
||||
}
|
||||
}
|
@ -6,14 +6,17 @@
|
||||
/// Признак (опция) наличие линии
|
||||
/// </summary>
|
||||
public bool Line { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличие шлюпки
|
||||
/// </summary>
|
||||
public bool Boat { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличие поплавков
|
||||
/// </summary>
|
||||
public bool Floats { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
@ -22,6 +25,7 @@
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
|
||||
public EntitySeaPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool line, bool boat, bool floats) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
@ -29,5 +33,30 @@
|
||||
Boat = boat;
|
||||
Floats = floats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение строк со значениями свойств объекта класса-сущности
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string[] GetStringRepresentation()
|
||||
{
|
||||
return new[] { nameof(EntityPlane), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name,
|
||||
Line.ToString(), Boat.ToString(), Floats.ToString() };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта из массива строк
|
||||
/// </summary>
|
||||
/// <param name="strs"></param>
|
||||
/// <returns></returns>
|
||||
public static EntityPlane? CreateEntitySeaPlane(string[] strs)
|
||||
{
|
||||
if (strs.Length != 8 || strs[0] != nameof(EntityPlane))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new EntitySeaPlane(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]),
|
||||
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7]));
|
||||
}
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ namespace ProjectPlane
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки круисера
|
||||
/// Метод прорисовки самолета
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
@ -38,9 +38,9 @@
|
||||
panelBlue = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxLine = new CheckBox();
|
||||
checkBoxBoat = new CheckBox();
|
||||
checkBoxFloats = new CheckBox();
|
||||
checkBoxBoat = new CheckBox();
|
||||
checkBoxLine = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
@ -64,9 +64,9 @@
|
||||
// groupBoxConfing
|
||||
//
|
||||
groupBoxConfing.Controls.Add(groupBoxColors);
|
||||
groupBoxConfing.Controls.Add(checkBoxLine);
|
||||
groupBoxConfing.Controls.Add(checkBoxBoat);
|
||||
groupBoxConfing.Controls.Add(checkBoxFloats);
|
||||
groupBoxConfing.Controls.Add(checkBoxBoat);
|
||||
groupBoxConfing.Controls.Add(checkBoxLine);
|
||||
groupBoxConfing.Controls.Add(numericUpDownWeight);
|
||||
groupBoxConfing.Controls.Add(labelWeight);
|
||||
groupBoxConfing.Controls.Add(numericUpDownSpeed);
|
||||
@ -75,10 +75,8 @@
|
||||
groupBoxConfing.Controls.Add(labelSimpleObject);
|
||||
groupBoxConfing.Dock = DockStyle.Left;
|
||||
groupBoxConfing.Location = new Point(0, 0);
|
||||
groupBoxConfing.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxConfing.Name = "groupBoxConfing";
|
||||
groupBoxConfing.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxConfing.Size = new Size(548, 196);
|
||||
groupBoxConfing.Size = new Size(626, 262);
|
||||
groupBoxConfing.TabIndex = 0;
|
||||
groupBoxConfing.TabStop = false;
|
||||
groupBoxConfing.Text = "Параметры";
|
||||
@ -93,11 +91,9 @@
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Location = new Point(286, 20);
|
||||
groupBoxColors.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxColors.Location = new Point(327, 26);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxColors.Size = new Size(245, 116);
|
||||
groupBoxColors.Size = new Size(280, 154);
|
||||
groupBoxColors.TabIndex = 9;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвета";
|
||||
@ -105,155 +101,141 @@
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(190, 72);
|
||||
panelPurple.Margin = new Padding(3, 2, 3, 2);
|
||||
panelPurple.Location = new Point(217, 96);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(42, 35);
|
||||
panelPurple.Size = new Size(48, 47);
|
||||
panelPurple.TabIndex = 1;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(130, 72);
|
||||
panelBlack.Margin = new Padding(3, 2, 3, 2);
|
||||
panelBlack.Location = new Point(149, 96);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(42, 35);
|
||||
panelBlack.Size = new Size(48, 47);
|
||||
panelBlack.TabIndex = 1;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(72, 72);
|
||||
panelGray.Margin = new Padding(3, 2, 3, 2);
|
||||
panelGray.Location = new Point(82, 96);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(42, 35);
|
||||
panelGray.Size = new Size(48, 47);
|
||||
panelGray.TabIndex = 1;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(15, 72);
|
||||
panelWhite.Margin = new Padding(3, 2, 3, 2);
|
||||
panelWhite.Location = new Point(17, 96);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(42, 35);
|
||||
panelWhite.Size = new Size(48, 47);
|
||||
panelWhite.TabIndex = 1;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(190, 23);
|
||||
panelYellow.Margin = new Padding(3, 2, 3, 2);
|
||||
panelYellow.Location = new Point(217, 31);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(42, 35);
|
||||
panelYellow.Size = new Size(48, 47);
|
||||
panelYellow.TabIndex = 1;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(130, 23);
|
||||
panelBlue.Margin = new Padding(3, 2, 3, 2);
|
||||
panelBlue.Location = new Point(149, 31);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(42, 35);
|
||||
panelBlue.Size = new Size(48, 47);
|
||||
panelBlue.TabIndex = 1;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(72, 23);
|
||||
panelGreen.Margin = new Padding(3, 2, 3, 2);
|
||||
panelGreen.Location = new Point(82, 31);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(42, 35);
|
||||
panelGreen.Size = new Size(48, 47);
|
||||
panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(15, 23);
|
||||
panelRed.Margin = new Padding(3, 2, 3, 2);
|
||||
panelRed.Location = new Point(17, 31);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(42, 35);
|
||||
panelRed.Size = new Size(48, 47);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxLine
|
||||
//
|
||||
checkBoxLine.AutoSize = true;
|
||||
checkBoxLine.Location = new Point(5, 163);
|
||||
checkBoxLine.Margin = new Padding(3, 2, 3, 2);
|
||||
checkBoxLine.Name = "checkBoxLine";
|
||||
checkBoxLine.Size = new Size(185, 19);
|
||||
checkBoxLine.TabIndex = 8;
|
||||
checkBoxLine.Text = "Признак наличие поплавков";
|
||||
checkBoxLine.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBoat
|
||||
//
|
||||
checkBoxBoat.AutoSize = true;
|
||||
checkBoxBoat.Location = new Point(5, 127);
|
||||
checkBoxBoat.Margin = new Padding(3, 2, 3, 2);
|
||||
checkBoxBoat.Name = "checkBoxBoat";
|
||||
checkBoxBoat.Size = new Size(174, 19);
|
||||
checkBoxBoat.TabIndex = 7;
|
||||
checkBoxBoat.Text = "Признак наличие шлюпки";
|
||||
checkBoxBoat.UseVisualStyleBackColor = true;
|
||||
checkBoxBoat.CheckedChanged += checkBoxBoat_CheckedChanged;
|
||||
//
|
||||
// checkBoxFloats
|
||||
//
|
||||
checkBoxFloats.AutoSize = true;
|
||||
checkBoxFloats.Location = new Point(5, 92);
|
||||
checkBoxFloats.Margin = new Padding(3, 2, 3, 2);
|
||||
checkBoxFloats.Location = new Point(6, 217);
|
||||
checkBoxFloats.Name = "checkBoxFloats";
|
||||
checkBoxFloats.Size = new Size(161, 19);
|
||||
checkBoxFloats.TabIndex = 6;
|
||||
checkBoxFloats.Text = "Признак наличие линии";
|
||||
checkBoxFloats.Size = new Size(202, 24);
|
||||
checkBoxFloats.TabIndex = 8;
|
||||
checkBoxFloats.Text = "Признак наличие пушки";
|
||||
checkBoxFloats.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBoat
|
||||
//
|
||||
checkBoxBoat.AutoSize = true;
|
||||
checkBoxBoat.Location = new Point(6, 169);
|
||||
checkBoxBoat.Name = "checkBoxBoat";
|
||||
checkBoxBoat.Size = new Size(215, 24);
|
||||
checkBoxBoat.TabIndex = 7;
|
||||
checkBoxBoat.Text = "Признак наличие шлюпок";
|
||||
checkBoxBoat.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxLine
|
||||
//
|
||||
checkBoxLine.AutoSize = true;
|
||||
checkBoxLine.Location = new Point(6, 123);
|
||||
checkBoxLine.Name = "checkBoxLine";
|
||||
checkBoxLine.Size = new Size(321, 24);
|
||||
checkBoxLine.TabIndex = 6;
|
||||
checkBoxLine.Text = "Признак наличие вертолетной площадки";
|
||||
checkBoxLine.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(82, 51);
|
||||
numericUpDownWeight.Margin = new Padding(3, 2, 3, 2);
|
||||
numericUpDownWeight.Location = new Point(94, 68);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(100, 23);
|
||||
numericUpDownWeight.Size = new Size(114, 27);
|
||||
numericUpDownWeight.TabIndex = 5;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(24, 52);
|
||||
labelWeight.Location = new Point(27, 70);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(29, 15);
|
||||
labelWeight.Size = new Size(36, 20);
|
||||
labelWeight.TabIndex = 4;
|
||||
labelWeight.Text = "Вес:";
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(82, 24);
|
||||
numericUpDownSpeed.Margin = new Padding(3, 2, 3, 2);
|
||||
numericUpDownSpeed.Location = new Point(94, 32);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(100, 23);
|
||||
numericUpDownSpeed.Size = new Size(114, 27);
|
||||
numericUpDownSpeed.TabIndex = 3;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(10, 24);
|
||||
labelSpeed.Location = new Point(12, 32);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(62, 15);
|
||||
labelSpeed.Size = new Size(76, 20);
|
||||
labelSpeed.TabIndex = 2;
|
||||
labelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(416, 152);
|
||||
labelModifiedObject.Location = new Point(476, 203);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(115, 34);
|
||||
labelModifiedObject.Size = new Size(131, 44);
|
||||
labelModifiedObject.TabIndex = 1;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
@ -262,9 +244,9 @@
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(286, 152);
|
||||
labelSimpleObject.Location = new Point(327, 203);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(114, 34);
|
||||
labelSimpleObject.Size = new Size(130, 44);
|
||||
labelSimpleObject.TabIndex = 0;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
@ -272,19 +254,17 @@
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(10, 42);
|
||||
pictureBoxObject.Margin = new Padding(3, 2, 3, 2);
|
||||
pictureBoxObject.Location = new Point(11, 56);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(160, 94);
|
||||
pictureBoxObject.Size = new Size(183, 125);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(553, 159);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Location = new Point(632, 212);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(82, 22);
|
||||
buttonAdd.Size = new Size(94, 29);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -292,10 +272,9 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(648, 159);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Location = new Point(740, 212);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(82, 22);
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -306,10 +285,9 @@
|
||||
panelObject.Controls.Add(labelAdditionalColor);
|
||||
panelObject.Controls.Add(labelBodyColor);
|
||||
panelObject.Controls.Add(pictureBoxObject);
|
||||
panelObject.Location = new Point(553, 9);
|
||||
panelObject.Margin = new Padding(3, 2, 3, 2);
|
||||
panelObject.Location = new Point(632, 12);
|
||||
panelObject.Name = "panelObject";
|
||||
panelObject.Size = new Size(179, 146);
|
||||
panelObject.Size = new Size(205, 194);
|
||||
panelObject.TabIndex = 4;
|
||||
panelObject.DragDrop += PanelObject_DragDrop;
|
||||
panelObject.DragEnter += PanelObject_DragEnter;
|
||||
@ -318,9 +296,9 @@
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(94, 8);
|
||||
labelAdditionalColor.Location = new Point(108, 11);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(73, 28);
|
||||
labelAdditionalColor.Size = new Size(83, 36);
|
||||
labelAdditionalColor.TabIndex = 3;
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
@ -331,9 +309,9 @@
|
||||
//
|
||||
labelBodyColor.AllowDrop = true;
|
||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBodyColor.Location = new Point(10, 8);
|
||||
labelBodyColor.Location = new Point(11, 11);
|
||||
labelBodyColor.Name = "labelBodyColor";
|
||||
labelBodyColor.Size = new Size(73, 28);
|
||||
labelBodyColor.Size = new Size(83, 36);
|
||||
labelBodyColor.TabIndex = 2;
|
||||
labelBodyColor.Text = "Цвет";
|
||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
@ -342,14 +320,13 @@
|
||||
//
|
||||
// FormPlaneConfing
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(733, 196);
|
||||
ClientSize = new Size(838, 262);
|
||||
Controls.Add(panelObject);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(groupBoxConfing);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormPlaneConfing";
|
||||
Text = "Создание объекта";
|
||||
groupBoxConfing.ResumeLayout(false);
|
||||
@ -371,9 +348,9 @@
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private CheckBox checkBoxFloats;
|
||||
private CheckBox checkBoxBoat;
|
||||
private CheckBox checkBoxLine;
|
||||
private CheckBox checkBoxBoat;
|
||||
private CheckBox checkBoxFloats;
|
||||
private GroupBox groupBoxColors;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlack;
|
@ -9,7 +9,7 @@ namespace ProjectPlane
|
||||
public partial class FormPlaneConfing : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Объект - прорисовка крейсера
|
||||
/// Объект - прорисовка самолета
|
||||
/// </summary>
|
||||
private DrawningPlane _plane;
|
||||
|
||||
@ -62,8 +62,8 @@ namespace ProjectPlane
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Label
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="sender"></param>labelSimpleObject
|
||||
/// <param name="e"></param>labelSimpleObject
|
||||
private void labelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
@ -95,7 +95,7 @@ namespace ProjectPlane
|
||||
case "labelModifiedObject":
|
||||
_plane = new
|
||||
DrawningSeaPlane((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
|
||||
Color.Black, checkBoxFloats.Checked, checkBoxBoat.Checked, checkBoxLine.Checked);
|
||||
Color.Black, checkBoxLine.Checked, checkBoxBoat.Checked, checkBoxFloats.Checked);
|
||||
break;
|
||||
}
|
||||
DrawObject();
|
||||
@ -171,12 +171,6 @@ namespace ProjectPlane
|
||||
PlaneDelegate?.Invoke(_plane);
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkBoxBoat_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -46,10 +46,17 @@
|
||||
maskedTextBoxPosision = new MaskedTextBox();
|
||||
buttonGetToTest = new Button();
|
||||
pictureBoxPlane = new PictureBox();
|
||||
menuStrip = new MenuStrip();
|
||||
файлToolStripMenuItem = new ToolStripMenuItem();
|
||||
saveToolStripMenuItem = new ToolStripMenuItem();
|
||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
||||
saveFileDialog = new SaveFileDialog();
|
||||
openFileDialog = new OpenFileDialog();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxPlane).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
@ -59,21 +66,18 @@
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(546, 0);
|
||||
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxTools.Location = new Point(631, 28);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxTools.Size = new Size(194, 490);
|
||||
groupBoxTools.Size = new Size(222, 651);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "инструменты";
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(18, 259);
|
||||
buttonCreateCompany.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateCompany.Location = new Point(21, 345);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(163, 20);
|
||||
buttonCreateCompany.Size = new Size(186, 27);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
@ -89,18 +93,16 @@
|
||||
panelStorage.Controls.Add(textBoxCollectionName);
|
||||
panelStorage.Controls.Add(labelCollectionName);
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 18);
|
||||
panelStorage.Margin = new Padding(3, 2, 3, 2);
|
||||
panelStorage.Location = new Point(3, 23);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(188, 212);
|
||||
panelStorage.Size = new Size(216, 283);
|
||||
panelStorage.TabIndex = 6;
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Location = new Point(15, 185);
|
||||
buttonCollectionDel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCollectionDel.Location = new Point(17, 247);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(163, 20);
|
||||
buttonCollectionDel.Size = new Size(186, 27);
|
||||
buttonCollectionDel.TabIndex = 6;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||
@ -109,19 +111,17 @@
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 15;
|
||||
listBoxCollection.Location = new Point(15, 103);
|
||||
listBoxCollection.Margin = new Padding(3, 2, 3, 2);
|
||||
listBoxCollection.ItemHeight = 20;
|
||||
listBoxCollection.Location = new Point(17, 137);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(163, 79);
|
||||
listBoxCollection.Size = new Size(186, 104);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// buttonCollecctionAdd
|
||||
//
|
||||
buttonCollecctionAdd.Location = new Point(15, 78);
|
||||
buttonCollecctionAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCollecctionAdd.Location = new Point(17, 104);
|
||||
buttonCollecctionAdd.Name = "buttonCollecctionAdd";
|
||||
buttonCollecctionAdd.Size = new Size(163, 20);
|
||||
buttonCollecctionAdd.Size = new Size(186, 27);
|
||||
buttonCollecctionAdd.TabIndex = 4;
|
||||
buttonCollecctionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollecctionAdd.UseVisualStyleBackColor = true;
|
||||
@ -130,10 +130,9 @@
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(108, 56);
|
||||
radioButtonList.Margin = new Padding(3, 2, 3, 2);
|
||||
radioButtonList.Location = new Point(123, 75);
|
||||
radioButtonList.Name = "radioButtonList";
|
||||
radioButtonList.Size = new Size(66, 19);
|
||||
radioButtonList.Size = new Size(80, 24);
|
||||
radioButtonList.TabIndex = 3;
|
||||
radioButtonList.TabStop = true;
|
||||
radioButtonList.Text = "Список";
|
||||
@ -142,10 +141,9 @@
|
||||
// radioButtonMassive
|
||||
//
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(15, 56);
|
||||
radioButtonMassive.Margin = new Padding(3, 2, 3, 2);
|
||||
radioButtonMassive.Location = new Point(17, 75);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(67, 19);
|
||||
radioButtonMassive.Size = new Size(82, 24);
|
||||
radioButtonMassive.TabIndex = 2;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
@ -153,18 +151,17 @@
|
||||
//
|
||||
// textBoxCollectionName
|
||||
//
|
||||
textBoxCollectionName.Location = new Point(15, 24);
|
||||
textBoxCollectionName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxCollectionName.Location = new Point(17, 32);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(163, 23);
|
||||
textBoxCollectionName.Size = new Size(186, 27);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(23, 7);
|
||||
labelCollectionName.Location = new Point(26, 9);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(122, 15);
|
||||
labelCollectionName.Size = new Size(155, 20);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции";
|
||||
//
|
||||
@ -173,10 +170,9 @@
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(18, 233);
|
||||
comboBoxSelectorCompany.Margin = new Padding(3, 2, 3, 2);
|
||||
comboBoxSelectorCompany.Location = new Point(21, 311);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(163, 23);
|
||||
comboBoxSelectorCompany.Size = new Size(186, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
|
||||
//
|
||||
@ -188,20 +184,18 @@
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosision);
|
||||
panelCompanyTools.Controls.Add(buttonGetToTest);
|
||||
panelCompanyTools.Enabled = false;
|
||||
panelCompanyTools.Location = new Point(3, 284);
|
||||
panelCompanyTools.Margin = new Padding(3, 2, 3, 2);
|
||||
panelCompanyTools.Location = new Point(3, 379);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(189, 206);
|
||||
panelCompanyTools.Size = new Size(216, 274);
|
||||
panelCompanyTools.TabIndex = 8;
|
||||
//
|
||||
// ButtonAddPlane
|
||||
//
|
||||
ButtonAddPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
ButtonAddPlane.BackgroundImageLayout = ImageLayout.Center;
|
||||
ButtonAddPlane.Location = new Point(16, 2);
|
||||
ButtonAddPlane.Margin = new Padding(3, 2, 3, 2);
|
||||
ButtonAddPlane.Location = new Point(18, 3);
|
||||
ButtonAddPlane.Name = "ButtonAddPlane";
|
||||
ButtonAddPlane.Size = new Size(163, 30);
|
||||
ButtonAddPlane.Size = new Size(186, 40);
|
||||
ButtonAddPlane.TabIndex = 1;
|
||||
ButtonAddPlane.Text = "добваление самолета";
|
||||
ButtonAddPlane.UseVisualStyleBackColor = true;
|
||||
@ -210,10 +204,9 @@
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(16, 170);
|
||||
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRefresh.Location = new Point(18, 227);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(163, 31);
|
||||
buttonRefresh.Size = new Size(186, 41);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
@ -222,10 +215,9 @@
|
||||
// ButtonRemovePlane
|
||||
//
|
||||
ButtonRemovePlane.Anchor = AnchorStyles.Right;
|
||||
ButtonRemovePlane.Location = new Point(16, 104);
|
||||
ButtonRemovePlane.Margin = new Padding(3, 2, 3, 2);
|
||||
ButtonRemovePlane.Location = new Point(18, 138);
|
||||
ButtonRemovePlane.Name = "ButtonRemovePlane";
|
||||
ButtonRemovePlane.Size = new Size(163, 30);
|
||||
ButtonRemovePlane.Size = new Size(186, 40);
|
||||
ButtonRemovePlane.TabIndex = 3;
|
||||
ButtonRemovePlane.Text = "удалить самолет";
|
||||
ButtonRemovePlane.UseVisualStyleBackColor = true;
|
||||
@ -233,21 +225,19 @@
|
||||
//
|
||||
// maskedTextBoxPosision
|
||||
//
|
||||
maskedTextBoxPosision.Location = new Point(15, 79);
|
||||
maskedTextBoxPosision.Margin = new Padding(3, 2, 3, 2);
|
||||
maskedTextBoxPosision.Location = new Point(17, 105);
|
||||
maskedTextBoxPosision.Mask = "00";
|
||||
maskedTextBoxPosision.Name = "maskedTextBoxPosision";
|
||||
maskedTextBoxPosision.Size = new Size(164, 23);
|
||||
maskedTextBoxPosision.Size = new Size(187, 27);
|
||||
maskedTextBoxPosision.TabIndex = 2;
|
||||
maskedTextBoxPosision.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonGetToTest
|
||||
//
|
||||
buttonGetToTest.Anchor = AnchorStyles.Right;
|
||||
buttonGetToTest.Location = new Point(16, 138);
|
||||
buttonGetToTest.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonGetToTest.Location = new Point(18, 184);
|
||||
buttonGetToTest.Name = "buttonGetToTest";
|
||||
buttonGetToTest.Size = new Size(163, 30);
|
||||
buttonGetToTest.Size = new Size(186, 40);
|
||||
buttonGetToTest.TabIndex = 4;
|
||||
buttonGetToTest.Text = "передать на тесты";
|
||||
buttonGetToTest.UseVisualStyleBackColor = true;
|
||||
@ -256,21 +246,62 @@
|
||||
// pictureBoxPlane
|
||||
//
|
||||
pictureBoxPlane.Dock = DockStyle.Fill;
|
||||
pictureBoxPlane.Location = new Point(0, 0);
|
||||
pictureBoxPlane.Margin = new Padding(3, 2, 3, 2);
|
||||
pictureBoxPlane.Location = new Point(0, 28);
|
||||
pictureBoxPlane.Name = "pictureBoxPlane";
|
||||
pictureBoxPlane.Size = new Size(546, 490);
|
||||
pictureBoxPlane.Size = new Size(631, 651);
|
||||
pictureBoxPlane.TabIndex = 1;
|
||||
pictureBoxPlane.TabStop = false;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(853, 28);
|
||||
menuStrip.TabIndex = 2;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// файлToolStripMenuItem
|
||||
//
|
||||
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
||||
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
файлToolStripMenuItem.Size = new Size(59, 24);
|
||||
файлToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
saveToolStripMenuItem.Size = new Size(227, 26);
|
||||
saveToolStripMenuItem.Text = "Сохранение";
|
||||
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||
//
|
||||
// loadToolStripMenuItem
|
||||
//
|
||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
|
||||
loadToolStripMenuItem.Size = new Size(227, 26);
|
||||
loadToolStripMenuItem.Text = "Загрузка";
|
||||
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
saveFileDialog.Filter = "txt file|*.txt";
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
openFileDialog.Filter = "txt file|*.txt";
|
||||
//
|
||||
// FormPlanesCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(740, 490);
|
||||
ClientSize = new Size(853, 679);
|
||||
Controls.Add(pictureBoxPlane);
|
||||
Controls.Add(groupBoxTools);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormPlanesCollection";
|
||||
Text = "FormPlanesCollection";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
@ -279,7 +310,10 @@
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxPlane).EndInit();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -302,5 +336,11 @@
|
||||
private Button buttonCreateCompany;
|
||||
private Button buttonCollectionDel;
|
||||
private Panel panelCompanyTools;
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem файлToolStripMenuItem;
|
||||
private ToolStripMenuItem saveToolStripMenuItem;
|
||||
private ToolStripMenuItem loadToolStripMenuItem;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
private OpenFileDialog openFileDialog;
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
using ProjectPlane.CollectionGenericObjects;
|
||||
using ProjectPlane.Drawnings;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectPlane
|
||||
{
|
||||
@ -45,10 +44,10 @@ namespace ProjectPlane
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление крейсера в коллекцию
|
||||
/// Добавление самолета в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="plane"></param>
|
||||
private void SetPlane(DrawningPlane plane)
|
||||
private void SetPlane(DrawningPlane? plane)
|
||||
{
|
||||
if (_company == null || plane == null)
|
||||
{
|
||||
@ -223,8 +222,48 @@ namespace ProjectPlane
|
||||
}
|
||||
panelCompanyTools.Enabled = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.SaveData(saveFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Загрузка"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storageCollection.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,4 +117,16 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 1</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 1</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>310, 1</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user