From 2f82585838bc06c2a500a794b9d566d4e28f7a24 Mon Sep 17 00:00:00 2001 From: "Pyatkin I.A" <4234.sunrise.234@gmail.com> Date: Fri, 24 Nov 2023 14:14:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B5=D1=81=D1=82=D0=B0=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BB=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExcavatorGenericCollection.cs | 1 + .../ExcavatorGenericStorage.cs | 97 +++++++ .../ExtentionDrawingExcavator.cs | 65 +++++ .../FormExcavatorCollection.Designer.cs | 262 +++++++++++------- .../FormExcavatorCollection.cs | 57 ++++ 5 files changed, 379 insertions(+), 103 deletions(-) create mode 100644 ProjectExcavator/ProjectExcavator/ExtentionDrawingExcavator.cs diff --git a/ProjectExcavator/ProjectExcavator/ExcavatorGenericCollection.cs b/ProjectExcavator/ProjectExcavator/ExcavatorGenericCollection.cs index 2c60978..7eddf6b 100644 --- a/ProjectExcavator/ProjectExcavator/ExcavatorGenericCollection.cs +++ b/ProjectExcavator/ProjectExcavator/ExcavatorGenericCollection.cs @@ -42,6 +42,7 @@ namespace ProjectExcavator.Generics /// /// /// + public IEnumerable GetExcavators => _collection.GetExcavators(); public ExcavatorGenericCollection(int picWidth, int picHeight) { int width = picWidth / _placeSizeWidth; diff --git a/ProjectExcavator/ProjectExcavator/ExcavatorGenericStorage.cs b/ProjectExcavator/ProjectExcavator/ExcavatorGenericStorage.cs index 996d492..5e66d0e 100644 --- a/ProjectExcavator/ProjectExcavator/ExcavatorGenericStorage.cs +++ b/ProjectExcavator/ProjectExcavator/ExcavatorGenericStorage.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using ProjectExcavator.DrawingObjects; +using ProjectExcavator.Generics; using ProjectExcavator.MovementStrategy; namespace ProjectExcavator.Generics @@ -35,6 +36,18 @@ namespace ProjectExcavator.Generics /// /// /// + /// + /// Разделитель для записи ключа и значения элемента словаря + /// + private static readonly char _separatorForKeyValue = '|'; + /// + /// Разделитель для записей коллекции данных в файл + /// + private readonly char _separatorRecords = ';'; + /// + /// Разделитель для записи информации по объекту в файл + /// + private static readonly char _separatorForObject = ':'; public ExcavatorGenericStorage(int pictureWidth, int pictureHeight) { _excavatorStorages = new Dictionary + /// Сохранение информации по экскаваторам в хранилище в файл + /// + /// Путь и имя файла + /// true - сохранение прошло успешно, false - ошибка при сохранении данных + public bool SaveData(string filename) + { + if (File.Exists(filename)) + { + File.Delete(filename); + } + StringBuilder data = new(); + foreach (KeyValuePair> record in _excavatorStorages) + { + StringBuilder records = new(); + foreach (DrawingExcavator? elem in record.Value.GetExcavators) + { + records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}"); + } + data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}"); + } + if (data.Length == 0) + { + return false; + } + using (StreamWriter writer = new StreamWriter(filename)) + { + writer.WriteLine("excavatorStorages"); + writer.Write(data.ToString()); + return true; + } + } + /// + /// Загрузка информации по экскаваторам в хранилище из файла + /// + /// Путь и имя файла + /// true - загрузка прошла успешно, false - ошибка при загрузке данных + public bool LoadData(string filename) + { + if (!File.Exists(filename)) + { + return false; + } + + using (StreamReader reader = new StreamReader(filename)) + { + string proverkaline = reader.ReadLine(); + if (proverkaline == null || !proverkaline.StartsWith("excavatorStorages")) + { + return false; + } + + _excavatorStorages.Clear(); + + string line; + while ((line = reader.ReadLine()) != null) + { + string[] parts = line.Split('|'); + if (parts.Length != 2) + { + return false; + } + + string namestorage = parts[0]; + ExcavatorGenericCollection collection = new(_pictureWidth, _pictureHeight); + + foreach (string data in parts[1].Split(';')) + { + DrawingExcavator? excavator = data?.CreateDrawingExcavator(_separatorForObject, _pictureWidth, _pictureHeight); + if (excavator != null) + { + if (!(collection + excavator)) + { + return false; + } + } + } + + _excavatorStorages.Add(namestorage, collection); + } + return true; + } + } } } diff --git a/ProjectExcavator/ProjectExcavator/ExtentionDrawingExcavator.cs b/ProjectExcavator/ProjectExcavator/ExtentionDrawingExcavator.cs new file mode 100644 index 0000000..591a090 --- /dev/null +++ b/ProjectExcavator/ProjectExcavator/ExtentionDrawingExcavator.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectExcavator.Entities; + +namespace ProjectExcavator.DrawingObjects +{ + /// + /// Расширение для класса EntityEx + /// + public static class ExtentionDrawingExcavator + { + /// + /// Создание объекта из строки + /// + /// Строка с данными для создания объекта + /// Разделитель даннных + /// Ширина + /// Высота + /// Объект + public static DrawingExcavator? CreateDrawingExcavator(this string info, char + separatorForObject, int width, int height) + { + string[] strs = info.Split(separatorForObject); + if (strs.Length == 3) + { + return new DrawingExcavator(Convert.ToInt32(strs[0]), + Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height); + } + if (strs.Length == 6) + { + return new DrawingExcavatorKovsh(Convert.ToInt32(strs[0]), + Convert.ToInt32(strs[1]), + Color.FromName(strs[2]), + Color.FromName(strs[3]), + Convert.ToBoolean(strs[4]), + Convert.ToBoolean(strs[5]), width, height); + } + return null; + } + /// + /// Получение данных для сохранения в файл + /// + /// Сохраняемый объект + /// Разделитель даннных + /// Строка с данными по объекту + public static string GetDataForSave(this DrawingExcavator drawingExcavator, char separatorForObject) + { + var excavator = drawingExcavator.EntityExcavator; + if (excavator == null) + { + return string.Empty; + } + var str = $"{excavator.Speed}{separatorForObject}{excavator.Weight}{separatorForObject}{excavator.BodyColor.Name}"; + if (excavator is not EntityExcavatorKovsh excavatorKovsh) + { + return str; + } + return $"{str}{separatorForObject}{excavatorKovsh.AdditionalColor.Name}{separatorForObject}{excavatorKovsh.Kovsh}{separatorForObject}{excavatorKovsh.Katki}"; + } + + } +} diff --git a/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs b/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs index a038e1d..2e53e0e 100644 --- a/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs +++ b/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.Designer.cs @@ -28,145 +28,195 @@ /// private void InitializeComponent() { - this.pictureBoxCollection = new System.Windows.Forms.PictureBox(); - this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox(); - this.buttonAddEx = new System.Windows.Forms.Button(); - this.buttonRemoveEx = new System.Windows.Forms.Button(); - this.buttonRefreshCollection = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.textBoxStorageName = new System.Windows.Forms.TextBox(); - this.buttonDelObject = new System.Windows.Forms.Button(); - this.listBoxStorages = new System.Windows.Forms.ListBox(); - this.buttonAddObject = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); + pictureBoxCollection = new PictureBox(); + maskedTextBoxNumber = new MaskedTextBox(); + buttonAddEx = new Button(); + buttonRemoveEx = new Button(); + buttonRefreshCollection = new Button(); + groupBox1 = new GroupBox(); + groupBox2 = new GroupBox(); + textBoxStorageName = new TextBox(); + buttonDelObject = new Button(); + listBoxStorages = new ListBox(); + buttonAddObject = new Button(); + FilemenuStrip = new MenuStrip(); + FileToolStripMenuItem = new ToolStripMenuItem(); + SaveToolStripMenuItem = new ToolStripMenuItem(); + LoadToolStripMenuItem = new ToolStripMenuItem(); + openFileDialog = new OpenFileDialog(); + saveFileDialog = new SaveFileDialog(); + ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit(); + groupBox1.SuspendLayout(); + groupBox2.SuspendLayout(); + FilemenuStrip.SuspendLayout(); + SuspendLayout(); // // pictureBoxCollection // - this.pictureBoxCollection.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0); - this.pictureBoxCollection.Name = "pictureBoxCollection"; - this.pictureBoxCollection.Size = new System.Drawing.Size(909, 461); - this.pictureBoxCollection.TabIndex = 0; - this.pictureBoxCollection.TabStop = false; + pictureBoxCollection.Dock = DockStyle.Fill; + pictureBoxCollection.Location = new Point(0, 24); + pictureBoxCollection.Name = "pictureBoxCollection"; + pictureBoxCollection.Size = new Size(909, 437); + pictureBoxCollection.TabIndex = 0; + pictureBoxCollection.TabStop = false; // // maskedTextBoxNumber // - this.maskedTextBoxNumber.Location = new System.Drawing.Point(35, 339); - this.maskedTextBoxNumber.Name = "maskedTextBoxNumber"; - this.maskedTextBoxNumber.Size = new System.Drawing.Size(100, 23); - this.maskedTextBoxNumber.TabIndex = 1; + maskedTextBoxNumber.Location = new Point(35, 339); + maskedTextBoxNumber.Name = "maskedTextBoxNumber"; + maskedTextBoxNumber.Size = new Size(100, 23); + maskedTextBoxNumber.TabIndex = 1; // // buttonAddEx // - this.buttonAddEx.Location = new System.Drawing.Point(13, 310); - this.buttonAddEx.Name = "buttonAddEx"; - this.buttonAddEx.Size = new System.Drawing.Size(150, 23); - this.buttonAddEx.TabIndex = 2; - this.buttonAddEx.Text = "Добавить экскаватор"; - this.buttonAddEx.UseVisualStyleBackColor = true; - this.buttonAddEx.Click += new System.EventHandler(this.ButtonAddEx_Click); + buttonAddEx.Location = new Point(13, 310); + buttonAddEx.Name = "buttonAddEx"; + buttonAddEx.Size = new Size(150, 23); + buttonAddEx.TabIndex = 2; + buttonAddEx.Text = "Добавить экскаватор"; + buttonAddEx.UseVisualStyleBackColor = true; + buttonAddEx.Click += ButtonAddEx_Click; // // buttonRemoveEx // - this.buttonRemoveEx.Location = new System.Drawing.Point(13, 368); - this.buttonRemoveEx.Name = "buttonRemoveEx"; - this.buttonRemoveEx.Size = new System.Drawing.Size(150, 23); - this.buttonRemoveEx.TabIndex = 3; - this.buttonRemoveEx.Text = "Удалить экскаватор"; - this.buttonRemoveEx.UseVisualStyleBackColor = true; - this.buttonRemoveEx.Click += new System.EventHandler(this.ButtonRemoveEx_Click); + buttonRemoveEx.Location = new Point(13, 368); + buttonRemoveEx.Name = "buttonRemoveEx"; + buttonRemoveEx.Size = new Size(150, 23); + buttonRemoveEx.TabIndex = 3; + buttonRemoveEx.Text = "Удалить экскаватор"; + buttonRemoveEx.UseVisualStyleBackColor = true; + buttonRemoveEx.Click += ButtonRemoveEx_Click; // // buttonRefreshCollection // - this.buttonRefreshCollection.Location = new System.Drawing.Point(13, 432); - this.buttonRefreshCollection.Name = "buttonRefreshCollection"; - this.buttonRefreshCollection.Size = new System.Drawing.Size(148, 23); - this.buttonRefreshCollection.TabIndex = 4; - this.buttonRefreshCollection.Text = "Обновить коллекцию"; - this.buttonRefreshCollection.UseVisualStyleBackColor = true; - this.buttonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click); + buttonRefreshCollection.Location = new Point(13, 432); + buttonRefreshCollection.Name = "buttonRefreshCollection"; + buttonRefreshCollection.Size = new Size(148, 23); + buttonRefreshCollection.TabIndex = 4; + buttonRefreshCollection.Text = "Обновить коллекцию"; + buttonRefreshCollection.UseVisualStyleBackColor = true; + buttonRefreshCollection.Click += ButtonRefreshCollection_Click; // // groupBox1 // - this.groupBox1.Controls.Add(this.groupBox2); - this.groupBox1.Controls.Add(this.buttonAddEx); - this.groupBox1.Controls.Add(this.buttonRefreshCollection); - this.groupBox1.Controls.Add(this.maskedTextBoxNumber); - this.groupBox1.Controls.Add(this.buttonRemoveEx); - this.groupBox1.Location = new System.Drawing.Point(741, 0); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(168, 461); - this.groupBox1.TabIndex = 5; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Инструменты"; + groupBox1.Controls.Add(groupBox2); + groupBox1.Controls.Add(buttonAddEx); + groupBox1.Controls.Add(buttonRefreshCollection); + groupBox1.Controls.Add(maskedTextBoxNumber); + groupBox1.Controls.Add(buttonRemoveEx); + groupBox1.Location = new Point(741, 0); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(168, 461); + groupBox1.TabIndex = 5; + groupBox1.TabStop = false; + groupBox1.Text = "Инструменты"; // // groupBox2 // - this.groupBox2.Controls.Add(this.textBoxStorageName); - this.groupBox2.Controls.Add(this.buttonDelObject); - this.groupBox2.Controls.Add(this.listBoxStorages); - this.groupBox2.Controls.Add(this.buttonAddObject); - this.groupBox2.Location = new System.Drawing.Point(13, 28); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(143, 214); - this.groupBox2.TabIndex = 5; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Наборы"; + groupBox2.Controls.Add(textBoxStorageName); + groupBox2.Controls.Add(buttonDelObject); + groupBox2.Controls.Add(listBoxStorages); + groupBox2.Controls.Add(buttonAddObject); + groupBox2.Location = new Point(13, 28); + groupBox2.Name = "groupBox2"; + groupBox2.Size = new Size(143, 214); + groupBox2.TabIndex = 5; + groupBox2.TabStop = false; + groupBox2.Text = "Наборы"; // // textBoxStorageName // - this.textBoxStorageName.Location = new System.Drawing.Point(15, 30); - this.textBoxStorageName.Name = "textBoxStorageName"; - this.textBoxStorageName.Size = new System.Drawing.Size(122, 23); - this.textBoxStorageName.TabIndex = 6; + textBoxStorageName.Location = new Point(15, 30); + textBoxStorageName.Name = "textBoxStorageName"; + textBoxStorageName.Size = new Size(122, 23); + textBoxStorageName.TabIndex = 6; // // buttonDelObject // - this.buttonDelObject.Location = new System.Drawing.Point(15, 185); - this.buttonDelObject.Name = "buttonDelObject"; - this.buttonDelObject.Size = new System.Drawing.Size(122, 23); - this.buttonDelObject.TabIndex = 8; - this.buttonDelObject.Text = "Удалить набор"; - this.buttonDelObject.UseVisualStyleBackColor = true; - this.buttonDelObject.Click += new System.EventHandler(this.ButtonDelObject_Click); + buttonDelObject.Location = new Point(15, 185); + buttonDelObject.Name = "buttonDelObject"; + buttonDelObject.Size = new Size(122, 23); + buttonDelObject.TabIndex = 8; + buttonDelObject.Text = "Удалить набор"; + buttonDelObject.UseVisualStyleBackColor = true; + buttonDelObject.Click += ButtonDelObject_Click; // // listBoxStorages // - this.listBoxStorages.FormattingEnabled = true; - this.listBoxStorages.ItemHeight = 15; - this.listBoxStorages.Location = new System.Drawing.Point(15, 88); - this.listBoxStorages.Name = "listBoxStorages"; - this.listBoxStorages.Size = new System.Drawing.Size(122, 79); - this.listBoxStorages.TabIndex = 6; - this.listBoxStorages.Click += new System.EventHandler(this.ListBoxObjects_SelectedIndexChanged); + listBoxStorages.FormattingEnabled = true; + listBoxStorages.ItemHeight = 15; + listBoxStorages.Location = new Point(15, 88); + listBoxStorages.Name = "listBoxStorages"; + listBoxStorages.Size = new Size(122, 79); + listBoxStorages.TabIndex = 6; + listBoxStorages.Click += ListBoxObjects_SelectedIndexChanged; // // buttonAddObject // - this.buttonAddObject.Location = new System.Drawing.Point(15, 59); - this.buttonAddObject.Name = "buttonAddObject"; - this.buttonAddObject.Size = new System.Drawing.Size(122, 23); - this.buttonAddObject.TabIndex = 7; - this.buttonAddObject.Text = "Добавить набор"; - this.buttonAddObject.UseVisualStyleBackColor = true; - this.buttonAddObject.Click += new System.EventHandler(this.ButtonAddObject_Click); + buttonAddObject.Location = new Point(15, 59); + buttonAddObject.Name = "buttonAddObject"; + buttonAddObject.Size = new Size(122, 23); + buttonAddObject.TabIndex = 7; + buttonAddObject.Text = "Добавить набор"; + buttonAddObject.UseVisualStyleBackColor = true; + buttonAddObject.Click += ButtonAddObject_Click; + // + // FilemenuStrip + // + FilemenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem }); + FilemenuStrip.Location = new Point(0, 0); + FilemenuStrip.Name = "FilemenuStrip"; + FilemenuStrip.Size = new Size(909, 24); + FilemenuStrip.TabIndex = 6; + FilemenuStrip.Text = "menuStrip1"; + // + // FileToolStripMenuItem + // + FileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem }); + FileToolStripMenuItem.Name = "FileToolStripMenuItem"; + FileToolStripMenuItem.Size = new Size(48, 20); + FileToolStripMenuItem.Text = "Файл"; + // + // SaveToolStripMenuItem + // + SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; + SaveToolStripMenuItem.Size = new Size(133, 22); + SaveToolStripMenuItem.Text = "Сохранить"; + SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; + // + // LoadToolStripMenuItem + // + LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; + LoadToolStripMenuItem.Size = new Size(133, 22); + LoadToolStripMenuItem.Text = "Загрузить"; + LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; + // + // openFileDialog + // + openFileDialog.FileName = "openFileDialog"; + openFileDialog.Filter = "\"txt file|*.txt|Все файлы|*.*\"."; + // + // saveFileDialog + // + saveFileDialog.Filter = "\"txt file|*.txt|Все файлы|*.*\"."; // // FormExcavatorCollection // - this.ClientSize = new System.Drawing.Size(909, 461); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.pictureBoxCollection); - this.Name = "FormExcavatorCollection"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - + ClientSize = new Size(909, 461); + Controls.Add(groupBox1); + Controls.Add(pictureBoxCollection); + Controls.Add(FilemenuStrip); + MainMenuStrip = FilemenuStrip; + Name = "FormExcavatorCollection"; + ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit(); + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + groupBox2.ResumeLayout(false); + groupBox2.PerformLayout(); + FilemenuStrip.ResumeLayout(false); + FilemenuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } #endregion @@ -182,5 +232,11 @@ private Button buttonDelObject; private ListBox listBoxStorages; private Button buttonAddObject; + private MenuStrip FilemenuStrip; + private ToolStripMenuItem FileToolStripMenuItem; + private ToolStripMenuItem SaveToolStripMenuItem; + private ToolStripMenuItem LoadToolStripMenuItem; + private OpenFileDialog openFileDialog; + private SaveFileDialog saveFileDialog; } } \ No newline at end of file diff --git a/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs b/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs index 2c6cca7..828aa94 100644 --- a/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs +++ b/ProjectExcavator/ProjectExcavator/FormExcavatorCollection.cs @@ -2,6 +2,8 @@ using ProjectExcavator.Generics; using ProjectExcavator.MovementStrategy; using ProjectExcavator.Excavators; +using System.Windows.Forms; + namespace ProjectExcavator { /// @@ -182,5 +184,60 @@ namespace ProjectExcavator } pictureBoxCollection.Image = obj.ShowExcavator(); } + /// + /// Обработка нажатия "Сохранение" + /// + /// + /// + private void SaveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storage.SaveData(saveFileDialog.FileName)) + { + MessageBox.Show("Сохранение прошло успешно", + "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Не сохранилось", "Результат", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + /// + /// Обработка нажатия "Загрузка" + /// + /// + /// + private void LoadToolStripMenuItem_Click(object sender, EventArgs e) + { + // TODO продумать логику + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storage.LoadData(openFileDialog.FileName)) + { + MessageBox.Show("Загрузка прошла успешно", + "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + ReloadObjects(); + if (listBoxStorages.SelectedIndex == -1) + { + return; + } + var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? + string.Empty]; + if (obj == null) + { + return; + } + pictureBoxCollection.Image = obj.ShowExcavator(); + } + else + { + MessageBox.Show("Не загрузилось", "Результат", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } }