Compare commits
No commits in common. "279b2238d41b29e9e5297f38a2e94e4b284f2ba3" and "919febed183b1474f88f970fb6fd0ac3fa857fb5" have entirely different histories.
279b2238d4
...
919febed18
@ -1,52 +1,71 @@
|
|||||||
using HoistingCrane.Drawning;
|
using HoistingCrane.Drawning;
|
||||||
namespace HoistingCrane.CollectionGenericObjects
|
namespace HoistingCrane.CollectionGenericObjects;
|
||||||
|
public abstract class AbstractCompany
|
||||||
{
|
{
|
||||||
public abstract class AbstractCompany
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина ячейки гаража
|
/// Размер места (ширина)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _placeSizeWidth = 150;
|
protected readonly int _placeSizeWidth = 180;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота ячейки гаража
|
/// Размер места (высота)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _placeSizeHeight = 90;
|
protected readonly int _placeSizeHeight = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int pictureWidth;
|
protected readonly int _pictureWidth;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота окна
|
/// Высота окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int pictureHeight;
|
protected readonly int _pictureHeight;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Коллекция автомобилей
|
/// Коллекция военных кораблей
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected ICollectionGenericObjects<DrawningTrackedVehicle>? arr = null;
|
protected ICollectionGenericObjects<DrawningTrackedVehicle>? _collection = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Максимальное количество гаражей
|
/// Вычисление максимального количества элементов, которые можно разместить в окне
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int GetMaxCount
|
private int GetMaxCount => (_pictureWidth / _placeSizeWidth) * (_pictureHeight / _placeSizeHeight);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth">Ширина окна</param>
|
||||||
|
/// <param name="picHeight">Высота окна</param>
|
||||||
|
/// <param name="collection">Коллекция военных кораблей</param>
|
||||||
|
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> collection)
|
||||||
{
|
{
|
||||||
get
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_collection = collection;
|
||||||
|
_collection.MaxCount = GetMaxCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company">Компания</param>
|
||||||
|
/// <param name="warship">Добавляемый объект</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(AbstractCompany company, DrawningTrackedVehicle warship)
|
||||||
{
|
{
|
||||||
return (pictureWidth / _placeSizeWidth) * (pictureHeight * _placeSizeHeight);
|
return company._collection.Insert(warship);
|
||||||
}
|
|
||||||
}
|
|
||||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)
|
|
||||||
{
|
|
||||||
pictureWidth = picWidth;
|
|
||||||
pictureHeight = picHeight;
|
|
||||||
arr = array;
|
|
||||||
arr.MaxCount = GetMaxCount;
|
|
||||||
}
|
|
||||||
public static int operator +(AbstractCompany company, DrawningTrackedVehicle car)
|
|
||||||
{
|
|
||||||
return company.arr.Insert(car, new DrawningCraneEqutables());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора удаления для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company">Компания</param>
|
||||||
|
/// <param name="position">Номер удаляемого объекта</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static DrawningTrackedVehicle operator -(AbstractCompany company, int position)
|
public static DrawningTrackedVehicle operator -(AbstractCompany company, int position)
|
||||||
{
|
{
|
||||||
return company.arr?.Remove(position);
|
return company._collection.Remove(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -91,10 +110,5 @@ namespace HoistingCrane.CollectionGenericObjects
|
|||||||
/// Расстановка объектов
|
/// Расстановка объектов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void SetObjectsPosition();
|
protected abstract void SetObjectsPosition();
|
||||||
/// <summary>
|
|
||||||
/// Сортировка
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comparer"></param>
|
|
||||||
public void Sort(IComparer<DrawningTrackedVehicle> comparer) => arr?.CollectionSort(comparer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T> where T : clas
|
|||||||
|
|
||||||
public IEnumerable<T?> GetItems()
|
public IEnumerable<T?> GetItems()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
yield return list[i];
|
yield return list[i];
|
||||||
}
|
}
|
||||||
@ -104,5 +104,4 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T> where T : clas
|
|||||||
{
|
{
|
||||||
list.Sort(comparer);
|
list.Sort(comparer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -172,9 +172,9 @@ public class StorageCollection<T> where T : DrawningTrackedVehicle
|
|||||||
throw new InvalidOperationException("Объект не удалось добавить в коллекцию: " + record[2]);
|
throw new InvalidOperationException("Объект не удалось добавить в коллекцию: " + record[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(CollectionOverflowException ex)
|
catch (CollectionOverflowException ex)
|
||||||
{
|
{
|
||||||
throw new CollectionOverflowException("Коллекция переполнена", ex);
|
throw new CollectionOverflowException("Коллекция переполнена");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,5 +196,4 @@ public class StorageCollection<T> where T : DrawningTrackedVehicle
|
|||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,18 +0,0 @@
|
|||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
public class DrawningCraneCompareByColor : IComparer<DrawningTrackedVehicle?>
|
|
||||||
{
|
|
||||||
public int Compare(DrawningTrackedVehicle? x, DrawningTrackedVehicle? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTrackedVehicle == null) return -1;
|
|
||||||
if (y == null || y.EntityTrackedVehicle == null) return 1;
|
|
||||||
if (x.EntityTrackedVehicle.BodyColor.Name != y.EntityTrackedVehicle.BodyColor.Name)
|
|
||||||
return x.EntityTrackedVehicle.BodyColor.Name.CompareTo(y.EntityTrackedVehicle.BodyColor.Name);
|
|
||||||
var speedCompare = x.EntityTrackedVehicle.Speed.CompareTo(y.EntityTrackedVehicle.Speed);
|
|
||||||
if (speedCompare != 0) return speedCompare;
|
|
||||||
return x.EntityTrackedVehicle.Weight.CompareTo(y.EntityTrackedVehicle.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
public class DrawningCraneCompareByType : IComparer<DrawningTrackedVehicle?>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Сравнение по типу, скорости и весу
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x"></param>
|
|
||||||
/// <param name="y"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Compare(DrawningTrackedVehicle? x, DrawningTrackedVehicle? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTrackedVehicle == null) return -1;
|
|
||||||
if (y == null || y.EntityTrackedVehicle == null) return 1;
|
|
||||||
if (x.GetType().Name != y.GetType().Name) return x.GetType().Name.CompareTo(y.GetType().Name);
|
|
||||||
var speedCompare = x.EntityTrackedVehicle.Speed.CompareTo(y.EntityTrackedVehicle.Speed);
|
|
||||||
if(speedCompare != 0) return speedCompare;
|
|
||||||
return x.EntityTrackedVehicle.Weight.CompareTo(y.EntityTrackedVehicle.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using HoistingCrane.Entities;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
public class DrawningCraneEqutables : IEqualityComparer<DrawningTrackedVehicle>
|
|
||||||
{
|
|
||||||
public bool Equals(DrawningTrackedVehicle? x, DrawningTrackedVehicle? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTrackedVehicle == null) return false;
|
|
||||||
if (y == null || y.EntityTrackedVehicle == null) return false;
|
|
||||||
if (x.GetType().Name != y.GetType().Name) return false;
|
|
||||||
if (x.EntityTrackedVehicle.Speed != y.EntityTrackedVehicle.Speed) return false;
|
|
||||||
if (x.EntityTrackedVehicle.Weight != y.EntityTrackedVehicle.Weight) return false;
|
|
||||||
if (x.EntityTrackedVehicle.BodyColor != y.EntityTrackedVehicle.BodyColor) return false;
|
|
||||||
if ((x.EntityTrackedVehicle as EntityHoistingCrane)!= null && (y.EntityTrackedVehicle as EntityHoistingCrane)!=null)
|
|
||||||
{
|
|
||||||
var newX = x.EntityTrackedVehicle as EntityHoistingCrane;
|
|
||||||
var newY = y.EntityTrackedVehicle as EntityHoistingCrane;
|
|
||||||
if (newX?.AdditionalColor != newY?.AdditionalColor) return false;
|
|
||||||
if (newX?.Platform != newY?.Platform) return false;
|
|
||||||
if (newX?.Counterweight != newY?.Counterweight) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetHashCode([DisallowNull] DrawningTrackedVehicle obj)
|
|
||||||
{
|
|
||||||
return obj.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
internal class StorageEqutables
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,6 @@ namespace HoistingCrane.Exceptions
|
|||||||
{
|
{
|
||||||
public ObjectIsPresentInTheCollectionException(int objName) : base("В коллекции уже присустствует объект " + objName) { }
|
public ObjectIsPresentInTheCollectionException(int objName) : base("В коллекции уже присустствует объект " + objName) { }
|
||||||
public ObjectIsPresentInTheCollectionException() : base() { }
|
public ObjectIsPresentInTheCollectionException() : base() { }
|
||||||
public ObjectIsPresentInTheCollectionException(string message, Exception exception) : base(message, exception) { }
|
|
||||||
protected ObjectIsPresentInTheCollectionException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
protected ObjectIsPresentInTheCollectionException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,8 +52,6 @@
|
|||||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
loadToolStripMenuItem = new ToolStripMenuItem();
|
||||||
saveFileDialog = new SaveFileDialog();
|
saveFileDialog = new SaveFileDialog();
|
||||||
openFileDialog = new OpenFileDialog();
|
openFileDialog = new OpenFileDialog();
|
||||||
buttonSortByType = new Button();
|
|
||||||
buttonSortByColor = new Button();
|
|
||||||
groupBoxTools.SuspendLayout();
|
groupBoxTools.SuspendLayout();
|
||||||
panelCompanyTool.SuspendLayout();
|
panelCompanyTool.SuspendLayout();
|
||||||
panelStorage.SuspendLayout();
|
panelStorage.SuspendLayout();
|
||||||
@ -70,7 +68,7 @@
|
|||||||
groupBoxTools.Dock = DockStyle.Right;
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
groupBoxTools.Location = new Point(763, 24);
|
groupBoxTools.Location = new Point(763, 24);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
groupBoxTools.Size = new Size(210, 524);
|
groupBoxTools.Size = new Size(210, 499);
|
||||||
groupBoxTools.TabIndex = 0;
|
groupBoxTools.TabIndex = 0;
|
||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструменты";
|
||||||
@ -78,22 +76,20 @@
|
|||||||
// panelCompanyTool
|
// panelCompanyTool
|
||||||
//
|
//
|
||||||
panelCompanyTool.Anchor = AnchorStyles.None;
|
panelCompanyTool.Anchor = AnchorStyles.None;
|
||||||
panelCompanyTool.Controls.Add(buttonSortByColor);
|
|
||||||
panelCompanyTool.Controls.Add(buttonSortByType);
|
|
||||||
panelCompanyTool.Controls.Add(buttonCreateHoistingCrane);
|
panelCompanyTool.Controls.Add(buttonCreateHoistingCrane);
|
||||||
panelCompanyTool.Controls.Add(maskedTextBox);
|
panelCompanyTool.Controls.Add(maskedTextBox);
|
||||||
panelCompanyTool.Controls.Add(buttonRefresh);
|
panelCompanyTool.Controls.Add(buttonRefresh);
|
||||||
panelCompanyTool.Controls.Add(buttonGoToChek);
|
panelCompanyTool.Controls.Add(buttonGoToChek);
|
||||||
panelCompanyTool.Controls.Add(buttonDeleteCar);
|
panelCompanyTool.Controls.Add(buttonDeleteCar);
|
||||||
panelCompanyTool.Location = new Point(6, 296);
|
panelCompanyTool.Location = new Point(6, 319);
|
||||||
panelCompanyTool.Name = "panelCompanyTool";
|
panelCompanyTool.Name = "panelCompanyTool";
|
||||||
panelCompanyTool.Size = new Size(204, 221);
|
panelCompanyTool.Size = new Size(204, 185);
|
||||||
panelCompanyTool.TabIndex = 8;
|
panelCompanyTool.TabIndex = 8;
|
||||||
//
|
//
|
||||||
// buttonCreateHoistingCrane
|
// buttonCreateHoistingCrane
|
||||||
//
|
//
|
||||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonCreateHoistingCrane.Location = new Point(6, 3);
|
buttonCreateHoistingCrane.Location = new Point(9, 13);
|
||||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
||||||
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
||||||
buttonCreateHoistingCrane.TabIndex = 0;
|
buttonCreateHoistingCrane.TabIndex = 0;
|
||||||
@ -104,7 +100,7 @@
|
|||||||
// maskedTextBox
|
// maskedTextBox
|
||||||
//
|
//
|
||||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
maskedTextBox.Location = new Point(6, 31);
|
maskedTextBox.Location = new Point(9, 41);
|
||||||
maskedTextBox.Mask = "00";
|
maskedTextBox.Mask = "00";
|
||||||
maskedTextBox.Name = "maskedTextBox";
|
maskedTextBox.Name = "maskedTextBox";
|
||||||
maskedTextBox.Size = new Size(192, 23);
|
maskedTextBox.Size = new Size(192, 23);
|
||||||
@ -113,7 +109,7 @@
|
|||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonRefresh.Location = new Point(6, 119);
|
buttonRefresh.Location = new Point(9, 129);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(192, 27);
|
buttonRefresh.Size = new Size(192, 27);
|
||||||
buttonRefresh.TabIndex = 5;
|
buttonRefresh.TabIndex = 5;
|
||||||
@ -124,7 +120,7 @@
|
|||||||
// buttonGoToChek
|
// buttonGoToChek
|
||||||
//
|
//
|
||||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonGoToChek.Location = new Point(6, 89);
|
buttonGoToChek.Location = new Point(9, 99);
|
||||||
buttonGoToChek.Name = "buttonGoToChek";
|
buttonGoToChek.Name = "buttonGoToChek";
|
||||||
buttonGoToChek.Size = new Size(192, 24);
|
buttonGoToChek.Size = new Size(192, 24);
|
||||||
buttonGoToChek.TabIndex = 6;
|
buttonGoToChek.TabIndex = 6;
|
||||||
@ -135,7 +131,7 @@
|
|||||||
// buttonDeleteCar
|
// buttonDeleteCar
|
||||||
//
|
//
|
||||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonDeleteCar.Location = new Point(6, 60);
|
buttonDeleteCar.Location = new Point(9, 70);
|
||||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
buttonDeleteCar.Name = "buttonDeleteCar";
|
||||||
buttonDeleteCar.Size = new Size(192, 23);
|
buttonDeleteCar.Size = new Size(192, 23);
|
||||||
buttonDeleteCar.TabIndex = 4;
|
buttonDeleteCar.TabIndex = 4;
|
||||||
@ -145,7 +141,7 @@
|
|||||||
//
|
//
|
||||||
// buttonCreateCompany
|
// buttonCreateCompany
|
||||||
//
|
//
|
||||||
buttonCreateCompany.Location = new Point(12, 267);
|
buttonCreateCompany.Location = new Point(12, 295);
|
||||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||||
buttonCreateCompany.Size = new Size(192, 23);
|
buttonCreateCompany.Size = new Size(192, 23);
|
||||||
buttonCreateCompany.TabIndex = 7;
|
buttonCreateCompany.TabIndex = 7;
|
||||||
@ -165,12 +161,12 @@
|
|||||||
panelStorage.Dock = DockStyle.Top;
|
panelStorage.Dock = DockStyle.Top;
|
||||||
panelStorage.Location = new Point(3, 19);
|
panelStorage.Location = new Point(3, 19);
|
||||||
panelStorage.Name = "panelStorage";
|
panelStorage.Name = "panelStorage";
|
||||||
panelStorage.Size = new Size(204, 216);
|
panelStorage.Size = new Size(204, 229);
|
||||||
panelStorage.TabIndex = 7;
|
panelStorage.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// buttonDeleteCollection
|
// buttonDeleteCollection
|
||||||
//
|
//
|
||||||
buttonDeleteCollection.Location = new Point(9, 186);
|
buttonDeleteCollection.Location = new Point(9, 199);
|
||||||
buttonDeleteCollection.Name = "buttonDeleteCollection";
|
buttonDeleteCollection.Name = "buttonDeleteCollection";
|
||||||
buttonDeleteCollection.Size = new Size(192, 27);
|
buttonDeleteCollection.Size = new Size(192, 27);
|
||||||
buttonDeleteCollection.TabIndex = 6;
|
buttonDeleteCollection.TabIndex = 6;
|
||||||
@ -182,14 +178,14 @@
|
|||||||
//
|
//
|
||||||
listBoxCollection.FormattingEnabled = true;
|
listBoxCollection.FormattingEnabled = true;
|
||||||
listBoxCollection.ItemHeight = 15;
|
listBoxCollection.ItemHeight = 15;
|
||||||
listBoxCollection.Location = new Point(9, 101);
|
listBoxCollection.Location = new Point(9, 118);
|
||||||
listBoxCollection.Name = "listBoxCollection";
|
listBoxCollection.Name = "listBoxCollection";
|
||||||
listBoxCollection.Size = new Size(192, 79);
|
listBoxCollection.Size = new Size(192, 79);
|
||||||
listBoxCollection.TabIndex = 5;
|
listBoxCollection.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// buttonCollectionAdd
|
// buttonCollectionAdd
|
||||||
//
|
//
|
||||||
buttonCollectionAdd.Location = new Point(9, 72);
|
buttonCollectionAdd.Location = new Point(9, 81);
|
||||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||||
buttonCollectionAdd.Size = new Size(192, 23);
|
buttonCollectionAdd.Size = new Size(192, 23);
|
||||||
buttonCollectionAdd.TabIndex = 4;
|
buttonCollectionAdd.TabIndex = 4;
|
||||||
@ -200,7 +196,7 @@
|
|||||||
// radioButtonList
|
// radioButtonList
|
||||||
//
|
//
|
||||||
radioButtonList.AutoSize = true;
|
radioButtonList.AutoSize = true;
|
||||||
radioButtonList.Location = new Point(128, 47);
|
radioButtonList.Location = new Point(128, 56);
|
||||||
radioButtonList.Name = "radioButtonList";
|
radioButtonList.Name = "radioButtonList";
|
||||||
radioButtonList.Size = new Size(66, 19);
|
radioButtonList.Size = new Size(66, 19);
|
||||||
radioButtonList.TabIndex = 3;
|
radioButtonList.TabIndex = 3;
|
||||||
@ -211,7 +207,7 @@
|
|||||||
// radioButtonMassive
|
// radioButtonMassive
|
||||||
//
|
//
|
||||||
radioButtonMassive.AutoSize = true;
|
radioButtonMassive.AutoSize = true;
|
||||||
radioButtonMassive.Location = new Point(12, 47);
|
radioButtonMassive.Location = new Point(18, 56);
|
||||||
radioButtonMassive.Name = "radioButtonMassive";
|
radioButtonMassive.Name = "radioButtonMassive";
|
||||||
radioButtonMassive.Size = new Size(67, 19);
|
radioButtonMassive.Size = new Size(67, 19);
|
||||||
radioButtonMassive.TabIndex = 2;
|
radioButtonMassive.TabIndex = 2;
|
||||||
@ -241,7 +237,7 @@
|
|||||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||||
comboBoxSelectorCompany.Location = new Point(12, 238);
|
comboBoxSelectorCompany.Location = new Point(12, 266);
|
||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||||
comboBoxSelectorCompany.Size = new Size(192, 23);
|
comboBoxSelectorCompany.Size = new Size(192, 23);
|
||||||
comboBoxSelectorCompany.TabIndex = 2;
|
comboBoxSelectorCompany.TabIndex = 2;
|
||||||
@ -252,7 +248,7 @@
|
|||||||
pictureBox.Dock = DockStyle.Fill;
|
pictureBox.Dock = DockStyle.Fill;
|
||||||
pictureBox.Location = new Point(0, 24);
|
pictureBox.Location = new Point(0, 24);
|
||||||
pictureBox.Name = "pictureBox";
|
pictureBox.Name = "pictureBox";
|
||||||
pictureBox.Size = new Size(763, 524);
|
pictureBox.Size = new Size(763, 499);
|
||||||
pictureBox.TabIndex = 1;
|
pictureBox.TabIndex = 1;
|
||||||
pictureBox.TabStop = false;
|
pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -296,33 +292,11 @@
|
|||||||
//
|
//
|
||||||
openFileDialog.Filter = "txt file | *.txt";
|
openFileDialog.Filter = "txt file | *.txt";
|
||||||
//
|
//
|
||||||
// buttonSortByType
|
|
||||||
//
|
|
||||||
buttonSortByType.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonSortByType.Location = new Point(6, 152);
|
|
||||||
buttonSortByType.Name = "buttonSortByType";
|
|
||||||
buttonSortByType.Size = new Size(192, 27);
|
|
||||||
buttonSortByType.TabIndex = 7;
|
|
||||||
buttonSortByType.Text = "Сортировка по типу";
|
|
||||||
buttonSortByType.UseVisualStyleBackColor = true;
|
|
||||||
buttonSortByType.Click += buttonSortByType_Click;
|
|
||||||
//
|
|
||||||
// buttonSortByColor
|
|
||||||
//
|
|
||||||
buttonSortByColor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonSortByColor.Location = new Point(6, 185);
|
|
||||||
buttonSortByColor.Name = "buttonSortByColor";
|
|
||||||
buttonSortByColor.Size = new Size(192, 27);
|
|
||||||
buttonSortByColor.TabIndex = 8;
|
|
||||||
buttonSortByColor.Text = "Сортировка по цвету";
|
|
||||||
buttonSortByColor.UseVisualStyleBackColor = true;
|
|
||||||
buttonSortByColor.Click += buttonSortByColor_Click;
|
|
||||||
//
|
|
||||||
// FormCarCollection
|
// FormCarCollection
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(973, 548);
|
ClientSize = new Size(973, 523);
|
||||||
Controls.Add(pictureBox);
|
Controls.Add(pictureBox);
|
||||||
Controls.Add(groupBoxTools);
|
Controls.Add(groupBoxTools);
|
||||||
Controls.Add(menuStrip);
|
Controls.Add(menuStrip);
|
||||||
@ -367,7 +341,5 @@
|
|||||||
private ToolStripMenuItem loadToolStripMenuItem;
|
private ToolStripMenuItem loadToolStripMenuItem;
|
||||||
private SaveFileDialog saveFileDialog;
|
private SaveFileDialog saveFileDialog;
|
||||||
private OpenFileDialog openFileDialog;
|
private OpenFileDialog openFileDialog;
|
||||||
private Button buttonSortByColor;
|
|
||||||
private Button buttonSortByType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -230,7 +230,7 @@ public partial class FormCarCollection : Form
|
|||||||
_storageCollection.LoadData(openFileDialog.FileName);
|
_storageCollection.LoadData(openFileDialog.FileName);
|
||||||
RerfreshListBoxItems();
|
RerfreshListBoxItems();
|
||||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
logger.LogInformation("Загрузка в файл: {filename}", saveFileDialog.FileName);
|
logger.LogInformation("Загрузка из файла: {filename}", saveFileDialog.FileName.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -240,22 +240,4 @@ public partial class FormCarCollection : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSortByType_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
compareCars(new DrawningCraneCompareByType());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSortByColor_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
compareCars(new DrawningCraneCompareByColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void compareCars(IComparer<DrawningTrackedVehicle?> comparer)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
_company.Sort(comparer);
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
namespace HoistingCrane
|
namespace HoistingCrane;
|
||||||
|
|
||||||
|
internal static class Program
|
||||||
{
|
{
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
@ -37,5 +37,4 @@ namespace HoistingCrane
|
|||||||
.CreateLogger());
|
.CreateLogger());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user