Добавление параметров

This commit is contained in:
MisterMLiL 2024-10-08 11:44:50 +03:00
parent d86dd4e39a
commit 3e04430a86
16 changed files with 882 additions and 250 deletions

View File

@ -29,79 +29,84 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.MainPanel = new System.Windows.Forms.Panel();
this.PhotoPanel = new System.Windows.Forms.Panel();
this.PhotoBox = new System.Windows.Forms.PictureBox();
this.panel5 = new System.Windows.Forms.Panel();
this.MoneyPanel = new System.Windows.Forms.Panel();
this.MoneyTextBox = new System.Windows.Forms.TextBox();
this.MoneyLabel = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.ClassPanel = new System.Windows.Forms.Panel();
this.ClassLabel = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.NamePanel = new System.Windows.Forms.Panel();
this.ManufacturerLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.ModelPanel = new System.Windows.Forms.Panel();
this.ModelLabel = new System.Windows.Forms.Label();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.panel1.SuspendLayout();
this.panel6.SuspendLayout();
this.ModelTextBox = new System.Windows.Forms.TextBox();
this.ClassTextBox = new System.Windows.Forms.TextBox();
this.MainPanel.SuspendLayout();
this.PhotoPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).BeginInit();
this.panel5.SuspendLayout();
this.panel4.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.MoneyPanel.SuspendLayout();
this.ClassPanel.SuspendLayout();
this.NamePanel.SuspendLayout();
this.ModelPanel.SuspendLayout();
this.SuspendLayout();
//
// panel1
// MainPanel
//
this.panel1.Controls.Add(this.panel6);
this.panel1.Controls.Add(this.panel5);
this.panel1.Controls.Add(this.panel4);
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(212, 206);
this.panel1.TabIndex = 0;
this.MainPanel.Controls.Add(this.PhotoPanel);
this.MainPanel.Controls.Add(this.MoneyPanel);
this.MainPanel.Controls.Add(this.ClassPanel);
this.MainPanel.Controls.Add(this.NamePanel);
this.MainPanel.Controls.Add(this.ModelPanel);
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainPanel.Location = new System.Drawing.Point(0, 0);
this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(210, 204);
this.MainPanel.TabIndex = 0;
//
// panel6
// PhotoPanel
//
this.panel6.Controls.Add(this.PhotoBox);
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel6.Location = new System.Drawing.Point(0, 13);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(212, 134);
this.panel6.TabIndex = 4;
this.PhotoPanel.Controls.Add(this.PhotoBox);
this.PhotoPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.PhotoPanel.Location = new System.Drawing.Point(0, 18);
this.PhotoPanel.Name = "PhotoPanel";
this.PhotoPanel.Size = new System.Drawing.Size(210, 135);
this.PhotoPanel.TabIndex = 4;
//
// PhotoBox
//
this.PhotoBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.PhotoBox.Location = new System.Drawing.Point(0, 0);
this.PhotoBox.Name = "PhotoBox";
this.PhotoBox.Size = new System.Drawing.Size(212, 134);
this.PhotoBox.Size = new System.Drawing.Size(210, 135);
this.PhotoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PhotoBox.TabIndex = 0;
this.PhotoBox.TabStop = false;
//
// panel5
// MoneyPanel
//
this.panel5.AutoSize = true;
this.panel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel5.Controls.Add(this.MoneyTextBox);
this.panel5.Controls.Add(this.MoneyLabel);
this.panel5.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel5.Location = new System.Drawing.Point(0, 147);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(212, 33);
this.panel5.TabIndex = 3;
this.MoneyPanel.AutoSize = true;
this.MoneyPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.MoneyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.MoneyPanel.Controls.Add(this.MoneyTextBox);
this.MoneyPanel.Controls.Add(this.MoneyLabel);
this.MoneyPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.MoneyPanel.Location = new System.Drawing.Point(0, 153);
this.MoneyPanel.Name = "MoneyPanel";
this.MoneyPanel.Size = new System.Drawing.Size(210, 17);
this.MoneyPanel.TabIndex = 3;
//
// MoneyTextBox
//
this.MoneyTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.MoneyTextBox.Dock = System.Windows.Forms.DockStyle.Top;
this.MoneyTextBox.Location = new System.Drawing.Point(0, 13);
this.MoneyTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.MoneyTextBox.Location = new System.Drawing.Point(56, 0);
this.MoneyTextBox.Name = "MoneyTextBox";
this.MoneyTextBox.Size = new System.Drawing.Size(212, 20);
this.MoneyTextBox.Size = new System.Drawing.Size(152, 15);
this.MoneyTextBox.TabIndex = 1;
this.MoneyTextBox.Enter += new System.EventHandler(this.carPrice_Enter);
this.MoneyTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.carPrice_KeyPress);
@ -110,131 +115,168 @@
// MoneyLabel
//
this.MoneyLabel.AutoSize = true;
this.MoneyLabel.Dock = System.Windows.Forms.DockStyle.Top;
this.MoneyLabel.Dock = System.Windows.Forms.DockStyle.Left;
this.MoneyLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.MoneyLabel.Location = new System.Drawing.Point(0, 0);
this.MoneyLabel.Name = "MoneyLabel";
this.MoneyLabel.Size = new System.Drawing.Size(48, 13);
this.MoneyLabel.Size = new System.Drawing.Size(56, 16);
this.MoneyLabel.TabIndex = 0;
this.MoneyLabel.Text = "Деньги:";
//
// panel4
// ClassPanel
//
this.panel4.AutoSize = true;
this.panel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel4.Controls.Add(this.ClassLabel);
this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel4.Location = new System.Drawing.Point(0, 180);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(212, 13);
this.panel4.TabIndex = 2;
this.ClassPanel.AutoSize = true;
this.ClassPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClassPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ClassPanel.Controls.Add(this.ClassTextBox);
this.ClassPanel.Controls.Add(this.ClassLabel);
this.ClassPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ClassPanel.Location = new System.Drawing.Point(0, 170);
this.ClassPanel.Name = "ClassPanel";
this.ClassPanel.Size = new System.Drawing.Size(210, 17);
this.ClassPanel.TabIndex = 2;
//
// ClassLabel
//
this.ClassLabel.AutoSize = true;
this.ClassLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ClassLabel.Dock = System.Windows.Forms.DockStyle.Left;
this.ClassLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ClassLabel.Location = new System.Drawing.Point(0, 0);
this.ClassLabel.Name = "ClassLabel";
this.ClassLabel.Size = new System.Drawing.Size(35, 13);
this.ClassLabel.Size = new System.Drawing.Size(48, 16);
this.ClassLabel.TabIndex = 0;
this.ClassLabel.Text = "label2";
this.ClassLabel.Text = "Класс:";
//
// panel3
// NamePanel
//
this.panel3.AutoSize = true;
this.panel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel3.Controls.Add(this.ManufacturerLabel);
this.panel3.Controls.Add(this.NameLabel);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(212, 13);
this.panel3.TabIndex = 1;
this.NamePanel.AutoSize = true;
this.NamePanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.NamePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.NamePanel.Controls.Add(this.ManufacturerLabel);
this.NamePanel.Controls.Add(this.NameLabel);
this.NamePanel.Dock = System.Windows.Forms.DockStyle.Top;
this.NamePanel.Location = new System.Drawing.Point(0, 0);
this.NamePanel.Name = "NamePanel";
this.NamePanel.Size = new System.Drawing.Size(210, 18);
this.NamePanel.TabIndex = 1;
//
// ManufacturerLabel
//
this.ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.ManufacturerLabel.Location = new System.Drawing.Point(177, 0);
this.ManufacturerLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ManufacturerLabel.Location = new System.Drawing.Point(159, 0);
this.ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.Size = new System.Drawing.Size(35, 13);
this.ManufacturerLabel.Size = new System.Drawing.Size(49, 16);
this.ManufacturerLabel.TabIndex = 1;
this.ManufacturerLabel.Text = "label1";
this.ManufacturerLabel.Text = "Марка";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.NameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.NameLabel.Location = new System.Drawing.Point(0, 0);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(35, 13);
this.NameLabel.Size = new System.Drawing.Size(73, 16);
this.NameLabel.TabIndex = 0;
this.NameLabel.Text = "label1";
this.NameLabel.Text = "Название";
//
// panel2
// ModelPanel
//
this.panel2.AutoSize = true;
this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel2.Controls.Add(this.ModelLabel);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 193);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(212, 13);
this.panel2.TabIndex = 0;
this.ModelPanel.AutoSize = true;
this.ModelPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ModelPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ModelPanel.Controls.Add(this.ModelTextBox);
this.ModelPanel.Controls.Add(this.ModelLabel);
this.ModelPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ModelPanel.Location = new System.Drawing.Point(0, 187);
this.ModelPanel.Name = "ModelPanel";
this.ModelPanel.Size = new System.Drawing.Size(210, 17);
this.ModelPanel.TabIndex = 0;
//
// ModelLabel
//
this.ModelLabel.AutoSize = true;
this.ModelLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ModelLabel.Dock = System.Windows.Forms.DockStyle.Left;
this.ModelLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ModelLabel.Location = new System.Drawing.Point(0, 0);
this.ModelLabel.Name = "ModelLabel";
this.ModelLabel.Size = new System.Drawing.Size(35, 13);
this.ModelLabel.Size = new System.Drawing.Size(60, 16);
this.ModelLabel.TabIndex = 0;
this.ModelLabel.Text = "label2";
this.ModelLabel.Text = "Модель:";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
//
// ModelTextBox
//
this.ModelTextBox.BackColor = System.Drawing.Color.White;
this.ModelTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ModelTextBox.Dock = System.Windows.Forms.DockStyle.Top;
this.ModelTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ModelTextBox.Location = new System.Drawing.Point(60, 0);
this.ModelTextBox.Name = "ModelTextBox";
this.ModelTextBox.ReadOnly = true;
this.ModelTextBox.Size = new System.Drawing.Size(148, 15);
this.ModelTextBox.TabIndex = 2;
//
// ClassTextBox
//
this.ClassTextBox.BackColor = System.Drawing.Color.White;
this.ClassTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ClassTextBox.Dock = System.Windows.Forms.DockStyle.Top;
this.ClassTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ClassTextBox.Location = new System.Drawing.Point(48, 0);
this.ClassTextBox.Name = "ClassTextBox";
this.ClassTextBox.ReadOnly = true;
this.ClassTextBox.Size = new System.Drawing.Size(160, 15);
this.ClassTextBox.TabIndex = 3;
//
// CarItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panel1);
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.MainPanel);
this.Name = "CarItem";
this.Size = new System.Drawing.Size(212, 206);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel6.ResumeLayout(false);
this.Size = new System.Drawing.Size(210, 204);
this.MainPanel.ResumeLayout(false);
this.MainPanel.PerformLayout();
this.PhotoPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).EndInit();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.MoneyPanel.ResumeLayout(false);
this.MoneyPanel.PerformLayout();
this.ClassPanel.ResumeLayout(false);
this.ClassPanel.PerformLayout();
this.NamePanel.ResumeLayout(false);
this.NamePanel.PerformLayout();
this.ModelPanel.ResumeLayout(false);
this.ModelPanel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Panel MainPanel;
private System.Windows.Forms.Panel MoneyPanel;
private System.Windows.Forms.Label MoneyLabel;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel ClassPanel;
private System.Windows.Forms.Label ClassLabel;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel NamePanel;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel ModelPanel;
private System.Windows.Forms.Label ModelLabel;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel PhotoPanel;
private System.Windows.Forms.PictureBox PhotoBox;
private System.Windows.Forms.Label ManufacturerLabel;
private System.Windows.Forms.TextBox MoneyTextBox;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.TextBox ModelTextBox;
private System.Windows.Forms.TextBox ClassTextBox;
}
}

