Compare commits
2 Commits
3a5e2daaf1
...
44a4339f45
Author | SHA1 | Date | |
---|---|---|---|
44a4339f45 | |||
a7f0b62f08 |
@ -65,8 +65,7 @@ namespace ProjectTank
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ListBoxObjects_SelectedIndexChanged(object sender,
|
||||
EventArgs e)
|
||||
private void ListBoxObjects_SelectedIndexChanged(object sender,EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowArmoredTransports();
|
||||
@ -82,10 +81,19 @@ namespace ProjectTank
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show($"Удалить объект{listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes){
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString()??string.Empty);
|
||||
ReloadObjects();
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBoxCollection.Image = obj.ShowArmoredTransports();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -134,7 +142,8 @@ namespace ProjectTank
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -154,8 +163,7 @@ namespace ProjectTank
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs
|
||||
e)
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
|
@ -123,7 +123,6 @@ namespace ProjectTank.Generics
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth,
|
||||
_pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -132,7 +131,7 @@ namespace ProjectTank.Generics
|
||||
/// <param name="g"></param>
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
int width = (_pictureWidth / _placeSizeWidth) / 2;
|
||||
int width = (_pictureWidth / _placeSizeWidth);
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
int i = 0;
|
||||
foreach (var armoredTransport in _collection.GetArmoredTrasports())
|
||||
|
@ -12,7 +12,8 @@ namespace ProjectTank.Generics
|
||||
/// <summary>
|
||||
/// Словарь (хранилище)
|
||||
/// </summary>
|
||||
readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>> _armoredTransportStorages;
|
||||
readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport,
|
||||
DrawningObjectArmoredTransport>> _armoredTransportStorages;
|
||||
/// <summary>
|
||||
/// Возвращение списка названий наборов
|
||||
/// </summary>
|
||||
@ -32,7 +33,8 @@ namespace ProjectTank.Generics
|
||||
/// <param name="pictureHeight"></param>
|
||||
public ArmoredTransportsGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_armoredTransportStorages = new Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>>();
|
||||
_armoredTransportStorages = new Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport,
|
||||
DrawningObjectArmoredTransport>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
@ -42,7 +44,9 @@ namespace ProjectTank.Generics
|
||||
/// <param name="name">Название набора</param>
|
||||
public void AddSet(string name)
|
||||
{
|
||||
_armoredTransportStorages.Add(name, new ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>(_pictureWidth, _pictureHeight));
|
||||
_armoredTransportStorages.Add(name, new ArmoredTransportsGenericCollection<DrawningArmoredTransport,
|
||||
DrawningObjectArmoredTransport>(_pictureWidth,
|
||||
_pictureHeight));
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление набора
|
||||
|
Loading…
Reference in New Issue
Block a user