From 801a55a24c0f7f86aa60d05448f21c136d72de2d Mon Sep 17 00:00:00 2001 From: "Nikolaeva_Y.A" Date: Mon, 5 Dec 2022 23:08:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B5=D0=BD=D1=8E=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Airbus/FormMapWithSetPlanes.Designer.cs | 66 +++++++++++++++++-- Airbus/Airbus/FormMapWithSetPlanes.cs | 33 ++++------ Airbus/Airbus/FormMapWithSetPlanes.resx | 9 +++ 3 files changed, 82 insertions(+), 26 deletions(-) diff --git a/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs b/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs index d88d944..e36d56d 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.Designer.cs @@ -45,9 +45,16 @@ this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); this.textBoxNewMapName = new System.Windows.Forms.TextBox(); this.pictureBox = new System.Windows.Forms.PictureBox(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.groupBoxTools.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // groupBoxTools @@ -63,9 +70,9 @@ this.groupBoxTools.Controls.Add(this.buttonUp); this.groupBoxTools.Controls.Add(this.groupBox1); this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right; - this.groupBoxTools.Location = new System.Drawing.Point(627, 0); + this.groupBoxTools.Location = new System.Drawing.Point(627, 24); this.groupBoxTools.Name = "groupBoxTools"; - this.groupBoxTools.Size = new System.Drawing.Size(200, 534); + this.groupBoxTools.Size = new System.Drawing.Size(200, 510); this.groupBoxTools.TabIndex = 0; this.groupBoxTools.TabStop = false; this.groupBoxTools.Text = "Инструменты"; @@ -229,12 +236,52 @@ // pictureBox // this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); + this.pictureBox.Location = new System.Drawing.Point(0, 24); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(627, 534); + this.pictureBox.Size = new System.Drawing.Size(627, 510); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(827, 24); + this.menuStrip1.TabIndex = 2; + this.menuStrip1.Text = "menuStrip1"; + // + // ToolStripMenuItem + // + this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.SaveToolStripMenuItem, + this.LoadToolStripMenuItem}); + this.ToolStripMenuItem.Name = "ToolStripMenuItem"; + this.ToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.ToolStripMenuItem.Text = "Файл"; + // + // SaveToolStripMenuItem + // + this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; + this.SaveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.SaveToolStripMenuItem.Text = "Сохранение"; + // + // LoadToolStripMenuItem + // + this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; + this.LoadToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.LoadToolStripMenuItem.Text = "Загрузка"; + // + // openFileDialog + // + this.openFileDialog.FileName = "openFileDialog1"; + this.openFileDialog.Filter = "txt file | *.txt"; + // + // saveFileDialog + // + this.saveFileDialog.Filter = "txt file | *.txt"; + // // FormMapWithSetPlanes // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -242,6 +289,8 @@ this.ClientSize = new System.Drawing.Size(827, 534); this.Controls.Add(this.pictureBox); this.Controls.Add(this.groupBoxTools); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; this.Name = "FormMapWithSetPlanes"; this.Text = "FormMapWithSetPlanes"; this.groupBoxTools.ResumeLayout(false); @@ -249,7 +298,10 @@ this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -272,5 +324,11 @@ private Button buttonAddMap; private Button buttonDeleteMap; private TextBox textBoxNewMapName; + private MenuStrip menuStrip1; + private ToolStripMenuItem ToolStripMenuItem; + private ToolStripMenuItem SaveToolStripMenuItem; + private ToolStripMenuItem LoadToolStripMenuItem; + private OpenFileDialog openFileDialog; + private SaveFileDialog saveFileDialog; } } \ No newline at end of file diff --git a/Airbus/Airbus/FormMapWithSetPlanes.cs b/Airbus/Airbus/FormMapWithSetPlanes.cs index c82c481..5809a98 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.cs @@ -227,30 +227,19 @@ namespace Airbus //обработка нажатия загрузки private void LoadToolStripMenuItem_Click(object sender, EventArgs e) { - // TODO продумать логику по аналогии - } - - //получение данных в виде строки - public string GetData(char separatorType, char separatorData) - { - string data = $"{_map.GetType().Name}{separatorType}"; - - foreach (var plane in _setPlanes.GetAirbus()) + if (saveFileDialog.ShowDialog() == DialogResult.OK) { - data += $"{plane.GetInfo()}{separatorData}"; - } - - return data; - } - - //Загрузка списка из массива строк - public void LoadData(string[] records) - { - foreach (var rec in records) - { - _setPlanes.Insert(DrawningObjectPlane.Create(rec) as T); + if (_mapsCollection.LoadData(openFileDialog.FileName)) + { + MessageBox.Show("Загрузка данных прошла успешно", "Результат", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Ошибка загрузки данных", "Результат", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } - } } \ No newline at end of file diff --git a/Airbus/Airbus/FormMapWithSetPlanes.resx b/Airbus/Airbus/FormMapWithSetPlanes.resx index f298a7b..ddcfdb1 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.resx +++ b/Airbus/Airbus/FormMapWithSetPlanes.resx @@ -57,4 +57,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 132, 17 + + + 272, 17 + \ No newline at end of file