View File

@ -17,9 +17,9 @@ namespace GtaVUsersInfo.Controls
InitializeComponent();
NameLabel.Text = carItem.Name;
ClassLabel.Text = carItem.Class;
ModelLabel.Text = "Модель:" + carItem.Model;
ManufacturerLabel.Text = carItem.Manufacturer;
ClassTextBox.Text = carItem.Class;
ModelTextBox.Text = carItem.Model;
MoneyTextBox.Text = '$' + carItem.Price.ToString();
LoadImageAsync(carItem.Photo);

View File

@ -12,6 +12,18 @@ namespace GtaVUsersInfo.Controls
{
public partial class ParameterControl : UserControl
{
public string ParamName
{
get { return Label.Text.TrimEnd(':'); }
set { Label.Text = value + ':'; }
}
public int ParamText
{
get { return int.Parse(Textbox.Text); }
set { Textbox.Text = value.ToString(); }
}
public ParameterControl(string name, string text = "")
{
InitializeComponent();
@ -19,5 +31,13 @@ namespace GtaVUsersInfo.Controls
Label.Text = name + ':';
Textbox.Text = text;
}
public ParameterControl()
{
InitializeComponent();
Label.Text = "";
Textbox.Text = "";
}
}
}

View File

@ -1,4 +1,4 @@
namespace GtaVUsersInfo
namespace GtaVUsersInfo.Forms
{
partial class AddCars
{
@ -30,7 +30,7 @@
{
this.MainPanel = new System.Windows.Forms.Panel();
this.saveItem = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
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();
@ -46,7 +46,7 @@
// MainPanel
//
this.MainPanel.Controls.Add(this.saveItem);
this.MainPanel.Controls.Add(this.panel2);
this.MainPanel.Controls.Add(this.separatopPanel2);
this.MainPanel.Controls.Add(this.panel1);
this.MainPanel.Controls.Add(this.separatopPanel1);
this.MainPanel.Controls.Add(this.CarPanel);
@ -69,13 +69,13 @@
this.saveItem.UseVisualStyleBackColor = true;
this.saveItem.Click += new System.EventHandler(this.saveItem_Click);
//
// panel2
// separatopPanel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 80);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(248, 10);
this.panel2.TabIndex = 6;
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
//
@ -152,10 +152,11 @@
//
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(999999, 157);
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;
@ -180,7 +181,7 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox carPrice;
private System.Windows.Forms.Label priceLabel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel separatopPanel2;
private System.Windows.Forms.Button saveItem;
}
}

View File

@ -9,7 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GtaVUsersInfo
namespace GtaVUsersInfo.Forms
{
public partial class AddCars : Form
{

132
Forms/AddParameter.Designer.cs generated Normal file
View 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
View 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
View File

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

View File

@ -85,10 +85,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AddCars.cs">
<Compile Include="Forms\AddCars.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AddCars.Designer.cs">
<Compile Include="Forms\AddCars.Designer.cs">
<DependentUpon>AddCars.cs</DependentUpon>
</Compile>
<Compile Include="Car.cs" />
@ -99,8 +99,13 @@
<Compile Include="Controls\CarItem.Designer.cs">
<DependentUpon>CarItem.cs</DependentUpon>
</Compile>
<Compile Include="Forms\AddParameter.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\AddParameter.Designer.cs">
<DependentUpon>AddParameter.cs</DependentUpon>
</Compile>
<Compile Include="Helpers\ErrorsShow.cs" />
<Compile Include="Helpers\ReadonlyStrings.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -116,12 +121,20 @@
<Compile Include="Controls\ParameterControl.Designer.cs">
<DependentUpon>ParameterControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AddCars.resx">
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Forms\AddCars.resx">
<DependentUpon>AddCars.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\CarItem.resx">
<DependentUpon>CarItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\AddParameter.resx">
<DependentUpon>AddParameter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@ -137,6 +150,11 @@
<EmbeddedResource Include="Controls\ParameterControl.resx">
<DependentUpon>ParameterControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="bin\Debug\data\cars.json" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@ -114,7 +114,6 @@ namespace GtaVUsersInfo.Helpers
File.WriteAllText(filePath, json);
}
// Реализация метода Dispose
public void Dispose()
{
if (driver != null)

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GtaVUsersInfo.Helpers
{
public static class ReadonlyStrings
{
public readonly static string carUrl = "https://gtacars.net/";
public readonly static string carJsonPath = "data/cars.json";
}
}

208
MainForm.Designer.cs generated
View File

@ -40,21 +40,23 @@
this.parametersPanel = new System.Windows.Forms.Panel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.считатьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.сохранитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.сохранитьКакToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsКакToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.выйтиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.стилиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.текстToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.цветToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.стильToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.размерToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.цветаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.леваяПанельToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.праваяПанельToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.центральнаяПанельToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.верхнизToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.textToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.colorTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.styleTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sizeTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.colorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonPanelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.parameterPanelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.carPanelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.top_downPanelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitterLeft = new System.Windows.Forms.Splitter();
this.splitterRigth = new System.Windows.Forms.Splitter();
this.carsPanel = new System.Windows.Forms.Panel();
@ -140,6 +142,7 @@
this.addParameter.TabIndex = 4;
this.addParameter.Text = "Параметр";
this.addParameter.UseVisualStyleBackColor = true;
this.addParameter.Click += new System.EventHandler(this.addParameter_Click);
//
// parserButton
//
@ -195,6 +198,7 @@
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.White;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.файлToolStripMenuItem,
this.стилиToolStripMenuItem});
@ -207,115 +211,128 @@
// файлToolStripMenuItem
//
this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.считатьToolStripMenuItem,
this.сохранитьToolStripMenuItem,
this.сохранитьКакToolStripMenuItem,
this.openFileToolStripMenuItem,
this.saveToolStripMenuItem,
this.saveAsКакToolStripMenuItem,
this.toolStripSeparator2,
this.newToolStripMenuItem,
this.toolStripSeparator1,
this.выйтиToolStripMenuItem});
this.exitToolStripMenuItem});
this.файлToolStripMenuItem.Name = айлToolStripMenuItem";
this.файлToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.файлToolStripMenuItem.Text = "Файл";
//
// считатьToolStripMenuItem
// openFileToolStripMenuItem
//
this.считатьToolStripMenuItem.Name = "считатьToolStripMenuItem";
this.считатьToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.считатьToolStripMenuItem.Text = "Открыть";
this.openFileToolStripMenuItem.Name = "openFileToolStripMenuItem";
this.openFileToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.openFileToolStripMenuItem.Text = "Открыть";
//
// сохранитьToolStripMenuItem
// saveToolStripMenuItem
//
this.сохранитьToolStripMenuItem.Name = "сохранитьToolStripMenuItem";
this.сохранитьToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.сохранитьToolStripMenuItem.Text = "Сохранить";
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.saveToolStripMenuItem.Text = "Сохранить";
//
// сохранитьКакToolStripMenuItem
// saveAsКакToolStripMenuItem
//
this.сохранитьКакToolStripMenuItem.Name = "сохранитьКакToolStripMenuItem";
this.сохранитьКакToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.сохранитьКакToolStripMenuItem.Text = "Сохранить как";
this.saveAsКакToolStripMenuItem.Name = "saveAsКакToolStripMenuItem";
this.saveAsКакToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.saveAsКакToolStripMenuItem.Text = "Сохранить как";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(167, 6);
//
// newToolStripMenuItem
//
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.newToolStripMenuItem.Text = "Новый персонаж";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(167, 6);
//
// выйтиToolStripMenuItem
// exitToolStripMenuItem
//
this.выйтиToolStripMenuItem.Name = "выйтиToolStripMenuItem";
this.выйтиToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.выйтиToolStripMenuItem.Text = "Выйти";
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.exitToolStripMenuItem.Text = "Выйти";
//
// стилиToolStripMenuItem
//
this.стилиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.текстToolStripMenuItem,
this.цветаToolStripMenuItem});
this.textToolStripMenuItem,
this.colorToolStripMenuItem});
this.стилиToolStripMenuItem.Name = "стилиToolStripMenuItem";
this.стилиToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
this.стилиToolStripMenuItem.Text = "Стили";
//
// текстToolStripMenuItem
// textToolStripMenuItem
//
this.текстToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.цветToolStripMenuItem,
this.стильToolStripMenuItem,
this.размерToolStripMenuItem});
this.текстToolStripMenuItem.Name = "текстToolStripMenuItem";
this.текстToolStripMenuItem.Size = new System.Drawing.Size(106, 22);
this.текстToolStripMenuItem.Text = "Текст";
this.textToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.colorTextToolStripMenuItem,
this.styleTextToolStripMenuItem,
this.sizeTextToolStripMenuItem});
this.textToolStripMenuItem.Name = "textToolStripMenuItem";
this.textToolStripMenuItem.Size = new System.Drawing.Size(106, 22);
this.textToolStripMenuItem.Text = "Текст";
//
// цветToolStripMenuItem
// colorTextToolStripMenuItem
//
this.цветToolStripMenuItem.Name = "цветToolStripMenuItem";
this.цветToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.цветToolStripMenuItem.Text = "Цвет";
this.colorTextToolStripMenuItem.Name = "colorTextToolStripMenuItem";
this.colorTextToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.colorTextToolStripMenuItem.Text = "Цвет";
//
// стильToolStripMenuItem
// styleTextToolStripMenuItem
//
this.стильToolStripMenuItem.Name = "стильToolStripMenuItem";
this.стильToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.стильToolStripMenuItem.Text = "Стиль";
this.styleTextToolStripMenuItem.Name = "styleTextToolStripMenuItem";
this.styleTextToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.styleTextToolStripMenuItem.Text = "Стиль";
//
// размерToolStripMenuItem
// sizeTextToolStripMenuItem
//
this.размерToolStripMenuItem.Name = "размерToolStripMenuItem";
this.размерToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.размерToolStripMenuItem.Text = "Размер";
this.sizeTextToolStripMenuItem.Name = "sizeTextToolStripMenuItem";
this.sizeTextToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.sizeTextToolStripMenuItem.Text = "Размер";
//
// цветаToolStripMenuItem
// colorToolStripMenuItem
//
this.цветаToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.леваяПанельToolStripMenuItem,
this.праваяПанельToolStripMenuItem,
this.центральнаяПанельToolStripMenuItem,
this.верхнизToolStripMenuItem});
this.цветаToolStripMenuItem.Name = "цветаToolStripMenuItem";
this.цветаToolStripMenuItem.Size = new System.Drawing.Size(106, 22);
this.цветаToolStripMenuItem.Text = "Цвета";
this.colorToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.buttonPanelToolStripMenuItem,
this.parameterPanelToolStripMenuItem,
this.carPanelToolStripMenuItem,
this.top_downPanelToolStripMenuItem});
this.colorToolStripMenuItem.Name = "colorToolStripMenuItem";
this.colorToolStripMenuItem.Size = new System.Drawing.Size(106, 22);
this.colorToolStripMenuItem.Text = "Цвета";
//
// леваяПанельToolStripMenuItem
// buttonPanelToolStripMenuItem
//
this.леваяПанельToolStripMenuItem.Name = "леваяПанельToolStripMenuItem";
this.леваяПанельToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.леваяПанельToolStripMenuItem.Text = "Левая панель";
this.buttonPanelToolStripMenuItem.Name = "buttonPanelToolStripMenuItem";
this.buttonPanelToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.buttonPanelToolStripMenuItem.Text = "Левая панель";
//
// праваяПанельToolStripMenuItem
// parameterPanelToolStripMenuItem
//
this.праваяПанельToolStripMenuItem.Name = "праваяПанельToolStripMenuItem";
this.праваяПанельToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.праваяПанельToolStripMenuItem.Text = "Правая панель";
this.parameterPanelToolStripMenuItem.Name = "parameterPanelToolStripMenuItem";
this.parameterPanelToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.parameterPanelToolStripMenuItem.Text = "Правая панель";
//
// центральнаяПанельToolStripMenuItem
// carPanelToolStripMenuItem
//
this.центральнаяПанельToolStripMenuItem.Name = "центральнаяПанельToolStripMenuItem";
this.центральнаяПанельToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.центральнаяПанельToolStripMenuItem.Text = "Центральная панель";
this.carPanelToolStripMenuItem.Name = "carPanelToolStripMenuItem";
this.carPanelToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.carPanelToolStripMenuItem.Text = "Центральная панель";
//
// верхнизToolStripMenuItem
// top_downPanelToolStripMenuItem
//
this.верхнизToolStripMenuItem.Name = "верхнизToolStripMenuItem";
this.верхнизToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.верхнизToolStripMenuItem.Text = "Верх/низ";
this.top_downPanelToolStripMenuItem.Name = "top_downPanelToolStripMenuItem";
this.top_downPanelToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.top_downPanelToolStripMenuItem.Text = "Верх/низ";
//
// splitterLeft
//
@ -347,6 +364,7 @@
//
// carsItems
//
this.carsItems.AutoScroll = true;
this.carsItems.Dock = System.Windows.Forms.DockStyle.Fill;
this.carsItems.Location = new System.Drawing.Point(0, 0);
this.carsItems.Name = "carsItems";
@ -393,21 +411,21 @@
private System.Windows.Forms.Panel parametersPanel;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem файлToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem считатьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem сохранитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem сохранитьКакToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveAsКакToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem выйтиToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem стилиToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem текстToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem цветToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem стильToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem размерToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem цветаToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem леваяПанельToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem праваяПанельToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem центральнаяПанельToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem верхнизToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem textToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem colorTextToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem styleTextToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sizeTextToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem colorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem buttonPanelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem parameterPanelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem carPanelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem top_downPanelToolStripMenuItem;
private System.Windows.Forms.Button addCar;
private System.Windows.Forms.Label addParametrLabel;
private System.Windows.Forms.Splitter splitterLeft;
@ -418,6 +436,8 @@
private System.Windows.Forms.Button addParameter;
private System.Windows.Forms.FlowLayoutPanel carsItems;
private System.Windows.Forms.Button readJsonButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
}
}

