diff --git a/Controls/CarItem.Designer.cs b/Controls/CarItem.Designer.cs index d24e23e..1e2ffa9 100644 --- a/Controls/CarItem.Designer.cs +++ b/Controls/CarItem.Designer.cs @@ -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; } } diff --git a/Controls/CarItem.cs b/Controls/CarItem.cs index 211c3b6..996d08f 100644 --- a/Controls/CarItem.cs +++ b/Controls/CarItem.cs @@ -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); diff --git a/Controls/ParameterControl.cs b/Controls/ParameterControl.cs index 8610682..6f57ebf 100644 --- a/Controls/ParameterControl.cs +++ b/Controls/ParameterControl.cs @@ -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 = ""; + } } } diff --git a/AddCars.Designer.cs b/Forms/AddCars.Designer.cs similarity index 91% rename from AddCars.Designer.cs rename to Forms/AddCars.Designer.cs index cef5a47..934a2d9 100644 --- a/AddCars.Designer.cs +++ b/Forms/AddCars.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/AddCars.cs b/Forms/AddCars.cs similarity index 98% rename from AddCars.cs rename to Forms/AddCars.cs index 7e66e1a..1f488d9 100644 --- a/AddCars.cs +++ b/Forms/AddCars.cs @@ -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 { diff --git a/AddCars.resx b/Forms/AddCars.resx similarity index 100% rename from AddCars.resx rename to Forms/AddCars.resx diff --git a/Forms/AddParameter.Designer.cs b/Forms/AddParameter.Designer.cs new file mode 100644 index 0000000..ca6b01a --- /dev/null +++ b/Forms/AddParameter.Designer.cs @@ -0,0 +1,132 @@ +namespace GtaVUsersInfo.Forms +{ + partial class AddParameter + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/Forms/AddParameter.cs b/Forms/AddParameter.cs new file mode 100644 index 0000000..00e7297 --- /dev/null +++ b/Forms/AddParameter.cs @@ -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 listControls; + ParameterControl parameter; + + public AddParameter(List 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; + } + } + } +} diff --git a/Forms/AddParameter.resx b/Forms/AddParameter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Forms/AddParameter.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GtaVUsersInfo.csproj b/GtaVUsersInfo.csproj index 0757647..fa2699a 100644 --- a/GtaVUsersInfo.csproj +++ b/GtaVUsersInfo.csproj @@ -85,10 +85,10 @@ - + Form - + AddCars.cs @@ -99,8 +99,13 @@ CarItem.cs + + Form + + + AddParameter.cs + - Form @@ -116,12 +121,20 @@ ParameterControl.cs - + + True + True + Resources.resx + + AddCars.cs CarItem.cs + + AddParameter.cs + MainForm.cs @@ -137,6 +150,11 @@ ParameterControl.cs + + ResXFileCodeGenerator + Resources.Designer.cs + + SettingsSingleFileGenerator diff --git a/Helpers/CarParser.cs b/Helpers/CarParser.cs index f2b7eb0..b02e979 100644 --- a/Helpers/CarParser.cs +++ b/Helpers/CarParser.cs @@ -114,7 +114,6 @@ namespace GtaVUsersInfo.Helpers File.WriteAllText(filePath, json); } - // Реализация метода Dispose public void Dispose() { if (driver != null) diff --git a/Helpers/ReadonlyStrings.cs b/Helpers/ReadonlyStrings.cs deleted file mode 100644 index 606f544..0000000 --- a/Helpers/ReadonlyStrings.cs +++ /dev/null @@ -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"; - } -} diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 5872749..0d593eb 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -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; } } diff --git a/MainForm.cs b/MainForm.cs index aeaa534..e1065fc 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -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 debugControlsList; private List carList; + private List parameters; public MainForm() { InitializeComponent(); debugControlsList = new List { parserButton, readJsonButton }; + parameters = new List { 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 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 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); + } + } } } diff --git a/Resources.Designer.cs b/Resources.Designer.cs new file mode 100644 index 0000000..88cf2e6 --- /dev/null +++ b/Resources.Designer.cs @@ -0,0 +1,91 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace GtaVUsersInfo { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом 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() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [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; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Ищет локализованную строку, похожую на data/cars.json. + /// + internal static string carJsonPath { + get { + return ResourceManager.GetString("carJsonPath", resourceCulture); + } + } + + /// + /// Поиск локализованного ресурса типа System.Byte[]. + /// + internal static byte[] cars { + get { + object obj = ResourceManager.GetObject("cars", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Ищет локализованную строку, похожую на https://gtacars.net/. + /// + internal static string carUrl { + get { + return ResourceManager.GetString("carUrl", resourceCulture); + } + } + } +} diff --git a/Resources.resx b/Resources.resx new file mode 100644 index 0000000..294f7ed --- /dev/null +++ b/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + data/cars.json + + + + bin\Debug\data\cars.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + https://gtacars.net/ + + \ No newline at end of file