Compare commits

..

No commits in common. "44a4339f45fda2d8ef0481ebe43434298fc09b6e" and "3a5e2daaf1d90b554a34536bdc5d5d9c1c741777" have entirely different histories.

3 changed files with 13 additions and 24 deletions

View File

@ -65,7 +65,8 @@ namespace ProjectTank
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void ListBoxObjects_SelectedIndexChanged(object sender,EventArgs e) private void ListBoxObjects_SelectedIndexChanged(object sender,
EventArgs e)
{ {
pictureBoxCollection.Image = pictureBoxCollection.Image =
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowArmoredTransports(); _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowArmoredTransports();
@ -81,19 +82,10 @@ namespace ProjectTank
{ {
return; 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); _storage.DelSet(listBoxStorages.SelectedItem.ToString()??string.Empty);
ReloadObjects(); ReloadObjects();
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
pictureBoxCollection.Image = obj.ShowArmoredTransports();
} }
} }
/// <summary> /// <summary>
@ -137,13 +129,12 @@ namespace ProjectTank
{ {
return; return;
} }
var obj = _storage[listBoxStorages.SelectedItem.ToString()??string.Empty]; var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null) if (obj == null)
{ {
return; return;
} }
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
MessageBoxIcon.Question) == DialogResult.No)
{ {
return; return;
} }
@ -163,7 +154,8 @@ namespace ProjectTank
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></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) if (listBoxStorages.SelectedIndex == -1)
{ {

View File

@ -123,6 +123,7 @@ namespace ProjectTank.Generics
} }
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth,
_pictureHeight / _placeSizeHeight * _placeSizeHeight); _pictureHeight / _placeSizeHeight * _placeSizeHeight);
} }
} }
/// <summary> /// <summary>
@ -131,7 +132,7 @@ namespace ProjectTank.Generics
/// <param name="g"></param> /// <param name="g"></param>
private void DrawObjects(Graphics g) private void DrawObjects(Graphics g)
{ {
int width = (_pictureWidth / _placeSizeWidth); int width = (_pictureWidth / _placeSizeWidth) / 2;
int height = _pictureHeight / _placeSizeHeight; int height = _pictureHeight / _placeSizeHeight;
int i = 0; int i = 0;
foreach (var armoredTransport in _collection.GetArmoredTrasports()) foreach (var armoredTransport in _collection.GetArmoredTrasports())

View File

@ -12,8 +12,7 @@ namespace ProjectTank.Generics
/// <summary> /// <summary>
/// Словарь (хранилище) /// Словарь (хранилище)
/// </summary> /// </summary>
readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>> _armoredTransportStorages;
DrawningObjectArmoredTransport>> _armoredTransportStorages;
/// <summary> /// <summary>
/// Возвращение списка названий наборов /// Возвращение списка названий наборов
/// </summary> /// </summary>
@ -33,8 +32,7 @@ namespace ProjectTank.Generics
/// <param name="pictureHeight"></param> /// <param name="pictureHeight"></param>
public ArmoredTransportsGenericStorage(int pictureWidth, int pictureHeight) public ArmoredTransportsGenericStorage(int pictureWidth, int pictureHeight)
{ {
_armoredTransportStorages = new Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, _armoredTransportStorages = new Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>>();
DrawningObjectArmoredTransport>>();
_pictureWidth = pictureWidth; _pictureWidth = pictureWidth;
_pictureHeight = pictureHeight; _pictureHeight = pictureHeight;
} }
@ -44,9 +42,7 @@ namespace ProjectTank.Generics
/// <param name="name">Название набора</param> /// <param name="name">Название набора</param>
public void AddSet(string name) public void AddSet(string name)
{ {
_armoredTransportStorages.Add(name, new ArmoredTransportsGenericCollection<DrawningArmoredTransport, _armoredTransportStorages.Add(name, new ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>(_pictureWidth, _pictureHeight));
DrawningObjectArmoredTransport>(_pictureWidth,
_pictureHeight));
} }
/// <summary> /// <summary>
/// Удаление набора /// Удаление набора