diff --git a/Sailboat/Sailboat/FormBoatCollection.Designer.cs b/Sailboat/Sailboat/FormBoatCollection.Designer.cs
index 8c18720..7968f58 100644
--- a/Sailboat/Sailboat/FormBoatCollection.Designer.cs
+++ b/Sailboat/Sailboat/FormBoatCollection.Designer.cs
@@ -39,9 +39,16 @@
listBoxStorages = new ListBox();
buttonDelObject = new Button();
buttonAddObject = new Button();
+ menuStrip = new MenuStrip();
+ ToolStripMenuItem = new ToolStripMenuItem();
+ SaveToolStripMenuItem = new ToolStripMenuItem();
+ LoadToolStripMenuItem = new ToolStripMenuItem();
+ openFileDialog = new OpenFileDialog();
+ saveFileDialog = new SaveFileDialog();
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
groupBoxTools.SuspendLayout();
groupBoxCollection.SuspendLayout();
+ menuStrip.SuspendLayout();
SuspendLayout();
//
// pictureBoxCollection
@@ -55,7 +62,7 @@
//
// buttonAddBoat
//
- buttonAddBoat.Location = new Point(5, 345);
+ buttonAddBoat.Location = new Point(5, 402);
buttonAddBoat.Name = "buttonAddBoat";
buttonAddBoat.Size = new Size(197, 45);
buttonAddBoat.TabIndex = 1;
@@ -65,7 +72,7 @@
//
// buttonRemoveBoat
//
- buttonRemoveBoat.Location = new Point(5, 462);
+ buttonRemoveBoat.Location = new Point(5, 486);
buttonRemoveBoat.Name = "buttonRemoveBoat";
buttonRemoveBoat.Size = new Size(197, 45);
buttonRemoveBoat.TabIndex = 2;
@@ -85,7 +92,7 @@
//
// maskedTextBoxNumber
//
- maskedTextBoxNumber.Location = new Point(39, 429);
+ maskedTextBoxNumber.Location = new Point(39, 453);
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
maskedTextBoxNumber.Size = new Size(138, 27);
maskedTextBoxNumber.TabIndex = 4;
@@ -97,6 +104,7 @@
groupBoxTools.Controls.Add(buttonRefreshCollection);
groupBoxTools.Controls.Add(maskedTextBoxNumber);
groupBoxTools.Controls.Add(buttonRemoveBoat);
+ groupBoxTools.Controls.Add(menuStrip);
groupBoxTools.Location = new Point(756, 12);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(209, 588);
@@ -110,7 +118,7 @@
groupBoxCollection.Controls.Add(listBoxStorages);
groupBoxCollection.Controls.Add(buttonDelObject);
groupBoxCollection.Controls.Add(buttonAddObject);
- groupBoxCollection.Location = new Point(6, 26);
+ groupBoxCollection.Location = new Point(6, 75);
groupBoxCollection.Name = "groupBoxCollection";
groupBoxCollection.Size = new Size(196, 299);
groupBoxCollection.TabIndex = 5;
@@ -154,6 +162,46 @@
buttonAddObject.UseVisualStyleBackColor = true;
buttonAddObject.Click += buttonAddObject_Click;
//
+ // menuStrip
+ //
+ menuStrip.ImageScalingSize = new Size(20, 20);
+ menuStrip.Items.AddRange(new ToolStripItem[] { ToolStripMenuItem });
+ menuStrip.Location = new Point(3, 23);
+ menuStrip.Name = "menuStrip";
+ menuStrip.Size = new Size(203, 28);
+ menuStrip.TabIndex = 6;
+ menuStrip.Text = "menuStrip";
+ //
+ // ToolStripMenuItem
+ //
+ ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem });
+ ToolStripMenuItem.Name = "ToolStripMenuItem";
+ ToolStripMenuItem.Size = new Size(59, 24);
+ ToolStripMenuItem.Text = "Файл";
+ //
+ // SaveToolStripMenuItem
+ //
+ SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
+ SaveToolStripMenuItem.Size = new Size(224, 26);
+ SaveToolStripMenuItem.Text = "Сохранение";
+ SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
+ //
+ // LoadToolStripMenuItem
+ //
+ LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
+ LoadToolStripMenuItem.Size = new Size(224, 26);
+ LoadToolStripMenuItem.Text = "Загрузка";
+ LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
+ //
+ // openFileDialog
+ //
+ openFileDialog.FileName = "openFileDialog";
+ openFileDialog.Filter = "txt file | *.txt";
+ //
+ // saveFileDialog
+ //
+ saveFileDialog.Filter = "txt file | *.txt";
+ //
// FormBoatCollection
//
AutoScaleDimensions = new SizeF(8F, 20F);
@@ -168,6 +216,8 @@
groupBoxTools.PerformLayout();
groupBoxCollection.ResumeLayout(false);
groupBoxCollection.PerformLayout();
+ menuStrip.ResumeLayout(false);
+ menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
@@ -185,5 +235,11 @@
private Button buttonDelObject;
private Button buttonAddObject;
private TextBox textBoxStorageName;
+ private MenuStrip menuStrip;
+ private ToolStripMenuItem ToolStripMenuItem;
+ private ToolStripMenuItem SaveToolStripMenuItem;
+ private ToolStripMenuItem LoadToolStripMenuItem;
+ private OpenFileDialog openFileDialog;
+ private SaveFileDialog saveFileDialog;
}
}
\ No newline at end of file
diff --git a/Sailboat/Sailboat/FormBoatCollection.cs b/Sailboat/Sailboat/FormBoatCollection.cs
index 8a14039..ad3b6a0 100644
--- a/Sailboat/Sailboat/FormBoatCollection.cs
+++ b/Sailboat/Sailboat/FormBoatCollection.cs
@@ -148,5 +148,40 @@ namespace Sailboat
ReloadObjects();
}
}
+
+ 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)
+ {
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ if (_storage.LoadData(openFileDialog.FileName))
+ {
+ MessageBox.Show("Загрузка прошла успешно",
+ "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Не загрузилось", "Результат",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ ReloadObjects();
+ }
}
}
diff --git a/Sailboat/Sailboat/FormBoatCollection.resx b/Sailboat/Sailboat/FormBoatCollection.resx
index af32865..2f735f9 100644
--- a/Sailboat/Sailboat/FormBoatCollection.resx
+++ b/Sailboat/Sailboat/FormBoatCollection.resx
@@ -117,4 +117,13 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 480, 17
+
+
+ 608, 17
+
+
+ 778, 17
+
\ No newline at end of file