From d65e45ef3463ca0e8b046eb420f23d6324f2ae8d Mon Sep 17 00:00:00 2001 From: ILYAkuznetsov73 <148066069+ILYAkuznetsov73@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:20:13 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=B0=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCompany.cs | 2 +- .../ICollectionGenericObjects.cs | 13 +- .../ListGenericObjects.cs | 28 +++- .../MassiveGenericObjects.cs | 17 ++- .../StorageCollection.cs | 126 +++++++++++++++++- .../Drawings/DrawingGasolineTanker.cs | 6 + .../Drawings/DrawingTanker.cs | 4 + .../Drawings/ExtentionDrawingTanker.cs | 53 ++++++++ .../Entities/EntityGasolineTanker.cs | 31 +++-- .../Entities/EntityTanker.cs | 13 ++ .../FormTankerCollection.Designer.cs | 81 +++++++++-- .../FormTankerCollection.cs | 31 +++++ .../FormTankerCollection.resx | 12 ++ 13 files changed, 386 insertions(+), 31 deletions(-) create mode 100644 ProjectGasolineTanker/ProjectGasolineTanker/Drawings/ExtentionDrawingTanker.cs diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/AbstractCompany.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/AbstractCompany.cs index 0549301..6eb2517 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/AbstractCompany.cs @@ -51,7 +51,7 @@ public abstract class AbstractCompany _pictureWidth = picWidth; _pictureHeight = picHeight; _collection = collection; - _collection.SetMaxCount = GetMaxCount; + _collection.MaxCount = GetMaxCount; } /// diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ICollectionGenericObjects.cs index 1c71a8c..56dd8b0 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -21,7 +21,7 @@ public interface ICollectionGenericObjects /// /// Установка максимального количества элементов /// - int SetMaxCount { set; } + int MaxCount { get; set; } /// /// Добавление объекта в коллекцию @@ -51,4 +51,15 @@ public interface ICollectionGenericObjects /// Позиция /// Объект T? Get(int position); + + /// + /// Получение типа коллекции + /// + CollectionType GetCollectionType { get; } + + /// + /// Получение объектов коллекции по одному + /// + /// Поэлементый вывод элементов коллекции + IEnumerable GetItems(); } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ListGenericObjects.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ListGenericObjects.cs index c0f6f45..86a38e5 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ListGenericObjects.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/ListGenericObjects.cs @@ -21,8 +21,6 @@ public class ListGenericObjects : ICollectionGenericObjects public int Count => _collection.Count; - public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } } - /// /// Конструктор /// @@ -31,6 +29,24 @@ public class ListGenericObjects : ICollectionGenericObjects _collection = new(); } + public CollectionType GetCollectionType => CollectionType.List; + + public int MaxCount + { + get + { + return _maxCount; + } + + set + { + if (value > 0) + { + _maxCount = value; + } + } + } + public T? Get(int position) { if (position >= Count || position < 0) @@ -66,4 +82,12 @@ public class ListGenericObjects : ICollectionGenericObjects _collection.RemoveAt(position); return temp; } + + public IEnumerable GetItems() + { + for (int i = 0; i < _collection.Count; ++i) + { + yield return _collection[i]; + } + } } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs index bf37cd7..c019d95 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/MassiveGenericObjects.cs @@ -16,8 +16,13 @@ public class MassiveGenericObjects : ICollectionGenericObjects public int Count => _collection.Length; - public int SetMaxCount + public int MaxCount { + get + { + return _collection.Length; + } + set { if (value > 0) @@ -34,6 +39,8 @@ public class MassiveGenericObjects : ICollectionGenericObjects } } + public CollectionType GetCollectionType => CollectionType.Massive; + /// /// Конструктор /// @@ -112,4 +119,12 @@ public class MassiveGenericObjects : ICollectionGenericObjects _collection[position] = null; return temp; } + + public IEnumerable GetItems() + { + for (int i = 0; i < _collection.Length; ++i) + { + yield return _collection[i]; + } + } } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/StorageCollection.cs b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/StorageCollection.cs index 65351f5..b3abe18 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/StorageCollection.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/CollectionGenericObjects/StorageCollection.cs @@ -1,4 +1,5 @@ -using System; +using ProjectGasolineTanker.Drawings; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,7 +8,7 @@ using System.Threading.Tasks; namespace ProjectGasolineTanker.CollectionGenericObjects; public class StorageCollection - where T : class + where T : DrawingTanker { /// /// Словарь (хранилище) с коллекциями @@ -19,6 +20,21 @@ public class StorageCollection /// public List Keys => _storages.Keys.ToList(); + /// + /// Ключевое слово, с которого должен начинаться файл + /// + private readonly string _collectionKey = "CollectionsStorage"; + + /// + /// Разделитель для записи ключа и значения элемента словаря + /// + private readonly string _separatorForKeyValue = "|"; + + /// + /// Разделитель для записей коллекции данных в файл + /// + private readonly string _separatorItems = ";"; + /// /// Конструктор /// @@ -75,4 +91,110 @@ public class StorageCollection return _storages[name]; } } + + public bool SaveData(string filename) + { + if (_storages.Count == 0) + return false; + + if (File.Exists(filename)) + File.Delete(filename); + + using FileStream fs = new(filename, FileMode.Create); + using StreamWriter sw = new StreamWriter(fs); + sw.Write(_collectionKey); + foreach (KeyValuePair> value in _storages) + { + sw.Write(Environment.NewLine); + if (value.Value.Count == 0) + { + continue; + } + + sw.Write(value.Key); + sw.Write(_separatorForKeyValue); + sw.Write(value.Value.GetCollectionType); + sw.Write(_separatorForKeyValue); + sw.Write(value.Value.MaxCount); + sw.Write(_separatorForKeyValue); + + foreach (T? item in value.Value.GetItems()) + { + string data = item?.GetDataForSave() ?? string.Empty; + if (string.IsNullOrEmpty(data)) + { + continue; + } + + sw.Write(data); + sw.Write(_separatorItems); + } + } + return true; + } + + public bool LoadData(string filename) + { + if (!File.Exists(filename)) + { + return false; + } + + using (FileStream fs = new(filename, FileMode.Open)) + { + using StreamReader sr = new StreamReader(fs); + + string str = sr.ReadLine(); + if (str == null || str.Length == 0) + { + return false; + } + + if (!str.Equals(_collectionKey)) + { + return false; + } + _storages.Clear(); + + while (!sr.EndOfStream) + { + string[] record = sr.ReadLine().Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries); + if (record.Length != 4) + { + continue; + } + + CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]); + ICollectionGenericObjects? collection = StorageCollection.CreateCollection(collectionType); + if (collection == null) + { + return false; + } + + collection.MaxCount = Convert.ToInt32(record[2]); + + string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); + foreach (string elem in set) + { + if (elem?.CreateDrawingTanker() is T airplane) + { + if (collection.Insert(airplane) == -1) + return false; + } + } + _storages.Add(record[0], collection); + } + } + return true; + } + + private static ICollectionGenericObjects? CreateCollection(CollectionType collectionType) + { + return collectionType switch + { + CollectionType.Massive => new MassiveGenericObjects(), + CollectionType.List => new ListGenericObjects(), + _ => null, + }; + } } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs index 97b8d07..bfa87cc 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs @@ -21,6 +21,12 @@ public class DrawingGasolineTanker : DrawingTanker EntityTanker = new EntityGasolineTanker(speed, weight, bodyColor, additionalColor, tank, ornamentWheels); } + public DrawingGasolineTanker(EntityTanker? tanker) : base(tanker) + { + if (tanker != null) + EntityTanker = tanker; + } + public override void DrawTransport(Graphics g) { if (EntityTanker == null || EntityTanker is not EntityGasolineTanker tanker || !_startPosX.HasValue || !_startPosY.HasValue) diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingTanker.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingTanker.cs index 84e09f2..e963abb 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingTanker.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/DrawingTanker.cs @@ -85,6 +85,10 @@ public class DrawingTanker EntityTanker = new EntityTanker(speed, weight, bodyColor); } + public DrawingTanker(EntityTanker? tanker) : this() + { + EntityTanker = tanker; + } /// /// Конструктор для наследников /// diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/ExtentionDrawingTanker.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/ExtentionDrawingTanker.cs new file mode 100644 index 0000000..1378f92 --- /dev/null +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Drawings/ExtentionDrawingTanker.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectGasolineTanker.Entities; + +namespace ProjectGasolineTanker.Drawings; + +public static class ExtentionDrawingTanker +{ + /// + /// Разделитель для записи информации по объекту в файл + /// + private static readonly string _separatorForObject = ":"; + + /// + /// Создание объекта из строки + /// + /// Строка с данными для создания объекта + /// Объект + public static DrawingTanker? CreateDrawingTanker(this string info) + { + string[] strs = info.Split(_separatorForObject); + EntityTanker? tanker = EntityGasolineTanker.CreateEntityGasolineTanker(strs); + + if (tanker != null) + { + return new DrawingGasolineTanker(tanker); + } + + tanker = EntityTanker.CreateEntityTanker(strs); + + if (tanker != null) + { + return new DrawingTanker(tanker); + } + + return null; + } + + public static string GetDataForSave(this DrawingTanker drawingTanker) + { + string[]? array = drawingTanker?.EntityTanker?.GetStringRepresentation(); + + if (array == null) + { + return string.Empty; + } + + return string.Join(_separatorForObject, array); + } +} diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityGasolineTanker.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityGasolineTanker.cs index 970b01f..4ff1d55 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityGasolineTanker.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityGasolineTanker.cs @@ -1,4 +1,5 @@ using System.Drawing; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace ProjectGasolineTanker.Entities { @@ -26,20 +27,24 @@ namespace ProjectGasolineTanker.Entities /// public bool OrnamentWheels { get; private set; } - /// - /// Инициализация полей объекта-класса газовоза - /// - /// Скорость - /// Вес газовоза - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия цистерны - /// Признак наличия украшенных колес - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool tank, bool ornamentWheels) + public override string[] GetStringRepresentation() { - AdditionalColor = additionalColor; - Tank = tank; - OrnamentWheels = ornamentWheels; + return new[] { nameof(EntityGasolineTanker), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, Tank.ToString(), OrnamentWheels.ToString() }; + } + + /// + /// Создание объекта из массива строк + /// + /// + /// + public static EntityGasolineTanker? CreateEntityGasolineTanker(string[] strs) + { + if (strs.Length != 7 || strs[0] != nameof(EntityGasolineTanker)) + return null; + + return new EntityGasolineTanker(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), + Color.FromName(strs[3]), Color.FromName(strs[4]), + Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6])); } public void SetAdditionalColor(Color additionalColor) diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityTanker.cs b/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityTanker.cs index f946206..906e299 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityTanker.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/Entities/EntityTanker.cs @@ -49,5 +49,18 @@ public class EntityTanker { BodyColor = bodyColor; } + + public virtual string[] GetStringRepresentation() + { + return new[] { nameof(EntityTanker), Speed.ToString(), Weight.ToString(), BodyColor.Name }; + } + + public static EntityTanker? CreateEntityTanker(string[] strs) + { + if (strs.Length != 4 || strs[0] != nameof(EntityTanker)) + return null; + + return new EntityTanker(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3])); + } } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs index 40d1b67..8fc59f6 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.Designer.cs @@ -46,10 +46,17 @@ labelCollectionName = new Label(); comboBoxSelectorCompany = new ComboBox(); pictureBox = new PictureBox(); + menuStrip = new MenuStrip(); + файлToolStripMenuItem = new ToolStripMenuItem(); + saveToolStripMenuItem = new ToolStripMenuItem(); + loadToolStripMenuItem = new ToolStripMenuItem(); + saveFileDialog = new SaveFileDialog(); + openFileDialog = new OpenFileDialog(); groupBoxTools.SuspendLayout(); panelCompanyTools.SuspendLayout(); panelStorage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + menuStrip.SuspendLayout(); SuspendLayout(); // // groupBoxTools @@ -59,9 +66,9 @@ groupBoxTools.Controls.Add(panelStorage); groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Dock = DockStyle.Right; - groupBoxTools.Location = new Point(1222, 0); + groupBoxTools.Location = new Point(1222, 33); groupBoxTools.Name = "groupBoxTools"; - groupBoxTools.Size = new Size(258, 810); + groupBoxTools.Size = new Size(258, 784); groupBoxTools.TabIndex = 0; groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; @@ -75,9 +82,9 @@ panelCompanyTools.Controls.Add(buttonDelTanker); panelCompanyTools.Dock = DockStyle.Bottom; panelCompanyTools.Enabled = false; - panelCompanyTools.Location = new Point(3, 456); + panelCompanyTools.Location = new Point(3, 463); panelCompanyTools.Name = "panelCompanyTools"; - panelCompanyTools.Size = new Size(252, 351); + panelCompanyTools.Size = new Size(252, 318); panelCompanyTools.TabIndex = 2; // // buttonAddTanker @@ -94,7 +101,7 @@ // buttonRefresh // buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonRefresh.Location = new Point(13, 268); + buttonRefresh.Location = new Point(13, 237); buttonRefresh.Name = "buttonRefresh"; buttonRefresh.Size = new Size(226, 55); buttonRefresh.TabIndex = 6; @@ -104,7 +111,7 @@ // // maskedTextBox1 // - maskedTextBox1.Location = new Point(13, 109); + maskedTextBox1.Location = new Point(13, 78); maskedTextBox1.Mask = "00"; maskedTextBox1.Name = "maskedTextBox1"; maskedTextBox1.Size = new Size(230, 31); @@ -114,7 +121,7 @@ // buttonGoToCheck // buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonGoToCheck.Location = new Point(13, 207); + buttonGoToCheck.Location = new Point(13, 176); buttonGoToCheck.Name = "buttonGoToCheck"; buttonGoToCheck.Size = new Size(230, 55); buttonGoToCheck.TabIndex = 5; @@ -125,7 +132,7 @@ // buttonDelTanker // buttonDelTanker.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonDelTanker.Location = new Point(13, 146); + buttonDelTanker.Location = new Point(13, 115); buttonDelTanker.Name = "buttonDelTanker"; buttonDelTanker.Size = new Size(230, 55); buttonDelTanker.TabIndex = 4; @@ -240,19 +247,62 @@ // pictureBox // pictureBox.Dock = DockStyle.Fill; - pictureBox.Location = new Point(0, 0); + pictureBox.Location = new Point(0, 33); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(1222, 810); + pictureBox.Size = new Size(1222, 784); pictureBox.TabIndex = 1; pictureBox.TabStop = false; // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(24, 24); + menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(1480, 33); + menuStrip.TabIndex = 2; + menuStrip.Text = "menuStrip"; + // + // файлToolStripMenuItem + // + файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem }); + файлToolStripMenuItem.Name = "файлToolStripMenuItem"; + файлToolStripMenuItem.Size = new Size(69, 29); + файлToolStripMenuItem.Text = "Файл"; + // + // saveToolStripMenuItem + // + saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; + saveToolStripMenuItem.Size = new Size(273, 34); + saveToolStripMenuItem.Text = "Сохранение"; + saveToolStripMenuItem.Click += saveToolStripMenuItem_Click; + // + // loadToolStripMenuItem + // + loadToolStripMenuItem.Name = "loadToolStripMenuItem"; + loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L; + loadToolStripMenuItem.Size = new Size(273, 34); + loadToolStripMenuItem.Text = "Загрузка"; + loadToolStripMenuItem.Click += loadToolStripMenuItem_Click; + // + // saveFileDialog + // + saveFileDialog.Filter = "txt file | *.txt"; + // + // openFileDialog + // + openFileDialog.Filter = "txt file | *.txt"; + // // FormTankerCollection // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1480, 810); + ClientSize = new Size(1480, 817); Controls.Add(pictureBox); Controls.Add(groupBoxTools); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; Name = "FormTankerCollection"; Text = "Коллекция Грузовиков"; groupBoxTools.ResumeLayout(false); @@ -261,7 +311,10 @@ panelStorage.ResumeLayout(false); panelStorage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -284,5 +337,11 @@ private Button buttonCollectionDel; private ListBox listBoxCollection; private Panel panelCompanyTools; + private MenuStrip menuStrip; + private ToolStripMenuItem файлToolStripMenuItem; + private ToolStripMenuItem saveToolStripMenuItem; + private ToolStripMenuItem loadToolStripMenuItem; + private SaveFileDialog saveFileDialog; + private OpenFileDialog openFileDialog; } } \ No newline at end of file diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs index 5d5c885..8f697ef 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs +++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.cs @@ -216,4 +216,35 @@ public partial class FormTankerCollection : Form panelCompanyTools.Enabled = true; RefreshListBoxItems(); } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.SaveData(saveFileDialog.FileName)) + { + MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void loadToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.LoadData(openFileDialog.FileName)) + { + MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + RefreshListBoxItems(); + } + else + { + MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } diff --git a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx index af32865..37c7fa4 100644 --- a/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx +++ b/ProjectGasolineTanker/ProjectGasolineTanker/FormTankerCollection.resx @@ -117,4 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 165, 17 + + + 355, 17 + + + 57 + \ No newline at end of file