Laba5 KozyrevSS PIbd-21 GasolineTanker Base #6

Closed
Serxionaft wants to merge 1 commits from Laba5 into Laba4
9 changed files with 716 additions and 44 deletions
Showing only changes of commit 117e711ccc - Show all commits

View File

@ -18,5 +18,10 @@ namespace Lab.Entities
Weight = weight;
BodyColor = bodyColor;
}
public void ChangeBodyColor(Color bodyColor)
{
BodyColor = bodyColor;
}
}
}

View File

@ -97,30 +97,34 @@ namespace Lab
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AddTanker(DrawTanker tanker)
{
var obj = _storage[CollectionListBox.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
if (obj + tanker)
{
MessageBox.Show("Объект добавлен");
DrawTank.Image = obj.ShowCars();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void ButtonAddCar_Click(object sender, EventArgs e)
{
if (CollectionListBox.SelectedIndex == -1)
{
return;
}
var obj = _storage[CollectionListBox.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
Frame form = new();
if (form.ShowDialog() == DialogResult.OK)
{
if (obj + form.SelectedCar)
{
MessageBox.Show("Объект добавлен");
DrawTank.Image = obj.ShowCars();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
FormTankerConfig form = new FormTankerConfig();
form.Show();
form.AddEvent(AddTanker);
}
/// <summary>
/// Удаление объекта из набора

View File

@ -12,14 +12,19 @@ namespace Lab.DrawningObjects
public DrawGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool wing, bool sportLine, int width, int height) : base(speed, weight, bodyColor, width, height)
{
if (GasolineTanker != null)
if (_gasolineTanker != null)
{
GasolineTanker = new GasolineTanker(speed, weight, bodyColor, additionalColor, bodyKit, wing, sportLine);
_gasolineTanker = new GasolineTanker(speed, weight, bodyColor, additionalColor, bodyKit, wing, sportLine);
}
}
public void SetAddColor(Color color)
{
(_gasolineTanker as GasolineTanker).ChangeAddColor(color);
}
public override void DrawTransport(Graphics g)
{
if (GasolineTanker is not GasolineTanker Gasoline)
if (_gasolineTanker is not GasolineTanker Gasoline)
return;
base.DrawTransport(g);
if (Gasoline.BodyKit)

View File

@ -11,7 +11,7 @@ namespace Lab.DrawningObjects
{
public class DrawTanker
{
public BaseTanker? GasolineTanker { get; protected set; }
public BaseTanker? _gasolineTanker { get; protected set; }
protected int _pictureWidth;
protected int _pictureHeight;
protected int _startPosX;
@ -25,14 +25,14 @@ namespace Lab.DrawningObjects
public bool CanMove(Direction direction)
{
if (GasolineTanker == null)
if (_gasolineTanker == null)
return false;
return direction switch
{
Direction.Left => _startPosX - GasolineTanker.Step > 0,
Direction.Up => _startPosY - GasolineTanker.Step > 0,
Direction.Right => _startPosX + _carWidth + GasolineTanker.Step < _pictureWidth,
Direction.Down => _startPosY + _carHeight + GasolineTanker.Step < _pictureHeight,
Direction.Left => _startPosX - _gasolineTanker.Step > 0,
Direction.Up => _startPosY - _gasolineTanker.Step > 0,
Direction.Right => _startPosX + _carWidth + _gasolineTanker.Step < _pictureWidth,
Direction.Down => _startPosY + _carHeight + _gasolineTanker.Step < _pictureHeight,
_ => false
};
@ -42,7 +42,7 @@ namespace Lab.DrawningObjects
{
_pictureHeight = height;
_pictureWidth = width;
GasolineTanker = new BaseTanker(speed, weight, bodyColor);
_gasolineTanker = new BaseTanker(speed, weight, bodyColor);
}
public DrawTanker(int speed, double weight, Color bodyColor, int width, int height, int carWidth, int carHeight)
@ -51,7 +51,12 @@ namespace Lab.DrawningObjects
_pictureWidth = width;
_carHeight = carHeight;
_carWidth = carWidth;
GasolineTanker = new BaseTanker(speed, weight, bodyColor);
_gasolineTanker = new BaseTanker(speed, weight, bodyColor);
}
public void SetBaseColor(Color bodyColor)
{
_gasolineTanker.ChangeBodyColor(bodyColor);
}
public void SetPosition(int x, int y)
@ -62,39 +67,39 @@ namespace Lab.DrawningObjects
public void MoveTransport(Direction direction)
{
if (!CanMove(direction) || GasolineTanker == null)
if (!CanMove(direction) || _gasolineTanker == null)
return;
switch (direction)
{
case Direction.Left:
{
if (_startPosX - GasolineTanker.Step > 0)
if (_startPosX - _gasolineTanker.Step > 0)
{
_startPosX -= (int)GasolineTanker.Step;
_startPosX -= (int)_gasolineTanker.Step;
}
}
break;
case Direction.Up:
{
if (_startPosY - GasolineTanker.Step > 0)
if (_startPosY - _gasolineTanker.Step > 0)
{
_startPosY -= (int)GasolineTanker.Step;
_startPosY -= (int)_gasolineTanker.Step;
}
}
break;
case Direction.Right:
{
if (_startPosX + _carWidth + GasolineTanker.Step < _pictureWidth)
if (_startPosX + _carWidth + _gasolineTanker.Step < _pictureWidth)
{
_startPosX += (int)GasolineTanker.Step;
_startPosX += (int)_gasolineTanker.Step;
}
}
break;
case Direction.Down:
{
if (_startPosY + GasolineTanker.Step + _carHeight < _pictureHeight)
if (_startPosY + _gasolineTanker.Step + _carHeight < _pictureHeight)
{
_startPosY += (int)GasolineTanker.Step;
_startPosY += (int)_gasolineTanker.Step;
}
}
break;
@ -103,10 +108,10 @@ namespace Lab.DrawningObjects
public virtual void DrawTransport(Graphics g)
{
if (GasolineTanker == null)
if (_gasolineTanker == null)
return;
Pen pen = new(GasolineTanker.BodyColor, 2);
Brush brush = new SolidBrush(GasolineTanker.BodyColor);
Pen pen = new(_gasolineTanker.BodyColor, 2);
Brush brush = new SolidBrush(_gasolineTanker.BodyColor);
// Отрисовка корпуса
g.FillRectangle(brush, 10 + _startPosX, 40 + _startPosY, 90, 20);

View File

@ -19,12 +19,12 @@ namespace Lab.MovementStrategy
{
get
{
if (_drawTanker == null || _drawTanker.GasolineTanker == null)
if (_drawTanker == null || _drawTanker._gasolineTanker == null)
return null;
return new ObjectParameters(_drawTanker.GetPosX, _drawTanker.GetPosY, _drawTanker.GetWidth, _drawTanker.GetHeight);
}
}
public int GetStep => (int)(_drawTanker?.GasolineTanker?.Step ?? 0);
public int GetStep => (int)(_drawTanker?._gasolineTanker?.Step ?? 0);
public bool CheckCanMove(Direction direction) => _drawTanker?.CanMove(direction) ?? false;
public void MoveObject(Direction direction) => _drawTanker?.MoveTransport(direction);

386
Lab/FormTankerConfig.Designer.cs generated Normal file
View File

@ -0,0 +1,386 @@
namespace Lab
{
partial class FormTankerConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
settingPanel = new Panel();
UpdateLabel = new Label();
BaseLabel = new Label();
label4 = new Label();
panel1 = new Panel();
PurplePanel = new Panel();
BlackPanel = new Panel();
GrayPanel = new Panel();
WhitePanel = new Panel();
YellowPanel = new Panel();
BluePanel = new Panel();
GreenPanel = new Panel();
RedPanel = new Panel();
SportLineCheck = new CheckBox();
WingCheck = new CheckBox();
BodyKitCheck = new CheckBox();
label3 = new Label();
WeightNumeric = new NumericUpDown();
label2 = new Label();
SpeedNumeric = new NumericUpDown();
label1 = new Label();
panel10 = new Panel();
TankerDraw = new PictureBox();
AddColorLabel = new Label();
BaseColorLabel = new Label();
AddButton = new Button();
CancelButton = new Button();
settingPanel.SuspendLayout();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)WeightNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)SpeedNumeric).BeginInit();
panel10.SuspendLayout();
((System.ComponentModel.ISupportInitialize)TankerDraw).BeginInit();
SuspendLayout();
//
// settingPanel
//
settingPanel.Controls.Add(UpdateLabel);
settingPanel.Controls.Add(BaseLabel);
settingPanel.Controls.Add(label4);
settingPanel.Controls.Add(panel1);
settingPanel.Controls.Add(SportLineCheck);
settingPanel.Controls.Add(WingCheck);
settingPanel.Controls.Add(BodyKitCheck);
settingPanel.Controls.Add(label3);
settingPanel.Controls.Add(WeightNumeric);
settingPanel.Controls.Add(label2);
settingPanel.Controls.Add(SpeedNumeric);
settingPanel.Controls.Add(label1);
settingPanel.Location = new Point(10, 11);
settingPanel.Name = "settingPanel";
settingPanel.Size = new Size(638, 305);
settingPanel.TabIndex = 0;
//
// UpdateLabel
//
UpdateLabel.BorderStyle = BorderStyle.FixedSingle;
UpdateLabel.Location = new Point(454, 217);
UpdateLabel.Name = "UpdateLabel";
UpdateLabel.Size = new Size(110, 50);
UpdateLabel.TabIndex = 11;
UpdateLabel.Text = "Продвинутый";
UpdateLabel.TextAlign = ContentAlignment.MiddleCenter;
UpdateLabel.MouseDown += LabelObject_MouseDown;
//
// BaseLabel
//
BaseLabel.BorderStyle = BorderStyle.FixedSingle;
BaseLabel.Location = new Point(321, 217);
BaseLabel.Name = "BaseLabel";
BaseLabel.Size = new Size(110, 50);
BaseLabel.TabIndex = 10;
BaseLabel.Text = "Простой";
BaseLabel.TextAlign = ContentAlignment.MiddleCenter;
BaseLabel.MouseDown += LabelObject_MouseDown;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(321, 25);
label4.Name = "label4";
label4.Size = new Size(42, 20);
label4.TabIndex = 9;
label4.Text = "Цвет";
//
// panel1
//
panel1.Controls.Add(PurplePanel);
panel1.Controls.Add(BlackPanel);
panel1.Controls.Add(GrayPanel);
panel1.Controls.Add(WhitePanel);
panel1.Controls.Add(YellowPanel);
panel1.Controls.Add(BluePanel);
panel1.Controls.Add(GreenPanel);
panel1.Controls.Add(RedPanel);
panel1.Location = new Point(321, 48);
panel1.Name = "panel1";
panel1.Size = new Size(243, 125);
panel1.TabIndex = 8;
panel1.Tag = "";
//
// PurplePanel
//
PurplePanel.BackColor = Color.FromArgb(192, 0, 192);
PurplePanel.Location = new Point(182, 65);
PurplePanel.Name = "PurplePanel";
PurplePanel.Size = new Size(50, 50);
PurplePanel.TabIndex = 1;
//
// BlackPanel
//
BlackPanel.BackColor = Color.Black;
BlackPanel.Location = new Point(126, 65);
BlackPanel.Name = "BlackPanel";
BlackPanel.Size = new Size(50, 50);
BlackPanel.TabIndex = 1;
//
// GrayPanel
//
GrayPanel.BackColor = Color.Gray;
GrayPanel.Location = new Point(70, 65);
GrayPanel.Name = "GrayPanel";
GrayPanel.Size = new Size(50, 50);
GrayPanel.TabIndex = 1;
//
// WhitePanel
//
WhitePanel.BackColor = Color.White;
WhitePanel.Location = new Point(14, 65);
WhitePanel.Name = "WhitePanel";
WhitePanel.Size = new Size(50, 50);
WhitePanel.TabIndex = 1;
//
// YellowPanel
//
YellowPanel.BackColor = Color.Yellow;
YellowPanel.Location = new Point(182, 9);
YellowPanel.Name = "YellowPanel";
YellowPanel.Size = new Size(50, 50);
YellowPanel.TabIndex = 1;
//
// BluePanel
//
BluePanel.BackColor = Color.Blue;
BluePanel.Location = new Point(126, 9);
BluePanel.Name = "BluePanel";
BluePanel.Size = new Size(50, 50);
BluePanel.TabIndex = 1;
//
// GreenPanel
//
GreenPanel.BackColor = Color.FromArgb(0, 192, 0);
GreenPanel.Location = new Point(70, 9);
GreenPanel.Name = "GreenPanel";
GreenPanel.Size = new Size(50, 50);
GreenPanel.TabIndex = 1;
//
// RedPanel
//
RedPanel.BackColor = Color.Red;
RedPanel.Location = new Point(14, 9);
RedPanel.Name = "RedPanel";
RedPanel.Size = new Size(50, 50);
RedPanel.TabIndex = 0;
//
// SportLineCheck
//
SportLineCheck.AutoSize = true;
SportLineCheck.Location = new Point(43, 243);
SportLineCheck.Name = "SportLineCheck";
SportLineCheck.Size = new Size(163, 24);
SportLineCheck.TabIndex = 7;
SportLineCheck.Text = "Гоночные полоски";
SportLineCheck.UseVisualStyleBackColor = true;
//
// WingCheck
//
WingCheck.AutoSize = true;
WingCheck.Location = new Point(43, 196);
WingCheck.Name = "WingCheck";
WingCheck.Size = new Size(90, 24);
WingCheck.TabIndex = 6;
WingCheck.Text = "Мигалка";
WingCheck.UseVisualStyleBackColor = true;
//
// BodyKitCheck
//
BodyKitCheck.AutoSize = true;
BodyKitCheck.Location = new Point(43, 149);
BodyKitCheck.Name = "BodyKitCheck";
BodyKitCheck.Size = new Size(74, 24);
BodyKitCheck.TabIndex = 5;
BodyKitCheck.Text = "Обвес";
BodyKitCheck.UseVisualStyleBackColor = true;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(43, 91);
label3.Name = "label3";
label3.Size = new Size(33, 20);
label3.TabIndex = 4;
label3.Text = "Вес";
//
// WeightNumeric
//
WeightNumeric.Location = new Point(122, 89);
WeightNumeric.Name = "WeightNumeric";
WeightNumeric.Size = new Size(150, 27);
WeightNumeric.TabIndex = 3;
WeightNumeric.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(43, 48);
label2.Name = "label2";
label2.Size = new Size(73, 20);
label2.TabIndex = 2;
label2.Text = "Скорость";
//
// SpeedNumeric
//
SpeedNumeric.Location = new Point(122, 46);
SpeedNumeric.Name = "SpeedNumeric";
SpeedNumeric.Size = new Size(150, 27);
SpeedNumeric.TabIndex = 1;
SpeedNumeric.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(2, 10);
label1.Name = "label1";
label1.Size = new Size(90, 20);
label1.TabIndex = 0;
label1.Text = "Параметры";
//
// panel10
//
panel10.AllowDrop = true;
panel10.Controls.Add(TankerDraw);
panel10.Location = new Point(654, 86);
panel10.Name = "panel10";
panel10.Size = new Size(318, 172);
panel10.TabIndex = 1;
panel10.DragDrop += PanelObject_DragDrop;
panel10.DragEnter += PanelObject_DragEnter;
//
// TankerDraw
//
TankerDraw.Location = new Point(3, 3);
TankerDraw.Name = "TankerDraw";
TankerDraw.Size = new Size(312, 166);
TankerDraw.TabIndex = 14;
TankerDraw.TabStop = false;
//
// AddColorLabel
//
AddColorLabel.AllowDrop = true;
AddColorLabel.BorderStyle = BorderStyle.FixedSingle;
AddColorLabel.Location = new Point(849, 16);
AddColorLabel.Name = "AddColorLabel";
AddColorLabel.Size = new Size(120, 40);
AddColorLabel.TabIndex = 13;
AddColorLabel.Text = "Доп. цвет";
AddColorLabel.TextAlign = ContentAlignment.MiddleCenter;
AddColorLabel.DragDrop += LabelColor_DragDrop;
AddColorLabel.DragEnter += LabelColor_DragEnter;
//
// BaseColorLabel
//
BaseColorLabel.AllowDrop = true;
BaseColorLabel.BorderStyle = BorderStyle.FixedSingle;
BaseColorLabel.Location = new Point(657, 16);
BaseColorLabel.Name = "BaseColorLabel";
BaseColorLabel.Size = new Size(120, 40);
BaseColorLabel.TabIndex = 12;
BaseColorLabel.Text = "Цвет";
BaseColorLabel.TextAlign = ContentAlignment.MiddleCenter;
BaseColorLabel.DragDrop += LabelColor_DragDrop;
BaseColorLabel.DragEnter += LabelColor_DragEnter;
//
// AddButton
//
AddButton.Location = new Point(657, 266);
AddButton.Name = "AddButton";
AddButton.Size = new Size(127, 42);
AddButton.TabIndex = 2;
AddButton.Text = "Добавить";
AddButton.UseVisualStyleBackColor = true;
AddButton.Click += ButtonOk_Click;
//
// CancelButton
//
CancelButton.Location = new Point(842, 266);
CancelButton.Name = "CancelButton";
CancelButton.Size = new Size(127, 42);
CancelButton.TabIndex = 3;
CancelButton.Text = "Отмена";
CancelButton.UseVisualStyleBackColor = true;
//
// FormTankerConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(987, 320);
Controls.Add(CancelButton);
Controls.Add(AddColorLabel);
Controls.Add(AddButton);
Controls.Add(BaseColorLabel);
Controls.Add(panel10);
Controls.Add(settingPanel);
Name = "FormTankerConfig";
Text = "FormTankerConfig";
settingPanel.ResumeLayout(false);
settingPanel.PerformLayout();
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)WeightNumeric).EndInit();
((System.ComponentModel.ISupportInitialize)SpeedNumeric).EndInit();
panel10.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)TankerDraw).EndInit();
ResumeLayout(false);
}
#endregion
private Panel settingPanel;
private Label label3;
private NumericUpDown WeightNumeric;
private Label label2;
private NumericUpDown SpeedNumeric;
private Label label1;
private CheckBox BodyKitCheck;
private CheckBox SportLineCheck;
private CheckBox WingCheck;
private Label label4;
private Panel panel1;
private Panel PurplePanel;
private Panel BlackPanel;
private Panel GrayPanel;
private Panel WhitePanel;
private Panel YellowPanel;
private Panel BluePanel;
private Panel GreenPanel;
private Panel RedPanel;
private Label UpdateLabel;
private Label BaseLabel;
private Panel panel10;
private PictureBox TankerDraw;
private Label AddColorLabel;
private Label BaseColorLabel;
private Button AddButton;
private Button CancelButton;
}
}

144
Lab/FormTankerConfig.cs Normal file
View File

@ -0,0 +1,144 @@
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Lab.DrawningObjects;
using Lab.Entities;
using Lab.Generics;
using Lab.MovementStrategy;
using Lab.Properties;
namespace Lab
{
public partial class FormTankerConfig : Form
{
DrawTanker? _tanker = null;
private event Action<DrawTanker> EventAddTanker;
public FormTankerConfig()
{
InitializeComponent();
BlackPanel.MouseDown += PanelColor_MouseDown;
WhitePanel.MouseDown += PanelColor_MouseDown;
PurplePanel.MouseDown += PanelColor_MouseDown;
YellowPanel.MouseDown += PanelColor_MouseDown;
GreenPanel.MouseDown += PanelColor_MouseDown;
RedPanel.MouseDown += PanelColor_MouseDown;
BluePanel.MouseDown += PanelColor_MouseDown;
GrayPanel.MouseDown += PanelColor_MouseDown;
CancelButton.Click += (s, e) => Close();
}
public void DrawTanker()
{
Bitmap bmp = new(TankerDraw.Width, TankerDraw.Height);
Graphics g = Graphics.FromImage(bmp);
_tanker?.SetPosition(5, 5);
if (_tanker is DrawGasolineTanker drawGasolineTanker)
drawGasolineTanker.DrawTransport(g);
else
_tanker?.DrawTransport(g);
TankerDraw.Image = bmp;
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text).ToString())
{
case "BaseLabel":
_tanker = new DrawTanker((int)SpeedNumeric.Value,
(int)WeightNumeric.Value, Color.White, TankerDraw.Width,
TankerDraw.Height);
break;
case "UpdateLabel":
_tanker = new DrawGasolineTanker((int)SpeedNumeric.Value,
(int)WeightNumeric.Value, Color.White, Color.Black, BodyKitCheck.Checked,
WingCheck.Checked, SportLineCheck.Checked, TankerDraw.Width,
TankerDraw.Height);
break;
}
DrawTanker();
}
public void AddEvent(Action<DrawTanker> ev)
{
if (EventAddTanker == null)
{
EventAddTanker = ev;
}
else
{
EventAddTanker += ev;
}
}
private void ButtonOk_Click(object sender, EventArgs e)
{
EventAddTanker?.Invoke(_tanker);
Close();
}
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
DragDropEffects.Move | DragDropEffects.Copy);
}
private void LabelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void LabelColor_DragDrop(object sender, DragEventArgs e)
{
if (_tanker == null)
return;
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
switch (((Label)sender).Name)
{
case "BaseColorLabel":
_tanker.SetBaseColor((Color)e.Data.GetData(typeof(Color)));
break;
case "AddColorLabel":
if (_tanker is DrawGasolineTanker)
{
(_tanker as DrawGasolineTanker).SetAddColor((Color)e.Data.GetData(typeof(Color)));
}
break;
}
DrawTanker();
}
}
}

120
Lab/FormTankerConfig.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -20,6 +20,9 @@ namespace Lab.Entities
SportLine = sportLine;
}
public void ChangeAddColor(Color color)
{
AdditionalColor = color;
}
}
}