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>
/// <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();
@ -81,19 +82,10 @@ 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>
@ -137,13 +129,12 @@ namespace ProjectTank
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString()??string.Empty];
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.No)
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
@ -163,7 +154,8 @@ 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)
{

View File

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

View File

@ -12,8 +12,7 @@ namespace ProjectTank.Generics
/// <summary>
/// Словарь (хранилище)
/// </summary>
readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport,
DrawningObjectArmoredTransport>> _armoredTransportStorages;
readonly Dictionary<string, ArmoredTransportsGenericCollection<DrawningArmoredTransport, DrawningObjectArmoredTransport>> _armoredTransportStorages;
/// <summary>
/// Возвращение списка названий наборов
/// </summary>
@ -33,8 +32,7 @@ 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;
}
@ -44,9 +42,7 @@ 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>
/// Удаление набора