Добавлено контекстное меню для параметров
This commit is contained in:
parent
a7e5c55a5d
commit
ed5ef49236
@ -1,6 +1,6 @@
|
|||||||
namespace GtaVUsersInfo.Controls
|
namespace GtaVUsersInfo.Controls
|
||||||
{
|
{
|
||||||
partial class CarItem
|
partial class CarControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обязательная переменная конструктора.
|
/// Обязательная переменная конструктора.
|
@ -8,7 +8,7 @@ using GtaVUsersInfo.Helpers;
|
|||||||
|
|
||||||
namespace GtaVUsersInfo.Controls
|
namespace GtaVUsersInfo.Controls
|
||||||
{
|
{
|
||||||
public partial class CarItem : UserControl
|
public partial class CarControl : UserControl
|
||||||
{
|
{
|
||||||
private static readonly HttpClient httpClient = new HttpClient();
|
private static readonly HttpClient httpClient = new HttpClient();
|
||||||
private Car car;
|
private Car car;
|
||||||
@ -24,8 +24,7 @@ namespace GtaVUsersInfo.Controls
|
|||||||
set { ContextMenuStrip = value; }
|
set { ContextMenuStrip = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CarControl(Car carItem)
|
||||||
public CarItem(Car carItem)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -17,9 +17,9 @@ namespace GtaVUsersInfo.Controls
|
|||||||
get { return myMenuStrip; }
|
get { return myMenuStrip; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public CarItem Car;
|
public CarControl Car;
|
||||||
|
|
||||||
public CarItemMenuStrip(EventHandler add, EventHandler edit, EventHandler delete, CarItem car)
|
public CarItemMenuStrip(EventHandler add, EventHandler edit, EventHandler delete, CarControl car)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@ namespace GtaVUsersInfo.Controls
|
|||||||
set { Textbox.Text = value.ToString(); }
|
set { Textbox.Text = value.ToString(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContextMenuStrip MenuStrip
|
||||||
|
{
|
||||||
|
get { return ContextMenuStrip; }
|
||||||
|
set { ContextMenuStrip = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public ParameterControl(string name, string text = "")
|
public ParameterControl(string name, string text = "")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
74
Controls/ParameterItemMenuStrip.Designer.cs
generated
Normal file
74
Controls/ParameterItemMenuStrip.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
namespace GtaVUsersInfo.Controls
|
||||||
|
{
|
||||||
|
partial class ParameterItemMenuStrip
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.myMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.addNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.myMenuStrip.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// myMenuStrip
|
||||||
|
//
|
||||||
|
this.myMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.addNewToolStripMenuItem,
|
||||||
|
this.deleteToolStripMenuItem});
|
||||||
|
this.myMenuStrip.Name = "contextMenuStrip";
|
||||||
|
this.myMenuStrip.Size = new System.Drawing.Size(181, 70);
|
||||||
|
//
|
||||||
|
// addNewToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.addNewToolStripMenuItem.Name = "addNewToolStripMenuItem";
|
||||||
|
this.addNewToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.addNewToolStripMenuItem.Text = "Создать";
|
||||||
|
//
|
||||||
|
// deleteToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||||
|
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.deleteToolStripMenuItem.Text = "Удалить";
|
||||||
|
//
|
||||||
|
// ParameterPanelMenuStrip
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Name = "ParameterPanelMenuStrip";
|
||||||
|
this.myMenuStrip.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ContextMenuStrip myMenuStrip;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem addNewToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
35
Controls/ParameterItemMenuStrip.cs
Normal file
35
Controls/ParameterItemMenuStrip.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GtaVUsersInfo.Controls
|
||||||
|
{
|
||||||
|
public partial class ParameterItemMenuStrip : UserControl
|
||||||
|
{
|
||||||
|
public ContextMenuStrip Menu
|
||||||
|
{
|
||||||
|
get { return myMenuStrip; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParameterControl Parameter;
|
||||||
|
|
||||||
|
public ParameterItemMenuStrip(EventHandler add, EventHandler delete, ParameterControl parameter)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
addNewToolStripMenuItem.Click += add;
|
||||||
|
deleteToolStripMenuItem.Click += delete;
|
||||||
|
|
||||||
|
Parameter = parameter;
|
||||||
|
|
||||||
|
addNewToolStripMenuItem.Tag = this;
|
||||||
|
deleteToolStripMenuItem.Tag = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
Controls/ParameterItemMenuStrip.resx
Normal file
123
Controls/ParameterItemMenuStrip.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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>
|
||||||
|
<metadata name="myMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
65
Controls/ParameterPanelMenuStrip.Designer.cs
generated
Normal file
65
Controls/ParameterPanelMenuStrip.Designer.cs
generated
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
namespace GtaVUsersInfo.Controls
|
||||||
|
{
|
||||||
|
partial class ParameterPanelMenuStrip
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.myMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.addNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.myMenuStrip.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// myMenuStrip
|
||||||
|
//
|
||||||
|
this.myMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.addNewToolStripMenuItem});
|
||||||
|
this.myMenuStrip.Name = "contextMenuStrip";
|
||||||
|
this.myMenuStrip.Size = new System.Drawing.Size(181, 48);
|
||||||
|
//
|
||||||
|
// addNewToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.addNewToolStripMenuItem.Name = "addNewToolStripMenuItem";
|
||||||
|
this.addNewToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.addNewToolStripMenuItem.Text = "Создать";
|
||||||
|
//
|
||||||
|
// ParameterItemMenuStrip
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Name = "ParameterItemMenuStrip";
|
||||||
|
this.myMenuStrip.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ContextMenuStrip myMenuStrip;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem addNewToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
27
Controls/ParameterPanelMenuStrip.cs
Normal file
27
Controls/ParameterPanelMenuStrip.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GtaVUsersInfo.Controls
|
||||||
|
{
|
||||||
|
public partial class ParameterPanelMenuStrip : UserControl
|
||||||
|
{
|
||||||
|
public ContextMenuStrip Menu
|
||||||
|
{
|
||||||
|
get { return myMenuStrip; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParameterPanelMenuStrip(EventHandler add)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
addNewToolStripMenuItem.Click += add;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
Controls/ParameterPanelMenuStrip.resx
Normal file
123
Controls/ParameterPanelMenuStrip.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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>
|
||||||
|
<metadata name="myMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
@ -97,6 +97,18 @@
|
|||||||
<Compile Include="Controls\CarPanelMenuStrip.Designer.cs">
|
<Compile Include="Controls\CarPanelMenuStrip.Designer.cs">
|
||||||
<DependentUpon>CarPanelMenuStrip.cs</DependentUpon>
|
<DependentUpon>CarPanelMenuStrip.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\ParameterPanelMenuStrip.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\ParameterPanelMenuStrip.Designer.cs">
|
||||||
|
<DependentUpon>ParameterPanelMenuStrip.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\ParameterItemMenuStrip.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\ParameterItemMenuStrip.Designer.cs">
|
||||||
|
<DependentUpon>ParameterItemMenuStrip.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Forms\AddCars.cs">
|
<Compile Include="Forms\AddCars.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -105,11 +117,11 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Car.cs" />
|
<Compile Include="Car.cs" />
|
||||||
<Compile Include="CarPrice.cs" />
|
<Compile Include="CarPrice.cs" />
|
||||||
<Compile Include="Controls\CarItem.cs">
|
<Compile Include="Controls\CarControl.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Controls\CarItem.Designer.cs">
|
<Compile Include="Controls\CarControl.Designer.cs">
|
||||||
<DependentUpon>CarItem.cs</DependentUpon>
|
<DependentUpon>CarControl.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Forms\AddParameter.cs">
|
<Compile Include="Forms\AddParameter.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@ -144,11 +156,17 @@
|
|||||||
<EmbeddedResource Include="Controls\CarPanelMenuStrip.resx">
|
<EmbeddedResource Include="Controls\CarPanelMenuStrip.resx">
|
||||||
<DependentUpon>CarPanelMenuStrip.cs</DependentUpon>
|
<DependentUpon>CarPanelMenuStrip.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Controls\ParameterPanelMenuStrip.resx">
|
||||||
|
<DependentUpon>ParameterPanelMenuStrip.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Controls\ParameterItemMenuStrip.resx">
|
||||||
|
<DependentUpon>ParameterItemMenuStrip.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\AddCars.resx">
|
<EmbeddedResource Include="Forms\AddCars.resx">
|
||||||
<DependentUpon>AddCars.cs</DependentUpon>
|
<DependentUpon>AddCars.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Controls\CarItem.resx">
|
<EmbeddedResource Include="Controls\CarControl.resx">
|
||||||
<DependentUpon>CarItem.cs</DependentUpon>
|
<DependentUpon>CarControl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\AddParameter.resx">
|
<EmbeddedResource Include="Forms\AddParameter.resx">
|
||||||
<DependentUpon>AddParameter.cs</DependentUpon>
|
<DependentUpon>AddParameter.cs</DependentUpon>
|
||||||
|
@ -20,5 +20,10 @@ namespace GtaVUsersInfo.Helpers
|
|||||||
MessageBox.Show(message, "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(message, "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
Console.WriteLine(message);
|
Console.WriteLine(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DialogResult ShowQuestMessage(string message)
|
||||||
|
{
|
||||||
|
return MessageBox.Show(message, "Информация", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
58
MainForm.cs
58
MainForm.cs
@ -25,7 +25,7 @@ namespace GtaVUsersInfo
|
|||||||
private List<Car> carList;
|
private List<Car> carList;
|
||||||
|
|
||||||
private List<Control> parameters;
|
private List<Control> parameters;
|
||||||
private List<CarItem> cars;
|
private List<CarControl> cars;
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
@ -38,9 +38,10 @@ namespace GtaVUsersInfo
|
|||||||
carList = LoadCarsFromJson(Resources.carJsonPath);
|
carList = LoadCarsFromJson(Resources.carJsonPath);
|
||||||
|
|
||||||
parameters = new List<Control> { new ParameterControl("Имя"), new ParameterControl("Деньги") };
|
parameters = new List<Control> { new ParameterControl("Имя"), new ParameterControl("Деньги") };
|
||||||
cars = new List<CarItem>();
|
cars = new List<CarControl>();
|
||||||
|
|
||||||
carsItems.ContextMenuStrip = new CarPanelMenuStrip(addNewCar).Menu;
|
carsItems.ContextMenuStrip = new CarPanelMenuStrip(addNewCar).Menu;
|
||||||
|
parametersPanel.ContextMenuStrip = new ParameterPanelMenuStrip(addNewParameter).Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private void MainForm_Load(object sender, EventArgs e)
|
||||||
@ -61,6 +62,7 @@ namespace GtaVUsersInfo
|
|||||||
foreach (Control param in parameters)
|
foreach (Control param in parameters)
|
||||||
{
|
{
|
||||||
param.Dock = DockStyle.Top;
|
param.Dock = DockStyle.Top;
|
||||||
|
(param as ParameterControl).MenuStrip = new ParameterItemMenuStrip(addNewParameter, deleteParameter, param as ParameterControl).Menu;
|
||||||
parametersPanel.Controls.Add(param);
|
parametersPanel.Controls.Add(param);
|
||||||
parametersPanel.Controls.SetChildIndex(param, 0);
|
parametersPanel.Controls.SetChildIndex(param, 0);
|
||||||
}
|
}
|
||||||
@ -70,7 +72,7 @@ namespace GtaVUsersInfo
|
|||||||
{
|
{
|
||||||
carsItems.Controls.Clear();
|
carsItems.Controls.Clear();
|
||||||
|
|
||||||
foreach (CarItem car in cars)
|
foreach (CarControl car in cars)
|
||||||
{
|
{
|
||||||
carsItems.Controls.Add(car);
|
carsItems.Controls.Add(car);
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ namespace GtaVUsersInfo
|
|||||||
|
|
||||||
if (car.Name != null)
|
if (car.Name != null)
|
||||||
{
|
{
|
||||||
CarItem item = new CarItem(car);
|
CarControl item = new CarControl(car);
|
||||||
item.MenuStrip = new CarItemMenuStrip(addNewCar, editCar, deleteCar, item).Menu;
|
item.MenuStrip = new CarItemMenuStrip(addNewCar, editCar, deleteCar, item).Menu;
|
||||||
cars.Add(item);
|
cars.Add(item);
|
||||||
CarPanelCreate();
|
CarPanelCreate();
|
||||||
@ -180,7 +182,7 @@ namespace GtaVUsersInfo
|
|||||||
if (menu == null)
|
if (menu == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CarItem carItem = menu.Car as CarItem;
|
CarControl carItem = menu.Car;
|
||||||
if (carItem == null)
|
if (carItem == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -213,16 +215,22 @@ namespace GtaVUsersInfo
|
|||||||
if (menu == null)
|
if (menu == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CarItem carItem = menu.Car;
|
CarControl carItem = menu.Car;
|
||||||
if (carItem == null)
|
if (carItem == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cars.Contains(carItem))
|
if (cars.Contains(carItem))
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
ErrorsShow.ShowQuestMessage(
|
||||||
|
$"Вы точно хотите удалить автомобиль: {carItem.Car.Name} - {carItem.Car.Price}?"
|
||||||
|
) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
cars.Remove(carItem);
|
cars.Remove(carItem);
|
||||||
CarPanelCreate();
|
CarPanelCreate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addParameter_Click(object sender, EventArgs e)
|
private void addParameter_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -240,5 +248,43 @@ namespace GtaVUsersInfo
|
|||||||
ParameterPanelCreate();
|
ParameterPanelCreate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addNewParameter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
addParameter_Click(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteParameter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (parameters.Count <= 0)
|
||||||
|
{
|
||||||
|
ErrorsShow.ShowErrorMessage($"Список параметров пуст");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolStripMenuItem clickedMenuItem = sender as ToolStripMenuItem;
|
||||||
|
if (clickedMenuItem == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ParameterItemMenuStrip menu = clickedMenuItem.Tag as ParameterItemMenuStrip;
|
||||||
|
if (menu == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ParameterControl parameterControl = menu.Parameter;
|
||||||
|
if (parameterControl == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (parameters.Contains(parameterControl))
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
ErrorsShow.ShowQuestMessage(
|
||||||
|
$"Вы точно хотите удалить элемент: {parameterControl.ParamName}?"
|
||||||
|
) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
parameters.Remove(parameterControl);
|
||||||
|
ParameterPanelCreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user