готовая лаба 4
This commit is contained in:
parent
bccce47300
commit
00d54fe26c
@ -26,13 +26,13 @@ namespace ProjectExcavator.Generic
|
||||
_pictureHeight = picHeight;
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
public static bool operator +(ExcavatorGenericCollection<T, U> collect, T? obj)
|
||||
public static int operator +(ExcavatorGenericCollection<T, U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
return collect?._collection.Insert(obj) ?? false;
|
||||
return collect?._collection.Insert(obj) ?? -1;
|
||||
}
|
||||
public static T? operator -(ExcavatorGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
|
@ -97,10 +97,10 @@ pictureBoxCollection.Height);
|
||||
{
|
||||
return;
|
||||
}
|
||||
ExcavatorForm form = new();
|
||||
ExcavatorForm form = new ExcavatorForm();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (obj + form.SelectedExcavator)
|
||||
if ((obj + form.SelectedExcavator) != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowExcavator();
|
||||
|
@ -17,14 +17,14 @@ namespace ProjectExcavator.Generic
|
||||
_maxCount = count;
|
||||
_places = new List<T>(_maxCount);
|
||||
}
|
||||
public bool Insert(T excavator)
|
||||
public int Insert(T excavator)
|
||||
{
|
||||
if(_places.Count >= _maxCount)
|
||||
{
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
_places.Insert(0, excavator);
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
public bool Insert(T excavator, int position)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user