WarningDell in Logs
This commit is contained in:
parent
7cfdcda5ed
commit
9b337df21c
@ -145,8 +145,7 @@ namespace ElectricLocomotive
|
||||
int pos = Convert.ToInt32(Input.Text);
|
||||
try
|
||||
{
|
||||
var removeObj = obj - pos;
|
||||
if (removeObj != null)
|
||||
if ( obj - pos != null )
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
_logger.LogInformation($"Удален объект с позиции{pos}");
|
||||
@ -155,6 +154,7 @@ namespace ElectricLocomotive
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
_logger.LogWarning($"Не удалось удалить объект из набора {listBoxStorage.SelectedItem.ToString()}");
|
||||
}
|
||||
}
|
||||
catch (LocoNotFoundException ex)
|
||||
|
@ -36,16 +36,14 @@ namespace ProjectElectricLocomotive.Generics
|
||||
_places.Insert(position, loco);
|
||||
return position;
|
||||
}
|
||||
public T? Remove(int position)
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position >= Count || position < 0)
|
||||
return null;
|
||||
|
||||
T? tmp = _places[position];
|
||||
if (tmp == null)
|
||||
if (position < 0 || position >= _places.Count)
|
||||
{
|
||||
throw new LocoNotFoundException(position);
|
||||
_places[position] = null;
|
||||
return tmp;
|
||||
}
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
public T? this[int position]
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user