DrawUpdate
This commit is contained in:
parent
3fb85c16dd
commit
ab6ad40fb3
@ -47,7 +47,6 @@ namespace Lab.Generics
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveData(string filename)
|
public bool SaveData(string filename)
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
@ -63,6 +62,7 @@ namespace Lab.Generics
|
|||||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||||
}
|
}
|
||||||
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (data.Length == 0)
|
if (data.Length == 0)
|
||||||
{
|
{
|
||||||
@ -88,23 +88,24 @@ namespace Lab.Generics
|
|||||||
string checker = reader.ReadLine();
|
string checker = reader.ReadLine();
|
||||||
if (checker == null)
|
if (checker == null)
|
||||||
return false;
|
return false;
|
||||||
string strs = reader.ReadLine();
|
|
||||||
if (!checker.StartsWith("CarStorage"))
|
if (!checker.StartsWith("CarStorage"))
|
||||||
return false;
|
return false;
|
||||||
_carStorages.Clear();
|
_carStorages.Clear();
|
||||||
foreach (string data in strs.Split(';'))
|
string strs;
|
||||||
|
bool firstinit = true;
|
||||||
|
while ((strs = reader.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
string[] record = data.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
if (strs == null && firstinit)
|
||||||
if (record.Length != 2)
|
return false;
|
||||||
{
|
if (strs == null )
|
||||||
continue;
|
break;
|
||||||
}
|
firstinit = false;
|
||||||
|
string name = strs.Split('|')[0];
|
||||||
CarsGenericCollection<DrawTanker, DrawingObjectTanker> collection = new(_pictureWidth, _pictureHeight);
|
CarsGenericCollection<DrawTanker, DrawingObjectTanker> collection = new(_pictureWidth, _pictureHeight);
|
||||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
foreach (string data in strs.Split('|')[1].Split(';'))
|
||||||
foreach (string elem in set)
|
|
||||||
{
|
{
|
||||||
DrawTanker? car =
|
DrawTanker? car =
|
||||||
elem?.CreateDrawTanker(_separatorForObject, _pictureWidth, _pictureHeight);
|
data?.CreateDrawTanker(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
if (car != null)
|
if (car != null)
|
||||||
{
|
{
|
||||||
if (!(collection + car))
|
if (!(collection + car))
|
||||||
@ -112,8 +113,10 @@ namespace Lab.Generics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
_carStorages.Add(record[0], collection);
|
_carStorages.Add(name, collection);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
64
Lab/CollectionsFrame.Designer.cs
generated
64
Lab/CollectionsFrame.Designer.cs
generated
@ -43,23 +43,25 @@
|
|||||||
DrawTank = new PictureBox();
|
DrawTank = new PictureBox();
|
||||||
openFileDialog = new OpenFileDialog();
|
openFileDialog = new OpenFileDialog();
|
||||||
saveFileDialog = new SaveFileDialog();
|
saveFileDialog = new SaveFileDialog();
|
||||||
SaveButton = new Button();
|
menuStrip1 = new MenuStrip();
|
||||||
LoadButton = new Button();
|
StripMenu = new ToolStripMenuItem();
|
||||||
|
SaveItem = new ToolStripMenuItem();
|
||||||
|
LoadItem = new ToolStripMenuItem();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
panel2.SuspendLayout();
|
panel2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)DrawTank).BeginInit();
|
((System.ComponentModel.ISupportInitialize)DrawTank).BeginInit();
|
||||||
|
menuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
panel1.Controls.Add(LoadButton);
|
|
||||||
panel1.Controls.Add(SaveButton);
|
|
||||||
panel1.Controls.Add(panel2);
|
panel1.Controls.Add(panel2);
|
||||||
panel1.Controls.Add(UpdateButton);
|
panel1.Controls.Add(UpdateButton);
|
||||||
panel1.Controls.Add(DeleteButton);
|
panel1.Controls.Add(DeleteButton);
|
||||||
panel1.Controls.Add(AddButton);
|
panel1.Controls.Add(AddButton);
|
||||||
panel1.Controls.Add(CarTextBox);
|
panel1.Controls.Add(CarTextBox);
|
||||||
panel1.Controls.Add(label1);
|
panel1.Controls.Add(label1);
|
||||||
|
panel1.Controls.Add(menuStrip1);
|
||||||
panel1.Dock = DockStyle.Right;
|
panel1.Dock = DockStyle.Right;
|
||||||
panel1.Location = new Point(550, 0);
|
panel1.Location = new Point(550, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
@ -164,7 +166,7 @@
|
|||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Location = new Point(2, 2);
|
label1.Location = new Point(144, 0);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(103, 20);
|
label1.Size = new Size(103, 20);
|
||||||
label1.TabIndex = 0;
|
label1.TabIndex = 0;
|
||||||
@ -183,25 +185,36 @@
|
|||||||
//
|
//
|
||||||
openFileDialog.FileName = "openFileDialog1";
|
openFileDialog.FileName = "openFileDialog1";
|
||||||
//
|
//
|
||||||
// SaveButton
|
// menuStrip1
|
||||||
//
|
//
|
||||||
SaveButton.Location = new Point(6, 426);
|
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||||
SaveButton.Name = "SaveButton";
|
menuStrip1.Items.AddRange(new ToolStripItem[] { StripMenu });
|
||||||
SaveButton.Size = new Size(109, 44);
|
menuStrip1.Location = new Point(0, 0);
|
||||||
SaveButton.TabIndex = 6;
|
menuStrip1.Name = "menuStrip1";
|
||||||
SaveButton.Text = "Сохранить";
|
menuStrip1.Size = new Size(250, 28);
|
||||||
SaveButton.UseVisualStyleBackColor = true;
|
menuStrip1.TabIndex = 6;
|
||||||
SaveButton.Click += SaveToolStripMenuItem_Click;
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// LoadButton
|
// StripMenu
|
||||||
//
|
//
|
||||||
LoadButton.Location = new Point(121, 426);
|
StripMenu.DropDownItems.AddRange(new ToolStripItem[] { SaveItem, LoadItem });
|
||||||
LoadButton.Name = "LoadButton";
|
StripMenu.Name = "StripMenu";
|
||||||
LoadButton.Size = new Size(113, 44);
|
StripMenu.Size = new Size(59, 24);
|
||||||
LoadButton.TabIndex = 7;
|
StripMenu.Text = "Файл";
|
||||||
LoadButton.Text = "Загрузить";
|
//
|
||||||
LoadButton.UseVisualStyleBackColor = true;
|
// SaveItem
|
||||||
LoadButton.Click += LoadToolStripMenuItem_Click;
|
//
|
||||||
|
SaveItem.Name = "SaveItem";
|
||||||
|
SaveItem.Size = new Size(224, 26);
|
||||||
|
SaveItem.Text = "Сохранить";
|
||||||
|
SaveItem.Click += SaveToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// LoadItem
|
||||||
|
//
|
||||||
|
LoadItem.Name = "LoadItem";
|
||||||
|
LoadItem.Size = new Size(224, 26);
|
||||||
|
LoadItem.Text = "Загрузить";
|
||||||
|
LoadItem.Click += LoadToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// CollectionsFrame
|
// CollectionsFrame
|
||||||
//
|
//
|
||||||
@ -210,6 +223,7 @@
|
|||||||
ClientSize = new Size(800, 514);
|
ClientSize = new Size(800, 514);
|
||||||
Controls.Add(DrawTank);
|
Controls.Add(DrawTank);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
|
MainMenuStrip = menuStrip1;
|
||||||
Name = "CollectionsFrame";
|
Name = "CollectionsFrame";
|
||||||
Text = "Гаражи бензовозов";
|
Text = "Гаражи бензовозов";
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
@ -217,6 +231,8 @@
|
|||||||
panel2.ResumeLayout(false);
|
panel2.ResumeLayout(false);
|
||||||
panel2.PerformLayout();
|
panel2.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)DrawTank).EndInit();
|
((System.ComponentModel.ISupportInitialize)DrawTank).EndInit();
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +253,9 @@
|
|||||||
private Label label2;
|
private Label label2;
|
||||||
private OpenFileDialog openFileDialog;
|
private OpenFileDialog openFileDialog;
|
||||||
private SaveFileDialog saveFileDialog;
|
private SaveFileDialog saveFileDialog;
|
||||||
private Button LoadButton;
|
private MenuStrip menuStrip1;
|
||||||
private Button SaveButton;
|
private ToolStripMenuItem StripMenu;
|
||||||
|
private ToolStripMenuItem SaveItem;
|
||||||
|
private ToolStripMenuItem LoadItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>344, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -16,14 +16,14 @@ namespace Lab
|
|||||||
if (strs.Length == 3)
|
if (strs.Length == 3)
|
||||||
{
|
{
|
||||||
return new DrawTanker(Convert.ToInt32(strs[0]),
|
return new DrawTanker(Convert.ToInt32(strs[0]),
|
||||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
Convert.ToInt32(strs[1]), Color.FromName(strs[2].Replace("Color [", "").Replace("]", "")), width, height);
|
||||||
}
|
}
|
||||||
if (strs.Length == 7)
|
if (strs.Length == 7)
|
||||||
{
|
{
|
||||||
return new DrawGasolineTanker(Convert.ToInt32(strs[0]),
|
return new DrawGasolineTanker(Convert.ToInt32(strs[0]),
|
||||||
Convert.ToInt32(strs[1]),
|
Convert.ToInt32(strs[1]),
|
||||||
Color.FromName(strs[2]),
|
Color.FromName(strs[2].Replace("Color [", "").Replace("]","")),
|
||||||
Color.FromName(strs[3]),
|
Color.FromName(strs[3].Replace("Color [", "").Replace("]","")),
|
||||||
Convert.ToBoolean(strs[4]),
|
Convert.ToBoolean(strs[4]),
|
||||||
Convert.ToBoolean(strs[5]),
|
Convert.ToBoolean(strs[5]),
|
||||||
Convert.ToBoolean(strs[6]), width, height);
|
Convert.ToBoolean(strs[6]), width, height);
|
||||||
|
4
Lab/FormTankerConfig.Designer.cs
generated
4
Lab/FormTankerConfig.Designer.cs
generated
@ -131,7 +131,7 @@
|
|||||||
//
|
//
|
||||||
// PurplePanel
|
// PurplePanel
|
||||||
//
|
//
|
||||||
PurplePanel.BackColor = Color.FromArgb(192, 0, 192);
|
PurplePanel.BackColor = Color.Purple;
|
||||||
PurplePanel.Location = new Point(182, 65);
|
PurplePanel.Location = new Point(182, 65);
|
||||||
PurplePanel.Name = "PurplePanel";
|
PurplePanel.Name = "PurplePanel";
|
||||||
PurplePanel.Size = new Size(50, 50);
|
PurplePanel.Size = new Size(50, 50);
|
||||||
@ -179,7 +179,7 @@
|
|||||||
//
|
//
|
||||||
// GreenPanel
|
// GreenPanel
|
||||||
//
|
//
|
||||||
GreenPanel.BackColor = Color.FromArgb(0, 192, 0);
|
GreenPanel.BackColor = Color.Green;
|
||||||
GreenPanel.Location = new Point(70, 9);
|
GreenPanel.Location = new Point(70, 9);
|
||||||
GreenPanel.Name = "GreenPanel";
|
GreenPanel.Name = "GreenPanel";
|
||||||
GreenPanel.Size = new Size(50, 50);
|
GreenPanel.Size = new Size(50, 50);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user