Осталось разобраться с + и вставкой

This commit is contained in:
GokaPek 2023-10-22 18:09:18 +04:00
parent adc8149b7e
commit a98774d0c4
2 changed files with 16 additions and 4 deletions

View File

@ -63,8 +63,16 @@ namespace SelfPropelledArtilleryUnit
{
return;
}
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
if (_SPAUs - pos != null)
int pos;
try {
pos = Convert.ToInt32(maskedTextBoxNumber.Text);
}
catch {
MessageBox.Show("Не удалось удалить объект");
return;
}
if (_SPAUs - pos)
{
MessageBox.Show("Объект удален");
pictureBoxCollection.Image = _SPAUs.ShowSPAUs();

View File

@ -71,14 +71,18 @@ namespace SelfPropelledArtilleryUnit.Generics
/// <param name="collect"></param>
/// <param name="pos"></param>
/// <returns></returns>
public static T? operator -(SPAUGenericCollection<T, U> collect, int pos)
public static bool operator -(SPAUGenericCollection<T, U> collect, int pos)
{
T? obj = collect._collection.Get(pos);
if (obj != null)
{
collect._collection.Remove(pos);
}
return obj;
else
{
return false;
}
return true;
}
/// <summary>
/// Получение объекта IMoveableObject