feat: installer

This commit is contained in:
2026-03-05 11:31:36 +01:00
parent 835286b629
commit ff3805f8d1
7 changed files with 1038 additions and 71 deletions

View File

@@ -64,7 +64,7 @@
tableLayoutPanel1.AutoSize = true;
tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
tableLayoutPanel1.ColumnCount = 2;
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel1.Controls.Add(pbxCarImage, 0, 0);
tableLayoutPanel1.Controls.Add(label1, 0, 1);
@@ -82,18 +82,18 @@
tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 1, 3);
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 30, 4);
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 3, 26, 3);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 8;
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 250F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 188F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
tableLayoutPanel1.Size = new System.Drawing.Size(536, 562);
tableLayoutPanel1.Size = new System.Drawing.Size(469, 422);
tableLayoutPanel1.TabIndex = 0;
//
// pbxCarImage
@@ -101,10 +101,9 @@
tableLayoutPanel1.SetColumnSpan(pbxCarImage, 2);
pbxCarImage.Dock = System.Windows.Forms.DockStyle.Fill;
pbxCarImage.Image = (System.Drawing.Image)resources.GetObject("pbxCarImage.Image");
pbxCarImage.Location = new System.Drawing.Point(3, 4);
pbxCarImage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
pbxCarImage.Location = new System.Drawing.Point(3, 3);
pbxCarImage.Name = "pbxCarImage";
pbxCarImage.Size = new System.Drawing.Size(530, 242);
pbxCarImage.Size = new System.Drawing.Size(463, 182);
pbxCarImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
pbxCarImage.TabIndex = 0;
pbxCarImage.TabStop = false;
@@ -113,9 +112,9 @@
//
label1.AutoSize = true;
label1.Dock = System.Windows.Forms.DockStyle.Fill;
label1.Location = new System.Drawing.Point(3, 250);
label1.Location = new System.Drawing.Point(3, 188);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(74, 38);
label1.Size = new System.Drawing.Size(64, 28);
label1.TabIndex = 1;
label1.Text = "Make:";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -123,10 +122,9 @@
// tbxMake
//
tbxMake.Dock = System.Windows.Forms.DockStyle.Fill;
tbxMake.Location = new System.Drawing.Point(83, 254);
tbxMake.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tbxMake.Location = new System.Drawing.Point(73, 191);
tbxMake.Name = "tbxMake";
tbxMake.Size = new System.Drawing.Size(450, 27);
tbxMake.Size = new System.Drawing.Size(393, 23);
tbxMake.TabIndex = 1;
tbxMake.TextChanged += tbxMake_TextChanged;
tbxMake.Leave += tbxMake_Leave;
@@ -135,9 +133,9 @@
//
label2.AutoSize = true;
label2.Dock = System.Windows.Forms.DockStyle.Fill;
label2.Location = new System.Drawing.Point(3, 288);
label2.Location = new System.Drawing.Point(3, 216);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(74, 38);
label2.Size = new System.Drawing.Size(64, 28);
label2.TabIndex = 3;
label2.Text = "Model:";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -145,10 +143,9 @@
// tbxModel
//
tbxModel.Dock = System.Windows.Forms.DockStyle.Fill;
tbxModel.Location = new System.Drawing.Point(83, 292);
tbxModel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tbxModel.Location = new System.Drawing.Point(73, 219);
tbxModel.Name = "tbxModel";
tbxModel.Size = new System.Drawing.Size(450, 27);
tbxModel.Size = new System.Drawing.Size(393, 23);
tbxModel.TabIndex = 2;
tbxModel.TextChanged += tbxModel_TextChanged;
tbxModel.Leave += tbxModel_Leave;
@@ -157,9 +154,9 @@
//
label3.AutoSize = true;
label3.Dock = System.Windows.Forms.DockStyle.Fill;
label3.Location = new System.Drawing.Point(3, 326);
label3.Location = new System.Drawing.Point(3, 244);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(74, 38);
label3.Size = new System.Drawing.Size(64, 28);
label3.TabIndex = 5;
label3.Text = "Year:";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -168,9 +165,9 @@
//
label4.AutoSize = true;
label4.Dock = System.Windows.Forms.DockStyle.Fill;
label4.Location = new System.Drawing.Point(3, 364);
label4.Location = new System.Drawing.Point(3, 272);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(74, 38);
label4.Size = new System.Drawing.Size(64, 28);
label4.TabIndex = 6;
label4.Text = "Color:";
label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -179,9 +176,9 @@
//
label5.AutoSize = true;
label5.Dock = System.Windows.Forms.DockStyle.Fill;
label5.Location = new System.Drawing.Point(3, 402);
label5.Location = new System.Drawing.Point(3, 300);
label5.Name = "label5";
label5.Size = new System.Drawing.Size(74, 38);
label5.Size = new System.Drawing.Size(64, 28);
label5.TabIndex = 7;
label5.Text = "Mileage:";
label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -190,9 +187,9 @@
//
label6.AutoSize = true;
label6.Dock = System.Windows.Forms.DockStyle.Fill;
label6.Location = new System.Drawing.Point(3, 440);
label6.Location = new System.Drawing.Point(3, 328);
label6.Name = "label6";
label6.Size = new System.Drawing.Size(74, 38);
label6.Size = new System.Drawing.Size(64, 28);
label6.TabIndex = 8;
label6.Text = "Price:";
label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -205,19 +202,17 @@
flowLayoutPanel1.Controls.Add(lblID);
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
flowLayoutPanel1.Location = new System.Drawing.Point(3, 482);
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
flowLayoutPanel1.Location = new System.Drawing.Point(3, 359);
flowLayoutPanel1.Name = "flowLayoutPanel1";
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
flowLayoutPanel1.Size = new System.Drawing.Size(530, 76);
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(4);
flowLayoutPanel1.Size = new System.Drawing.Size(463, 60);
flowLayoutPanel1.TabIndex = 9;
//
// btnSave
//
btnSave.Location = new System.Drawing.Point(442, 10);
btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
btnSave.Location = new System.Drawing.Point(386, 7);
btnSave.Name = "btnSave";
btnSave.Size = new System.Drawing.Size(75, 29);
btnSave.Size = new System.Drawing.Size(66, 22);
btnSave.TabIndex = 7;
btnSave.Text = "Save";
btnSave.UseVisualStyleBackColor = true;
@@ -225,10 +220,9 @@
//
// btnDelete
//
btnDelete.Location = new System.Drawing.Point(361, 10);
btnDelete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
btnDelete.Location = new System.Drawing.Point(314, 7);
btnDelete.Name = "btnDelete";
btnDelete.Size = new System.Drawing.Size(75, 29);
btnDelete.Size = new System.Drawing.Size(66, 22);
btnDelete.TabIndex = 8;
btnDelete.Text = "Delete";
btnDelete.UseVisualStyleBackColor = true;
@@ -237,30 +231,28 @@
// lblID
//
lblID.AutoSize = true;
lblID.Location = new System.Drawing.Point(331, 6);
lblID.Location = new System.Drawing.Point(290, 4);
lblID.Name = "lblID";
lblID.Size = new System.Drawing.Size(24, 20);
lblID.Size = new System.Drawing.Size(18, 15);
lblID.TabIndex = 2;
lblID.Text = "ID";
//
// tbxColor
//
tbxColor.Dock = System.Windows.Forms.DockStyle.Fill;
tbxColor.Location = new System.Drawing.Point(83, 368);
tbxColor.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tbxColor.Location = new System.Drawing.Point(73, 275);
tbxColor.Name = "tbxColor";
tbxColor.Size = new System.Drawing.Size(450, 27);
tbxColor.Size = new System.Drawing.Size(393, 23);
tbxColor.TabIndex = 4;
tbxColor.TextChanged += tbxColor_TextChanged;
tbxColor.Leave += tbxColor_Leave;
//
// nudMileage
//
nudMileage.Location = new System.Drawing.Point(83, 406);
nudMileage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
nudMileage.Location = new System.Drawing.Point(73, 303);
nudMileage.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
nudMileage.Name = "nudMileage";
nudMileage.Size = new System.Drawing.Size(120, 27);
nudMileage.Size = new System.Drawing.Size(105, 23);
nudMileage.TabIndex = 5;
nudMileage.ThousandsSeparator = true;
nudMileage.ValueChanged += nudMileage_ValueChanged;
@@ -268,11 +260,10 @@
// nudPrice
//
nudPrice.DecimalPlaces = 2;
nudPrice.Location = new System.Drawing.Point(83, 444);
nudPrice.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
nudPrice.Location = new System.Drawing.Point(73, 331);
nudPrice.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
nudPrice.Name = "nudPrice";
nudPrice.Size = new System.Drawing.Size(120, 27);
nudPrice.Size = new System.Drawing.Size(105, 23);
nudPrice.TabIndex = 6;
nudPrice.ThousandsSeparator = true;
nudPrice.ValueChanged += nudPrice_ValueChanged;
@@ -287,21 +278,19 @@
tableLayoutPanel2.Controls.Add(lblAge, 1, 0);
tableLayoutPanel2.Controls.Add(tbxAge, 2, 0);
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel2.Location = new System.Drawing.Point(83, 330);
tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tableLayoutPanel2.Location = new System.Drawing.Point(73, 247);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel2.Size = new System.Drawing.Size(450, 30);
tableLayoutPanel2.Size = new System.Drawing.Size(393, 22);
tableLayoutPanel2.TabIndex = 10;
//
// nudYear
//
nudYear.Location = new System.Drawing.Point(3, 4);
nudYear.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
nudYear.Location = new System.Drawing.Point(3, 3);
nudYear.Maximum = new decimal(new int[] { 3000, 0, 0, 0 });
nudYear.Name = "nudYear";
nudYear.Size = new System.Drawing.Size(120, 27);
nudYear.Size = new System.Drawing.Size(105, 23);
nudYear.TabIndex = 3;
nudYear.ValueChanged += nudYear_ValueChanged;
//
@@ -309,10 +298,10 @@
//
lblAge.AutoSize = true;
lblAge.Dock = System.Windows.Forms.DockStyle.Fill;
lblAge.Location = new System.Drawing.Point(153, 0);
lblAge.Location = new System.Drawing.Point(134, 0);
lblAge.Name = "lblAge";
lblAge.RightToLeft = System.Windows.Forms.RightToLeft.No;
lblAge.Size = new System.Drawing.Size(144, 30);
lblAge.Size = new System.Drawing.Size(125, 22);
lblAge.TabIndex = 4;
lblAge.Text = "Age";
lblAge.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -321,21 +310,19 @@
//
tbxAge.Dock = System.Windows.Forms.DockStyle.Fill;
tbxAge.Enabled = false;
tbxAge.Location = new System.Drawing.Point(303, 4);
tbxAge.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tbxAge.Location = new System.Drawing.Point(265, 3);
tbxAge.Name = "tbxAge";
tbxAge.ReadOnly = true;
tbxAge.Size = new System.Drawing.Size(144, 27);
tbxAge.Size = new System.Drawing.Size(125, 23);
tbxAge.TabIndex = 5;
//
// CarDetailsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(536, 562);
ClientSize = new System.Drawing.Size(469, 422);
Controls.Add(tableLayoutPanel1);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
MaximizeBox = false;
Name = "CarDetailsForm";
Text = "Details";

View File

@@ -13,13 +13,18 @@ namespace CarManagerV3
List<Car> cars = new List<Car>();
string filepath = "";
public MainForm()
public MainForm(string pathToOpen = "")
{
InitializeComponent();
// Open the most recent file if it exists. Otherwise, use default filepath.
List<string> recentFiles = SafeManager.GetRecentPaths();
if (recentFiles.Count > 0)
if (!String.IsNullOrEmpty(pathToOpen))
{
filepath = pathToOpen;
SafeManager.AddRecentPath(filepath);
}
else if (recentFiles.Count > 0)
{
filepath = recentFiles[0];
}