Завершено задание преподавателя
This commit is contained in:
parent
2d6108c489
commit
37c182fa78
@ -38,6 +38,11 @@ namespace Trolleybus
|
|||||||
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
|
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (string map in _mapsCollection.Keys)
|
||||||
|
{
|
||||||
|
listBoxMaps.Items.Add(map);
|
||||||
|
}
|
||||||
|
|
||||||
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
|
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
|
||||||
{
|
{
|
||||||
listBoxMaps.SelectedIndex = 0;
|
listBoxMaps.SelectedIndex = 0;
|
||||||
@ -153,7 +158,7 @@ namespace Trolleybus
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -185,23 +190,23 @@ namespace Trolleybus
|
|||||||
}
|
}
|
||||||
//получаем имя кнопки
|
//получаем имя кнопки
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
Direction enums = Direction.None;
|
Direction dir = Direction.None;
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "buttonsUp":
|
case "buttonUp":
|
||||||
enums = Direction.Up;
|
dir = Direction.Up;
|
||||||
break;
|
break;
|
||||||
case "buttonsDown":
|
case "buttonDown":
|
||||||
enums = Direction.Down;
|
dir = Direction.Down;
|
||||||
break;
|
break;
|
||||||
case "buttonsLeft":
|
case "buttonLeft":
|
||||||
enums = Direction.Left;
|
dir = Direction.Left;
|
||||||
break;
|
break;
|
||||||
case "buttonsRight":
|
case "buttonRight":
|
||||||
enums = Direction.Right;
|
dir = Direction.Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(enums);
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user