Петрушин Егор ПИбд-22 Лабораторная работа №3 "Самоходная артиллерийская установка" #8

Closed
Egor_Petrushin wants to merge 7 commits from PIbd-22_Petrushin_E.A._Lab3 into PIbd-22_Petrushin_E.A._Lab2
2 changed files with 16 additions and 4 deletions
Showing only changes of commit a98774d0c4 - Show all commits

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