23 changed files with 1145 additions and 269 deletions
@ -0,0 +1,134 @@ |
|||||
|
namespace ShopWin |
||||
|
{ |
||||
|
partial class ShelfControl |
||||
|
{ |
||||
|
/// <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 Component 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() |
||||
|
{ |
||||
|
this.panel1 = new System.Windows.Forms.Panel(); |
||||
|
this.panel2 = new System.Windows.Forms.Panel(); |
||||
|
this.panel3 = new System.Windows.Forms.Panel(); |
||||
|
this.panel4 = new System.Windows.Forms.Panel(); |
||||
|
this.listView1 = new System.Windows.Forms.ListView(); |
||||
|
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
||||
|
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
||||
|
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
||||
|
this.panel2.SuspendLayout(); |
||||
|
this.panel4.SuspendLayout(); |
||||
|
this.SuspendLayout(); |
||||
|
//
|
||||
|
// panel1
|
||||
|
//
|
||||
|
this.panel1.BackColor = System.Drawing.Color.RosyBrown; |
||||
|
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; |
||||
|
this.panel1.Location = new System.Drawing.Point(0, 157); |
||||
|
this.panel1.Name = "panel1"; |
||||
|
this.panel1.Size = new System.Drawing.Size(710, 10); |
||||
|
this.panel1.TabIndex = 0; |
||||
|
//
|
||||
|
// panel2
|
||||
|
//
|
||||
|
this.panel2.Controls.Add(this.panel3); |
||||
|
this.panel2.Controls.Add(this.panel4); |
||||
|
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
|
this.panel2.Location = new System.Drawing.Point(0, 0); |
||||
|
this.panel2.Name = "panel2"; |
||||
|
this.panel2.Size = new System.Drawing.Size(710, 157); |
||||
|
this.panel2.TabIndex = 1; |
||||
|
//
|
||||
|
// panel3
|
||||
|
//
|
||||
|
this.panel3.BackColor = System.Drawing.Color.RosyBrown; |
||||
|
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
|
this.panel3.Location = new System.Drawing.Point(213, 0); |
||||
|
this.panel3.Name = "panel3"; |
||||
|
this.panel3.Size = new System.Drawing.Size(497, 157); |
||||
|
this.panel3.TabIndex = 2; |
||||
|
//
|
||||
|
// panel4
|
||||
|
//
|
||||
|
this.panel4.Controls.Add(this.listView1); |
||||
|
this.panel4.Dock = System.Windows.Forms.DockStyle.Left; |
||||
|
this.panel4.Location = new System.Drawing.Point(0, 0); |
||||
|
this.panel4.Name = "panel4"; |
||||
|
this.panel4.Size = new System.Drawing.Size(213, 157); |
||||
|
this.panel4.TabIndex = 2; |
||||
|
//
|
||||
|
// listView1
|
||||
|
//
|
||||
|
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { |
||||
|
this.columnHeader1, |
||||
|
this.columnHeader2, |
||||
|
this.columnHeader3}); |
||||
|
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
|
this.listView1.FullRowSelect = true; |
||||
|
this.listView1.GridLines = true; |
||||
|
this.listView1.HideSelection = false; |
||||
|
this.listView1.Location = new System.Drawing.Point(0, 0); |
||||
|
this.listView1.Name = "listView1"; |
||||
|
this.listView1.Size = new System.Drawing.Size(213, 157); |
||||
|
this.listView1.TabIndex = 0; |
||||
|
this.listView1.UseCompatibleStateImageBehavior = false; |
||||
|
this.listView1.View = System.Windows.Forms.View.Details; |
||||
|
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); |
||||
|
//
|
||||
|
// columnHeader1
|
||||
|
//
|
||||
|
this.columnHeader1.Text = "#"; |
||||
|
//
|
||||
|
// columnHeader2
|
||||
|
//
|
||||
|
this.columnHeader2.Text = "Title"; |
||||
|
//
|
||||
|
// columnHeader3
|
||||
|
//
|
||||
|
this.columnHeader3.Text = "Weight"; |
||||
|
//
|
||||
|
// ShelfControl
|
||||
|
//
|
||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
|
this.Controls.Add(this.panel2); |
||||
|
this.Controls.Add(this.panel1); |
||||
|
this.Name = "ShelfControl"; |
||||
|
this.Size = new System.Drawing.Size(710, 167); |
||||
|
this.panel2.ResumeLayout(false); |
||||
|
this.panel4.ResumeLayout(false); |
||||
|
this.ResumeLayout(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
private System.Windows.Forms.Panel panel1; |
||||
|
private System.Windows.Forms.Panel panel2; |
||||
|
private System.Windows.Forms.Panel panel3; |
||||
|
private System.Windows.Forms.Panel panel4; |
||||
|
private System.Windows.Forms.ListView listView1; |
||||
|
private System.Windows.Forms.ColumnHeader columnHeader1; |
||||
|
private System.Windows.Forms.ColumnHeader columnHeader2; |
||||
|
private System.Windows.Forms.ColumnHeader columnHeader3; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,51 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Data; |
||||
|
using System.Diagnostics; |
||||
|
using System.Drawing; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows.Forms; |
||||
|
using ShopWin.Model; |
||||
|
|
||||
|
namespace ShopWin |
||||
|
{ |
||||
|
public partial class ShelfControl : UserControl |
||||
|
{ |
||||
|
private CShelf _shelf; |
||||
|
public ShelfControl() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
|
||||
|
public void Init(CShelf shelf) |
||||
|
{ |
||||
|
_shelf = shelf; |
||||
|
listView1.Tag = _shelf; |
||||
|
} |
||||
|
|
||||
|
public void Refresh() |
||||
|
{ |
||||
|
if (_shelf == null) return; |
||||
|
listView1.Items.Clear(); |
||||
|
for (int index = 0; index < _shelf.ProductList.Count; index++) { |
||||
|
CProduct pGood = _shelf.ProductList[index]; |
||||
|
ListViewItem lvi = listView1.Items.Add((index + 1).ToString(), (index + 1).ToString()); |
||||
|
lvi.SubItems.Add(pGood.Title); |
||||
|
lvi.SubItems.Add(pGood.Weight.ToString()); |
||||
|
lvi.Tag = pGood; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void listView1_SelectedIndexChanged(object sender, EventArgs e) |
||||
|
{ |
||||
|
if (listView1.SelectedItems == null) return; |
||||
|
if (listView1.SelectedItems.Count == 0) return; |
||||
|
CProduct p = (listView1.SelectedItems[0].Tag as CProduct); |
||||
|
if (p == null) return; |
||||
|
Debug.WriteLine(p.Title); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -0,0 +1,59 @@ |
|||||
|
namespace WorkFieldWin |
||||
|
{ |
||||
|
partial class FieldControl |
||||
|
{ |
||||
|
/// <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 Component 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() |
||||
|
{ |
||||
|
this.pictureBox1 = new System.Windows.Forms.PictureBox(); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); |
||||
|
this.SuspendLayout(); |
||||
|
//
|
||||
|
// pictureBox1
|
||||
|
//
|
||||
|
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
|
this.pictureBox1.Location = new System.Drawing.Point(0, 0); |
||||
|
this.pictureBox1.Name = "pictureBox1"; |
||||
|
this.pictureBox1.Size = new System.Drawing.Size(523, 243); |
||||
|
this.pictureBox1.TabIndex = 1; |
||||
|
this.pictureBox1.TabStop = false; |
||||
|
//
|
||||
|
// FieldControl
|
||||
|
//
|
||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
|
this.Controls.Add(this.pictureBox1); |
||||
|
this.Name = "FieldControl"; |
||||
|
this.Size = new System.Drawing.Size(523, 243); |
||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); |
||||
|
this.ResumeLayout(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
private System.Windows.Forms.PictureBox pictureBox1; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System.Windows.Forms; |
||||
|
using WorkField.Model; |
||||
|
|
||||
|
namespace WorkFieldWin |
||||
|
{ |
||||
|
public partial class FieldControl : UserControl |
||||
|
{ |
||||
|
private FieldControlUnit _control; |
||||
|
|
||||
|
public FieldControl() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
|
||||
|
public void Init(CStadium st) |
||||
|
{ |
||||
|
_control = new FieldControlUnit( |
||||
|
pictureBox1.CreateGraphics(), |
||||
|
st); |
||||
|
} |
||||
|
|
||||
|
public void RefreshContent() |
||||
|
{ |
||||
|
_control.Refresh(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -0,0 +1,99 @@ |
|||||
|
using System.Drawing; |
||||
|
using System.Drawing.Drawing2D; |
||||
|
using System.Drawing.Imaging; |
||||
|
using WorkField.Model; |
||||
|
|
||||
|
namespace WorkFieldWin |
||||
|
{ |
||||
|
internal class FieldControlUnit |
||||
|
{ |
||||
|
private Graphics _gr; |
||||
|
private CStadium _st; |
||||
|
private int PlayerWidth = 4; |
||||
|
private double Scale = 1; |
||||
|
private int PlayerHeight = 4; |
||||
|
|
||||
|
|
||||
|
public FieldControlUnit(Graphics gr, CStadium st) |
||||
|
{ |
||||
|
_gr = gr; |
||||
|
_st = st; |
||||
|
} |
||||
|
|
||||
|
private int h_GetX(int X) |
||||
|
{ |
||||
|
return (int)(X * Scale); |
||||
|
} |
||||
|
|
||||
|
private int h_GetY(int Y) |
||||
|
{ |
||||
|
return (int)(Y * Scale); |
||||
|
} |
||||
|
|
||||
|
public void Refresh() |
||||
|
{ |
||||
|
// h_LoadImage();
|
||||
|
h_DrawImage(); |
||||
|
h_refreshPicture(); |
||||
|
} |
||||
|
|
||||
|
private void h_LoadImage() |
||||
|
{ |
||||
|
Bitmap im = new Bitmap("1.bmp"); |
||||
|
Bitmap resizedImage = h_ResizeImage(im, h_GetX(im.Width), h_GetY(im.Height)); |
||||
|
_gr.DrawImage(resizedImage, new Point(h_GetX(0), h_GetY(0))); |
||||
|
} |
||||
|
|
||||
|
private void h_DrawImage() |
||||
|
{ |
||||
|
Bitmap im = new Bitmap( |
||||
|
h_GetX(_st.BlockList.GetWidth()), |
||||
|
h_GetY(_st.BlockList.GetHeight())); |
||||
|
Graphics gr = Graphics.FromImage(im); |
||||
|
|
||||
|
foreach (var pl in _st.BlockList.List) { |
||||
|
if (pl is CFieldBlock) { |
||||
|
gr.DrawEllipse(Pens.GreenYellow, h_GetX(pl.X), h_GetY(pl.Y), h_GetX(PlayerWidth), h_GetY(PlayerHeight)); |
||||
|
} |
||||
|
|
||||
|
if (pl is CWallBlock) { |
||||
|
gr.DrawEllipse(Pens.BlueViolet, h_GetX(pl.X), h_GetY(pl.Y), h_GetX(PlayerWidth), h_GetY(PlayerHeight)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
_gr.DrawImage(im, 0, 0); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private static Bitmap h_ResizeImage(Image image, int width, int height) |
||||
|
{ |
||||
|
var destRect = new Rectangle(0, 0, width, height); |
||||
|
var destImage = new Bitmap(width, height); |
||||
|
|
||||
|
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); |
||||
|
|
||||
|
using (var graphics = Graphics.FromImage(destImage)) { |
||||
|
graphics.CompositingMode = CompositingMode.SourceCopy; |
||||
|
graphics.CompositingQuality = CompositingQuality.HighQuality; |
||||
|
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; |
||||
|
graphics.SmoothingMode = SmoothingMode.HighQuality; |
||||
|
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; |
||||
|
|
||||
|
using (var wrapMode = new ImageAttributes()) { |
||||
|
wrapMode.SetWrapMode(WrapMode.TileFlipXY); |
||||
|
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return destImage; |
||||
|
} |
||||
|
|
||||
|
private void h_refreshPicture() |
||||
|
{ |
||||
|
foreach (CPlayerBlock pl in _st.PlayerList) { |
||||
|
_gr.DrawEllipse(Pens.Brown, h_GetX(pl.X), h_GetY(pl.Y), h_GetX(PlayerWidth), h_GetY(PlayerHeight)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace WorkField.Model |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Блок
|
||||
|
/// </summary>
|
||||
|
public class CBlock |
||||
|
{ |
||||
|
public int X; |
||||
|
public int Y; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace WorkField.Model |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Тип блока
|
||||
|
/// </summary>
|
||||
|
public enum EBlockType |
||||
|
{ |
||||
|
Unknown = 0, |
||||
|
Wall = 1, |
||||
|
Field = 2, |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// БлокСписок
|
||||
|
/// </summary>
|
||||
|
public class CBlockList |
||||
|
{ |
||||
|
public List<CBlock> List; |
||||
|
|
||||
|
/// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary>
|
||||
|
public CBlockList() |
||||
|
{ |
||||
|
List = new List<CBlock>(); |
||||
|
} |
||||
|
|
||||
|
public int GetWidth() |
||||
|
{ |
||||
|
int iMaxX = 0; |
||||
|
foreach (var pB in List) { |
||||
|
if (pB.X > iMaxX) { |
||||
|
iMaxX = pB.X; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return iMaxX; |
||||
|
} |
||||
|
|
||||
|
public int GetHeight() |
||||
|
{ |
||||
|
int iMaxY = 0; |
||||
|
foreach (var pB in List) { |
||||
|
if (pB.Y > iMaxY) { |
||||
|
iMaxY = pB.Y; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return iMaxY; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Ищет элемент в позиции
|
||||
|
/// </summary>
|
||||
|
/// <param name="iX"></param>
|
||||
|
/// <param name="iY"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public CBlock Find(int iX, int iY) |
||||
|
{ |
||||
|
CBlock el = List |
||||
|
.FirstOrDefault(block => |
||||
|
block.X == iX && block.Y == iY); |
||||
|
//CBlock el = null;
|
||||
|
//foreach (CBlock block in List) {
|
||||
|
// if (block.X == iX && block.Y == iY) {
|
||||
|
// el = block;
|
||||
|
// break;
|
||||
|
// }
|
||||
|
//}
|
||||
|
|
||||
|
|
||||
|
return el; |
||||
|
} |
||||
|
|
||||
|
public bool Add(int iX, int iY, EBlockType enType) |
||||
|
{ |
||||
|
CBlock pp = Find(iX, iY); |
||||
|
if (pp != null) { |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
switch (enType) { |
||||
|
case EBlockType.Field: |
||||
|
List.Add(new CFieldBlock() { X = iX, Y = iY }); |
||||
|
break; |
||||
|
case EBlockType.Wall: |
||||
|
List.Add(new CWallBlock() { X = iX, Y = iY }); |
||||
|
break; |
||||
|
case EBlockType.Unknown: |
||||
|
throw new ArgumentOutOfRangeException(nameof(enType), enType, null); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,76 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Drawing; |
|
||||
using System.Linq; |
|
||||
using System.Runtime.Remoting; |
|
||||
using System.Text; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace WorkField.Model |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Стадион
|
|
||||
/// </summary>
|
|
||||
public class CStadium |
|
||||
{ |
|
||||
private System.Threading.Timer _timer; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Ширина
|
|
||||
/// </summary>
|
|
||||
public int Width; |
|
||||
/// <summary>
|
|
||||
/// Длина
|
|
||||
/// </summary>
|
|
||||
public int Height; |
|
||||
/// <summary>
|
|
||||
/// Список работников
|
|
||||
/// </summary>
|
|
||||
public List<CPlayer> PlayerList; |
|
||||
|
|
||||
public CStadium (int width, int height) |
|
||||
{ |
|
||||
Width = width; |
|
||||
Height = height; |
|
||||
PlayerList = new List<CPlayer>(); |
|
||||
|
|
||||
_timer = new Timer(h_tick, null, |
|
||||
new TimeSpan(0, 0, 0, 0, 300), |
|
||||
new TimeSpan(0, 0, 0, 0, 1000) |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
private void h_tick(object x) |
|
||||
{ |
|
||||
this.Move(); |
|
||||
} |
|
||||
|
|
||||
internal void Move() |
|
||||
{ |
|
||||
foreach (CPlayer pPlayer in PlayerList) { |
|
||||
pPlayer.Move(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public bool IsPosition(int newX, int newY) |
|
||||
{ |
|
||||
string sFilename = "1.bmp"; |
|
||||
Bitmap pB = new Bitmap(sFilename); |
|
||||
if (newX < 0) return false; |
|
||||
if (newY < 0) return false; |
|
||||
if (newX > pB.Width) return false; |
|
||||
if (newY > pB.Height) return false; |
|
||||
//for (int xx = 0; xx < pB.Width; xx++) {
|
|
||||
// for (int yy = 0; yy < pB.Height; yy++) {
|
|
||||
Color pColor = pB.GetPixel(newX, newY); |
|
||||
return !(pColor.R == Color.Black.R |
|
||||
&& pColor.G == Color.Black.G |
|
||||
&& pColor.B == Color.Black.B |
|
||||
); |
|
||||
// }
|
|
||||
//}
|
|
||||
return true; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,14 +1,22 @@ |
|||||
Поле с работниками |
Поле с работниками |
||||
|
|
||||
Поле |
Поле |
||||
Ширина |
БлокСписок |
||||
Длина |
РаботникБлок[] |
||||
Работник[] |
|
||||
|
|
||||
Работник |
БлокСписок (контроль уникальности, поиск блока по координатам) |
||||
Фамилия |
Блок[] |
||||
|
|
||||
|
Блок |
||||
X |
X |
||||
Y |
Y |
||||
|
|
||||
|
СтенаБлок: Блок |
||||
|
|
||||
|
ПолеБлок: Блок |
||||
|
|
||||
|
РаботникБлок: Блок |
||||
|
Фамилия |
||||
|
|
||||
|
|
||||
|
|
||||
|
|||||
@ -0,0 +1,10 @@ |
|||||
|
namespace WorkField.Model |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// ПолеБлок
|
||||
|
/// </summary>
|
||||
|
public class CFieldBlock : CBlock |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,86 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Drawing; |
||||
|
using System.Threading; |
||||
|
|
||||
|
namespace WorkField.Model |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Стадион
|
||||
|
/// </summary>
|
||||
|
public class CStadium |
||||
|
{ |
||||
|
private System.Threading.Timer _timer; |
||||
|
private string _mapFilename; |
||||
|
|
||||
|
public CBlockList BlockList; |
||||
|
/// <summary>
|
||||
|
/// Список работников
|
||||
|
/// </summary>
|
||||
|
public List<CPlayerBlock> PlayerList; |
||||
|
|
||||
|
|
||||
|
public CStadium(string sFn) |
||||
|
{ |
||||
|
_mapFilename = sFn; |
||||
|
PlayerList = new List<CPlayerBlock>(); |
||||
|
BlockList = new CBlockList(); |
||||
|
|
||||
|
h_FillField(); |
||||
|
|
||||
|
_timer = new Timer(h_tick, null, |
||||
|
new TimeSpan(0, 0, 0, 0, 300), |
||||
|
new TimeSpan(0, 0, 0, 0, 1000) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
private void h_FillField() |
||||
|
{ |
||||
|
Bitmap pB = new Bitmap(_mapFilename); |
||||
|
for (int xx = 0; xx < pB.Width; xx++) { |
||||
|
for (int yy = 0; yy < pB.Height; yy++) { |
||||
|
Color pColor = pB.GetPixel(xx, yy); |
||||
|
bool isWall = h_IsColor(pColor, Color.Black); |
||||
|
bool isField = !isWall; // h_IsColor(pColor, Color.White);
|
||||
|
if (isWall) BlockList.Add(xx, yy, EBlockType.Wall); |
||||
|
if (isField) BlockList.Add(xx, yy, EBlockType.Field); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static bool h_IsColor(Color pC1, Color pC2) |
||||
|
{ |
||||
|
return pC2.R == pC1.R |
||||
|
&& pC2.G == pC1.G |
||||
|
&& pC2.B == pC1.B; |
||||
|
} |
||||
|
|
||||
|
private void h_tick(object x) |
||||
|
{ |
||||
|
this.Move(); |
||||
|
} |
||||
|
|
||||
|
internal void Move() |
||||
|
{ |
||||
|
foreach (CPlayerBlock pPlayer in PlayerList) { |
||||
|
pPlayer.Move(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public bool IsPosition(int newX, int newY) |
||||
|
{ |
||||
|
CBlock pBlock = BlockList.Find(newX, newY); |
||||
|
if (pBlock == null) return false; |
||||
|
if (pBlock is CWallBlock) return false; |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public void AddNewStandardPlayer() |
||||
|
{ |
||||
|
int iNum = PlayerList.Count + 1; |
||||
|
PlayerList.Add( |
||||
|
new CPlayerBlock($"player{iNum}", |
||||
|
10, 10 + iNum * 2, IsPosition)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
namespace WorkField.Model |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// СтенаБлок
|
||||
|
/// </summary>
|
||||
|
public class CWallBlock : CBlock |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue