diff --git a/ProjectBoat_base/ProjectBoat_bae/ExtentionBoat.cs b/ProjectBoat_base/ProjectBoat_bae/ExtentionBoat.cs index 91c162f..2503329 100644 --- a/ProjectBoat_base/ProjectBoat_bae/ExtentionBoat.cs +++ b/ProjectBoat_base/ProjectBoat_bae/ExtentionBoat.cs @@ -29,7 +29,7 @@ namespace ProjectBoat_bae return new DrawningMotorBoat(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]), Color.FromName(strs[3]), Convert.ToBoolean(strs[4]), - Convert.ToBoolean(strs[5]), Convert.ToInt32(strs[6]), Convert.ToInt32(strs[7])); + Convert.ToBoolean(strs[5]), _pictureWidth, _pictureHeight); } return null; } diff --git a/ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs b/ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs index fb7f02e..fa76869 100644 --- a/ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs +++ b/ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs @@ -184,23 +184,33 @@ namespace ProjectBoat_bae private void LoadToolStripMenu_Click(object sender, EventArgs args) { + //if (openFileDialog.ShowDialog() == DialogResult.OK) + //{ + // if (_storage.LoadData(openFileDialog.FileName)) + // { + // MessageBox.Show("Загрузка прошла успешно", + // "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + // foreach (var collection in _storage.Keys) + // { + // listBoxStorages.Items.Add(collection); + // } + // } + // else + // { + // MessageBox.Show("Не удалось загрузить", "Результат", + // MessageBoxButtons.OK, MessageBoxIcon.Error); + // } + //} + if (openFileDialog.ShowDialog() == DialogResult.OK) { if (_storage.LoadData(openFileDialog.FileName)) - { - MessageBox.Show("Загрузка прошла успешно", - "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); - foreach (var collection in _storage.Keys) - { - listBoxStorages.Items.Add(collection); - } - } + MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); else - { - MessageBox.Show("Не удалось загрузить", "Результат", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } + MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); } + + ReloadObjects(); } } } diff --git a/ProjectBoat_base/ProjectBoat_bae/Generics/BoatsGenericStorage.cs b/ProjectBoat_base/ProjectBoat_bae/Generics/BoatsGenericStorage.cs index 3e62279..a3e16a5 100644 --- a/ProjectBoat_base/ProjectBoat_bae/Generics/BoatsGenericStorage.cs +++ b/ProjectBoat_base/ProjectBoat_bae/Generics/BoatsGenericStorage.cs @@ -90,7 +90,7 @@ namespace ProjectBoat_bae.Generics { return false; } - if (!str.StartsWith("PlaneStorage")) + if (!str.StartsWith("BoatStorage")) { return false; } @@ -114,10 +114,10 @@ namespace ProjectBoat_bae.Generics string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries); foreach (string elem in set) { - Drawningboat? plane = elem?.CreateDrawningBoat(_separatorForObject, _pictureWidth, _pictureHeight); - if (plane != null) + Drawningboat? boat = elem?.CreateDrawningBoat(_separatorForObject, _pictureWidth, _pictureHeight); + if (boat != null) { - if (!(collection + plane)) + if (!(collection + boat)) { return false; }