done
This commit is contained in:
parent
80d8e17d1e
commit
685508a162
@ -75,6 +75,8 @@ namespace DumpTruck.DrawningObjects
|
||||
((EntityDumpTruck)EntityCar).AdditionalColor = color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,5 +161,7 @@ width, int height, int carWidth, int carHeight)
|
||||
EntityCar.BodyColor = color;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -42,5 +42,10 @@ namespace DumpTruck.Entities
|
||||
BodyColor = color;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
char _separatorForObject = ':';
|
||||
return $"{Speed}{_separatorForObject}{Weight}{_separatorForObject}{BodyColor.Name}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,13 @@ namespace DumpTruck.Entities
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
char _separatorForObject = ':';
|
||||
return $"{base.ToString()}{_separatorForObject}{AdditionalColor.Name}" +
|
||||
$"{_separatorForObject}{BodyKit}{_separatorForObject}{Tent}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
53
DumpTruck/DumpTruck/ExtentionDrawningCarDop.cs
Normal file
53
DumpTruck/DumpTruck/ExtentionDrawningCarDop.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using DumpTruck.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DumpTruck.Entities;
|
||||
|
||||
namespace DumpTruck
|
||||
{
|
||||
public static class ExtentionDrawningCarDop
|
||||
{
|
||||
public static DrawningCar? CreateDrawningCarDop(this string info, char
|
||||
separatorForObject, int width, int height)
|
||||
{
|
||||
string[] strs = info.Split(separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
{
|
||||
return new DrawningCar(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||
}
|
||||
|
||||
if (strs.Length == 6)
|
||||
{
|
||||
return new DrawningDumpTruck(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 GetDataForSaveDop(this DrawningCar drawningCar,
|
||||
char separatorForObject)
|
||||
{
|
||||
var car = drawningCar.EntityCar;
|
||||
if (car == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var str = car.ToString();
|
||||
if (car is not EntityDumpTruck dumpTruck)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return car.ToString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
22
DumpTruck/DumpTruck/FormCarCollection.Designer.cs
generated
22
DumpTruck/DumpTruck/FormCarCollection.Designer.cs
generated
@ -41,6 +41,7 @@
|
||||
this.listBoxStorages = new System.Windows.Forms.ListBox();
|
||||
this.ButtonAddObject = new System.Windows.Forms.Button();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
@ -170,25 +171,33 @@
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.LoadToolStripMenuItem,
|
||||
this.SaveToolStripMenuItem});
|
||||
this.файлToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(848, 24);
|
||||
this.menuStrip.TabIndex = 2;
|
||||
this.menuStrip.Text = "Файл";
|
||||
//
|
||||
// файлToolStripMenuItem
|
||||
//
|
||||
this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.LoadToolStripMenuItem,
|
||||
this.SaveToolStripMenuItem});
|
||||
this.файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
this.файлToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.файлToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// LoadToolStripMenuItem
|
||||
//
|
||||
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(67, 20);
|
||||
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.LoadToolStripMenuItem.Text = "Загрузка";
|
||||
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||
//
|
||||
// SaveToolStripMenuItem
|
||||
//
|
||||
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(86, 20);
|
||||
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.SaveToolStripMenuItem.Text = "Сохранение";
|
||||
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||
//
|
||||
@ -240,9 +249,10 @@
|
||||
private Button ButtonDelObject_;
|
||||
private TextBox textBoxStorageName;
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
private ToolStripMenuItem файлToolStripMenuItem;
|
||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user