View File

@ -13,6 +13,8 @@ using GtaVUsersInfo.Helpers;
using GtaVUsersInfo.Controls;
using Newtonsoft.Json;
using System.IO;
using System.Data.Common;
using GtaVUsersInfo.Forms;
namespace GtaVUsersInfo
{
@ -20,16 +22,27 @@ namespace GtaVUsersInfo
{
private List<Control> debugControlsList;
private List<Car> carList;
private List<Control> parameters;
public MainForm()
{
InitializeComponent();
debugControlsList = new List<Control> { parserButton, readJsonButton };
parameters = new List<Control> { new ParameterControl("Деньги"), new ParameterControl("Имя") };
this.visible(debugControlsList, false);
carList = LoadCarsFromJson(ReadonlyStrings.carJsonPath);
carList = LoadCarsFromJson(Resources.carJsonPath);
}
private void MainForm_Load(object sender, EventArgs e)
{
foreach (Control param in parameters)
{
param.Dock = DockStyle.Top;
parametersPanel.Controls.Add(param);
}
}
public static List<Car> LoadCarsFromJson(string filePath)
@ -60,18 +73,6 @@ namespace GtaVUsersInfo
}
}
private void MainForm_Load(object sender, EventArgs e)
{
var name = new ParameterControl("Имя");
var money = new ParameterControl("Деньги");
name.Dock = DockStyle.Top;
money.Dock = DockStyle.Top;
parametersPanel.Controls.Add(money);
parametersPanel.Controls.Add(name);
}
#region Methods
private void visible(List<Control> controls, bool isVisible)
@ -86,16 +87,16 @@ namespace GtaVUsersInfo
using (var parser = new CarParser())
{
var cars = await parser.ParseCarsFromPages(25);
parser.SaveToJson(cars, ReadonlyStrings.carJsonPath);
ErrorsShow.ShowInfoMessage($"Данные сохранены: {ReadonlyStrings.carJsonPath}");
parser.SaveToJson(cars, Resources.carJsonPath);
ErrorsShow.ShowInfoMessage($"Данные сохранены: {Resources.carJsonPath}");
}
carList = LoadCarsFromJson(ReadonlyStrings.carJsonPath);
carList = LoadCarsFromJson(Resources.carJsonPath);
}
private void readJsonButton_Click(object sender, EventArgs e)
{
carList = LoadCarsFromJson(ReadonlyStrings.carJsonPath);
carList = LoadCarsFromJson(Resources.carJsonPath);
}
private void debugCheck_CheckedChanged(object sender, EventArgs e)
@ -107,15 +108,15 @@ namespace GtaVUsersInfo
{
if (carList.Count <= 0)
{
ErrorsShow.ShowErrorMessage($"Список автомобилей пуст, ошибка чтения файла: {ReadonlyStrings.carJsonPath}");
ErrorsShow.ShowErrorMessage($"Список автомобилей пуст, ошибка чтения файла: {Resources.carJsonPath}");
return;
}
Car car = new Car();
using (AddCars cars = new AddCars(carList, car))
using (AddCars form = new AddCars(carList, car))
{
cars.ShowDialog();
form.ShowDialog();
}
if (car.Name != null)
@ -124,5 +125,22 @@ namespace GtaVUsersInfo
carsItems.Controls.Add(item);
}
}
private void addParameter_Click(object sender, EventArgs e)
{
ParameterControl parameter = new ParameterControl();
using (AddParameter form = new AddParameter(parameters, parameter))
{
form.ShowDialog();
}
if (!string.IsNullOrEmpty(parameter.ParamName))
{
parameter.Dock = DockStyle.Top;
parameters.Add(parameter);
parametersPanel.Controls.Add(parameter);
}
}
}
}

91
Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,91 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GtaVUsersInfo {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GtaVUsersInfo.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Ищет локализованную строку, похожую на data/cars.json.
/// </summary>
internal static string carJsonPath {
get {
return ResourceManager.GetString("carJsonPath", resourceCulture);
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Byte[].
/// </summary>
internal static byte[] cars {
get {
object obj = ResourceManager.GetObject("cars", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Ищет локализованную строку, похожую на https://gtacars.net/.
/// </summary>
internal static string carUrl {
get {
return ResourceManager.GetString("carUrl", resourceCulture);
}
}
}
}

130
Resources.resx Normal file
View File

@ -0,0 +1,130 @@
<?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>
<data name="carJsonPath" xml:space="preserve">
<value>data/cars.json</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cars" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>bin\Debug\data\cars.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="carUrl" xml:space="preserve">
<value>https://gtacars.net/</value>
</data>
</root>