Добавление параметров
This commit is contained in:
187
Forms/AddCars.Designer.cs
generated
Normal file
187
Forms/AddCars.Designer.cs
generated
Normal file
@@ -0,0 +1,187 @@
|
||||
namespace GtaVUsersInfo.Forms
|
||||
{
|
||||
partial class AddCars
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.MainPanel = new System.Windows.Forms.Panel();
|
||||
this.saveItem = new System.Windows.Forms.Button();
|
||||
this.separatopPanel2 = new System.Windows.Forms.Panel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.carPrice = new System.Windows.Forms.TextBox();
|
||||
this.priceLabel = new System.Windows.Forms.Label();
|
||||
this.separatopPanel1 = new System.Windows.Forms.Panel();
|
||||
this.CarPanel = new System.Windows.Forms.Panel();
|
||||
this.carComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.carLabel = new System.Windows.Forms.Label();
|
||||
this.MainPanel.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.CarPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
this.MainPanel.Controls.Add(this.saveItem);
|
||||
this.MainPanel.Controls.Add(this.separatopPanel2);
|
||||
this.MainPanel.Controls.Add(this.panel1);
|
||||
this.MainPanel.Controls.Add(this.separatopPanel1);
|
||||
this.MainPanel.Controls.Add(this.CarPanel);
|
||||
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.MainPanel.Name = "MainPanel";
|
||||
this.MainPanel.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.MainPanel.Size = new System.Drawing.Size(254, 118);
|
||||
this.MainPanel.TabIndex = 0;
|
||||
//
|
||||
// saveItem
|
||||
//
|
||||
this.saveItem.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.saveItem.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.saveItem.Location = new System.Drawing.Point(176, 90);
|
||||
this.saveItem.Name = "saveItem";
|
||||
this.saveItem.Size = new System.Drawing.Size(75, 25);
|
||||
this.saveItem.TabIndex = 7;
|
||||
this.saveItem.Text = "Сохранить";
|
||||
this.saveItem.UseVisualStyleBackColor = true;
|
||||
this.saveItem.Click += new System.EventHandler(this.saveItem_Click);
|
||||
//
|
||||
// separatopPanel2
|
||||
//
|
||||
this.separatopPanel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.separatopPanel2.Location = new System.Drawing.Point(3, 80);
|
||||
this.separatopPanel2.Name = "separatopPanel2";
|
||||
this.separatopPanel2.Size = new System.Drawing.Size(248, 10);
|
||||
this.separatopPanel2.TabIndex = 6;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AutoSize = true;
|
||||
this.panel1.Controls.Add(this.carPrice);
|
||||
this.panel1.Controls.Add(this.priceLabel);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(3, 47);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(248, 33);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// carPrice
|
||||
//
|
||||
this.carPrice.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.carPrice.Location = new System.Drawing.Point(0, 13);
|
||||
this.carPrice.Name = "carPrice";
|
||||
this.carPrice.Size = new System.Drawing.Size(248, 20);
|
||||
this.carPrice.TabIndex = 4;
|
||||
this.carPrice.Enter += new System.EventHandler(this.carPrice_Enter);
|
||||
this.carPrice.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.carPrice_KeyPress);
|
||||
this.carPrice.Leave += new System.EventHandler(this.carPrice_Leave);
|
||||
//
|
||||
// priceLabel
|
||||
//
|
||||
this.priceLabel.AutoSize = true;
|
||||
this.priceLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.priceLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.priceLabel.Name = "priceLabel";
|
||||
this.priceLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.priceLabel.TabIndex = 2;
|
||||
this.priceLabel.Text = "Цена:";
|
||||
//
|
||||
// separatopPanel1
|
||||
//
|
||||
this.separatopPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.separatopPanel1.Location = new System.Drawing.Point(3, 37);
|
||||
this.separatopPanel1.Name = "separatopPanel1";
|
||||
this.separatopPanel1.Size = new System.Drawing.Size(248, 10);
|
||||
this.separatopPanel1.TabIndex = 4;
|
||||
//
|
||||
// CarPanel
|
||||
//
|
||||
this.CarPanel.AutoSize = true;
|
||||
this.CarPanel.Controls.Add(this.carComboBox);
|
||||
this.CarPanel.Controls.Add(this.carLabel);
|
||||
this.CarPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.CarPanel.Location = new System.Drawing.Point(3, 3);
|
||||
this.CarPanel.Name = "CarPanel";
|
||||
this.CarPanel.Size = new System.Drawing.Size(248, 34);
|
||||
this.CarPanel.TabIndex = 3;
|
||||
//
|
||||
// carComboBox
|
||||
//
|
||||
this.carComboBox.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.carComboBox.FormattingEnabled = true;
|
||||
this.carComboBox.Location = new System.Drawing.Point(0, 13);
|
||||
this.carComboBox.Name = "carComboBox";
|
||||
this.carComboBox.Size = new System.Drawing.Size(248, 21);
|
||||
this.carComboBox.TabIndex = 3;
|
||||
this.carComboBox.SelectedIndexChanged += new System.EventHandler(this.carComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// carLabel
|
||||
//
|
||||
this.carLabel.AutoSize = true;
|
||||
this.carLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.carLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.carLabel.Name = "carLabel";
|
||||
this.carLabel.Size = new System.Drawing.Size(72, 13);
|
||||
this.carLabel.TabIndex = 2;
|
||||
this.carLabel.Text = "Автомобиль:";
|
||||
//
|
||||
// AddCars
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(254, 118);
|
||||
this.Controls.Add(this.MainPanel);
|
||||
this.MaximumSize = new System.Drawing.Size(270, 157);
|
||||
this.MinimumSize = new System.Drawing.Size(270, 157);
|
||||
this.Name = "AddCars";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Автомобиль";
|
||||
this.MainPanel.ResumeLayout(false);
|
||||
this.MainPanel.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.CarPanel.ResumeLayout(false);
|
||||
this.CarPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel MainPanel;
|
||||
private System.Windows.Forms.Panel CarPanel;
|
||||
private System.Windows.Forms.ComboBox carComboBox;
|
||||
private System.Windows.Forms.Label carLabel;
|
||||
private System.Windows.Forms.Panel separatopPanel1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TextBox carPrice;
|
||||
private System.Windows.Forms.Label priceLabel;
|
||||
private System.Windows.Forms.Panel separatopPanel2;
|
||||
private System.Windows.Forms.Button saveItem;
|
||||
}
|
||||
}
|
94
Forms/AddCars.cs
Normal file
94
Forms/AddCars.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using GtaVUsersInfo.Helpers;
|
||||
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.Forms
|
||||
{
|
||||
public partial class AddCars : Form
|
||||
{
|
||||
List<Car> carList;
|
||||
Car carItem;
|
||||
|
||||
public AddCars(List<Car> carPrice, Car carItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
carList = carPrice;
|
||||
|
||||
this.carItem = carItem;
|
||||
|
||||
foreach (Car car in carList)
|
||||
{
|
||||
carComboBox.Items.Add(car.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private void carComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((sender as ComboBox).SelectedIndex == -1)
|
||||
return;
|
||||
|
||||
carPrice.Text = "$" + carList[(sender as ComboBox).SelectedIndex].Price.ToString();
|
||||
}
|
||||
|
||||
private void carPrice_Enter(object sender, EventArgs e)
|
||||
{
|
||||
(sender as TextBox).Text = (sender as TextBox).Text.Trim('$');
|
||||
}
|
||||
|
||||
private void carPrice_Leave(object sender, EventArgs e)
|
||||
{
|
||||
(sender as TextBox).Text = '$' + (sender as TextBox).Text;
|
||||
}
|
||||
|
||||
private void carPrice_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == (char)Keys.Enter)
|
||||
{
|
||||
saveItem.Focus();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void saveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (carComboBox.SelectedIndex == -1)
|
||||
{
|
||||
ErrorsShow.ShowErrorMessage("Не выбран ни один автомобиль");
|
||||
return;
|
||||
}
|
||||
|
||||
Car selectedCar = carList[carComboBox.SelectedIndex];
|
||||
|
||||
carItem.Name = selectedCar.Name;
|
||||
carItem.Price = int.Parse(carPrice.Text.Trim('$'));
|
||||
carItem.Photo = selectedCar.Photo;
|
||||
carItem.Manufacturer = selectedCar.Manufacturer;
|
||||
carItem.Class = selectedCar.Class;
|
||||
carItem.Model = selectedCar.Model;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorsShow.ShowErrorMessage($"Произошла неожиданная ошибка: {ex.Message}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Forms/AddCars.resx
Normal file
120
Forms/AddCars.resx
Normal 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>
|
132
Forms/AddParameter.Designer.cs
generated
Normal file
132
Forms/AddParameter.Designer.cs
generated
Normal file
@@ -0,0 +1,132 @@
|
||||
namespace GtaVUsersInfo.Forms
|
||||
{
|
||||
partial class AddParameter
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.MainPanel = new System.Windows.Forms.Panel();
|
||||
this.saveItem = new System.Windows.Forms.Button();
|
||||
this.separatopPanel1 = new System.Windows.Forms.Panel();
|
||||
this.CarPanel = new System.Windows.Forms.Panel();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.MainPanel.SuspendLayout();
|
||||
this.CarPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
this.MainPanel.Controls.Add(this.saveItem);
|
||||
this.MainPanel.Controls.Add(this.separatopPanel1);
|
||||
this.MainPanel.Controls.Add(this.CarPanel);
|
||||
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.MainPanel.Name = "MainPanel";
|
||||
this.MainPanel.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.MainPanel.Size = new System.Drawing.Size(254, 74);
|
||||
this.MainPanel.TabIndex = 1;
|
||||
//
|
||||
// saveItem
|
||||
//
|
||||
this.saveItem.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.saveItem.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.saveItem.Location = new System.Drawing.Point(176, 46);
|
||||
this.saveItem.Name = "saveItem";
|
||||
this.saveItem.Size = new System.Drawing.Size(75, 25);
|
||||
this.saveItem.TabIndex = 7;
|
||||
this.saveItem.Text = "Сохранить";
|
||||
this.saveItem.UseVisualStyleBackColor = true;
|
||||
this.saveItem.Click += new System.EventHandler(this.saveItem_Click);
|
||||
//
|
||||
// separatopPanel1
|
||||
//
|
||||
this.separatopPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.separatopPanel1.Location = new System.Drawing.Point(3, 36);
|
||||
this.separatopPanel1.Name = "separatopPanel1";
|
||||
this.separatopPanel1.Size = new System.Drawing.Size(248, 10);
|
||||
this.separatopPanel1.TabIndex = 4;
|
||||
//
|
||||
// CarPanel
|
||||
//
|
||||
this.CarPanel.AutoSize = true;
|
||||
this.CarPanel.Controls.Add(this.nameTextBox);
|
||||
this.CarPanel.Controls.Add(this.nameLabel);
|
||||
this.CarPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.CarPanel.Location = new System.Drawing.Point(3, 3);
|
||||
this.CarPanel.Name = "CarPanel";
|
||||
this.CarPanel.Size = new System.Drawing.Size(248, 33);
|
||||
this.CarPanel.TabIndex = 3;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.nameLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.nameLabel.TabIndex = 2;
|
||||
this.nameLabel.Text = "Название:";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(0, 13);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(248, 20);
|
||||
this.nameTextBox.TabIndex = 4;
|
||||
//
|
||||
// AddParameter
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(254, 74);
|
||||
this.Controls.Add(this.MainPanel);
|
||||
this.MaximumSize = new System.Drawing.Size(270, 113);
|
||||
this.MinimumSize = new System.Drawing.Size(270, 113);
|
||||
this.Name = "AddParameter";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Параметер";
|
||||
this.MainPanel.ResumeLayout(false);
|
||||
this.MainPanel.PerformLayout();
|
||||
this.CarPanel.ResumeLayout(false);
|
||||
this.CarPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel MainPanel;
|
||||
private System.Windows.Forms.Button saveItem;
|
||||
private System.Windows.Forms.Panel separatopPanel1;
|
||||
private System.Windows.Forms.Panel CarPanel;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
}
|
||||
}
|
55
Forms/AddParameter.cs
Normal file
55
Forms/AddParameter.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using GtaVUsersInfo.Controls;
|
||||
using GtaVUsersInfo.Helpers;
|
||||
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.Forms
|
||||
{
|
||||
public partial class AddParameter : Form
|
||||
{
|
||||
List<Control> listControls;
|
||||
ParameterControl parameter;
|
||||
|
||||
public AddParameter(List<Control> listControls, ParameterControl parameter)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.listControls = listControls;
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
private void saveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(nameTextBox.Text))
|
||||
{
|
||||
ErrorsShow.ShowErrorMessage($"Вы не ввели ни одни символ!");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Control foundParam = listControls.FirstOrDefault(p => (p as ParameterControl).ParamName == nameTextBox.Text);
|
||||
if (foundParam == null)
|
||||
{
|
||||
parameter.ParamName = nameTextBox.Text;
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Exception("Такой параметр уже есть!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorsShow.ShowErrorMessage($"Произошла неожиданная ошибка: {ex.Message}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Forms/AddParameter.resx
Normal file
120
Forms/AddParameter.resx
Normal 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>
|
Reference in New Issue
Block a user