Петрушин Егор ПИбд-22 Лабораторная работа №3 "Самоходная артиллерийская установка" #8
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user