lab_6 #6

Closed
chtzsch wants to merge 4 commits from lab_6 into lab_5
Showing only changes of commit bc39a6b65d - Show all commits

View File

@ -183,8 +183,7 @@ namespace SpeedBoatLab
{
return;
}
var obj = _storage[storagesListBox.SelectedItem.ToString() ??
string.Empty];
var obj = _storage[storagesListBox.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
@ -199,6 +198,10 @@ namespace SpeedBoatLab
/// <param name="e"></param>
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (storagesListBox.SelectedIndex == -1)
{
return;
}
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if (_storage.SaveData(saveFileDialog.FileName))
@ -222,12 +225,12 @@ namespace SpeedBoatLab
if (_storage.LoadData(saveFileDialog.FileName))
{
ReloadObjects();
MessageBox.Show("Сохранение прошло успешно",
MessageBox.Show("Загрузка прошла успешно",
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Не сохранилось", "Результат",
MessageBox.Show("Не загрузилось", "Результат",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}