Compare commits
29 Commits
1082e63244
...
1.4.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
| fe92236978 | |||
| ff101bf569 | |||
| 74fddcdb9d | |||
| 3cc1631d5a | |||
| 0e8c9fc691 | |||
| a0de93f98c | |||
| da8ce47f8b | |||
| e8972ed2bb | |||
| 41b3725faa | |||
| 1366481931 | |||
| 56165cae46 | |||
| 86e6be2bd3 | |||
| f24d1321a8 | |||
| 8245955e9c | |||
| a7aad1a5ef | |||
| f065f58f71 | |||
| f2e4addbb0 | |||
| 6958781dec | |||
| d3d704ebf4 | |||
| 49c963078a | |||
| 11ea32b490 | |||
| b20f92274f | |||
| ff3805f8d1 | |||
| bf42b4219b | |||
| 835286b629 | |||
| fe5d22a811 | |||
| 808b0c4720 | |||
| 9be57d3c5f | |||
| 3d8b7e921a |
1115
CarManager3Setup/CarManager3Setup.vdproj
Normal file
1115
CarManager3Setup/CarManager3Setup.vdproj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 18
|
||||||
VisualStudioVersion = 17.14.36414.22
|
VisualStudioVersion = 18.3.11520.95
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarManagerV3", "CarManagerV3\CarManagerV3.csproj", "{93CA258B-A645-41A8-A24F-59036ABC173F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarManagerV3", "CarManagerV3\CarManagerV3.csproj", "{93CA258B-A645-41A8-A24F-59036ABC173F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "CarManager3Setup", "CarManager3Setup\CarManager3Setup.vdproj", "{47ED51EB-1DD0-B8F0-88C8-92C6E3E06030}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -15,6 +17,9 @@ Global
|
|||||||
{93CA258B-A645-41A8-A24F-59036ABC173F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{93CA258B-A645-41A8-A24F-59036ABC173F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{93CA258B-A645-41A8-A24F-59036ABC173F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{93CA258B-A645-41A8-A24F-59036ABC173F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{93CA258B-A645-41A8-A24F-59036ABC173F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{93CA258B-A645-41A8-A24F-59036ABC173F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{47ED51EB-1DD0-B8F0-88C8-92C6E3E06030}.Debug|Any CPU.ActiveCfg = Debug
|
||||||
|
{47ED51EB-1DD0-B8F0-88C8-92C6E3E06030}.Release|Any CPU.ActiveCfg = Release
|
||||||
|
{47ED51EB-1DD0-B8F0-88C8-92C6E3E06030}.Release|Any CPU.Build.0 = Release
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="CarManagerV3.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<userSettings>
|
||||||
|
<CarManagerV3.Properties.Settings>
|
||||||
|
<setting name="DataLocation" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="AllowPrerelease" serializeAs="String">
|
||||||
|
<value>False</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="LastFetchedAutoCompletions" serializeAs="String">
|
||||||
|
<value>2026-01-01</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="FetchAutoCompletionsInterval" serializeAs="String">
|
||||||
|
<value>24.00:00:00</value>
|
||||||
|
</setting>
|
||||||
|
</CarManagerV3.Properties.Settings>
|
||||||
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
@@ -13,19 +15,33 @@
|
|||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.4.3.1</ApplicationVersion>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<!--<GenerateAssemblyInfo>false</GenerateAssemblyInfo>-->
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||||
|
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
|
||||||
|
<AssemblyTitle>CarManager3</AssemblyTitle>
|
||||||
|
<Product>CarManager3</Product>
|
||||||
|
<Version>1.4.3.1</Version>
|
||||||
|
<Authors>Jaro Digital</Authors>
|
||||||
|
<Company>Jaro Digital</Company>
|
||||||
|
<Title>Car Manager 3</Title>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Forms\Components\CarCard.cs">
|
<Compile Update="Forms\Components\CarCard.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -41,4 +57,13 @@
|
|||||||
<Install>false</Install>
|
<Install>false</Install>
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="CarMgm_Icon.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
BIN
CarManagerV3/CarMgm_Icon.ico
Normal file
BIN
CarManagerV3/CarMgm_Icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
50
CarManagerV3/Classes/CarManufacturer.cs
Normal file
50
CarManagerV3/Classes/CarManufacturer.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Classes
|
||||||
|
{
|
||||||
|
internal class CarManufacturer
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public List<string> Models { get; set; }
|
||||||
|
|
||||||
|
public CarManufacturer(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Models = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddModel(string model)
|
||||||
|
{
|
||||||
|
Models.Add(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{Name} - Models: {string.Join(", ", Models)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> GetModels()
|
||||||
|
{
|
||||||
|
return Models;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveModel(string model)
|
||||||
|
{
|
||||||
|
Models.Remove(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearModels()
|
||||||
|
{
|
||||||
|
Models.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetModelByQuery(string query)
|
||||||
|
{
|
||||||
|
return Models.FirstOrDefault(m => m.Equals(query, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
70
CarManagerV3/Forms/CarDetailsForm.Designer.cs
generated
70
CarManagerV3/Forms/CarDetailsForm.Designer.cs
generated
@@ -85,15 +85,15 @@
|
|||||||
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 30, 4);
|
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 30, 4);
|
||||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
tableLayoutPanel1.RowCount = 8;
|
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, 251F));
|
||||||
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, 37F));
|
||||||
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, 37F));
|
||||||
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, 37F));
|
||||||
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, 37F));
|
||||||
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, 37F));
|
||||||
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, 37F));
|
||||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 51F));
|
||||||
tableLayoutPanel1.Size = new System.Drawing.Size(536, 562);
|
tableLayoutPanel1.Size = new System.Drawing.Size(536, 563);
|
||||||
tableLayoutPanel1.TabIndex = 0;
|
tableLayoutPanel1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// pbxCarImage
|
// pbxCarImage
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
pbxCarImage.Location = new System.Drawing.Point(3, 4);
|
pbxCarImage.Location = new System.Drawing.Point(3, 4);
|
||||||
pbxCarImage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
pbxCarImage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
pbxCarImage.Name = "pbxCarImage";
|
pbxCarImage.Name = "pbxCarImage";
|
||||||
pbxCarImage.Size = new System.Drawing.Size(530, 242);
|
pbxCarImage.Size = new System.Drawing.Size(530, 243);
|
||||||
pbxCarImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
pbxCarImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
pbxCarImage.TabIndex = 0;
|
pbxCarImage.TabIndex = 0;
|
||||||
pbxCarImage.TabStop = false;
|
pbxCarImage.TabStop = false;
|
||||||
@@ -113,9 +113,9 @@
|
|||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label1.Location = new System.Drawing.Point(3, 250);
|
label1.Location = new System.Drawing.Point(3, 251);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new System.Drawing.Size(74, 38);
|
label1.Size = new System.Drawing.Size(74, 37);
|
||||||
label1.TabIndex = 1;
|
label1.TabIndex = 1;
|
||||||
label1.Text = "Make:";
|
label1.Text = "Make:";
|
||||||
label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
// tbxMake
|
// tbxMake
|
||||||
//
|
//
|
||||||
tbxMake.Dock = System.Windows.Forms.DockStyle.Fill;
|
tbxMake.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
tbxMake.Location = new System.Drawing.Point(83, 254);
|
tbxMake.Location = new System.Drawing.Point(83, 255);
|
||||||
tbxMake.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
tbxMake.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
tbxMake.Name = "tbxMake";
|
tbxMake.Name = "tbxMake";
|
||||||
tbxMake.Size = new System.Drawing.Size(450, 27);
|
tbxMake.Size = new System.Drawing.Size(450, 27);
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
label2.Dock = System.Windows.Forms.DockStyle.Fill;
|
label2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label2.Location = new System.Drawing.Point(3, 288);
|
label2.Location = new System.Drawing.Point(3, 288);
|
||||||
label2.Name = "label2";
|
label2.Name = "label2";
|
||||||
label2.Size = new System.Drawing.Size(74, 38);
|
label2.Size = new System.Drawing.Size(74, 37);
|
||||||
label2.TabIndex = 3;
|
label2.TabIndex = 3;
|
||||||
label2.Text = "Model:";
|
label2.Text = "Model:";
|
||||||
label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -157,9 +157,9 @@
|
|||||||
//
|
//
|
||||||
label3.AutoSize = true;
|
label3.AutoSize = true;
|
||||||
label3.Dock = System.Windows.Forms.DockStyle.Fill;
|
label3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label3.Location = new System.Drawing.Point(3, 326);
|
label3.Location = new System.Drawing.Point(3, 325);
|
||||||
label3.Name = "label3";
|
label3.Name = "label3";
|
||||||
label3.Size = new System.Drawing.Size(74, 38);
|
label3.Size = new System.Drawing.Size(74, 37);
|
||||||
label3.TabIndex = 5;
|
label3.TabIndex = 5;
|
||||||
label3.Text = "Year:";
|
label3.Text = "Year:";
|
||||||
label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -168,9 +168,9 @@
|
|||||||
//
|
//
|
||||||
label4.AutoSize = true;
|
label4.AutoSize = true;
|
||||||
label4.Dock = System.Windows.Forms.DockStyle.Fill;
|
label4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label4.Location = new System.Drawing.Point(3, 364);
|
label4.Location = new System.Drawing.Point(3, 362);
|
||||||
label4.Name = "label4";
|
label4.Name = "label4";
|
||||||
label4.Size = new System.Drawing.Size(74, 38);
|
label4.Size = new System.Drawing.Size(74, 37);
|
||||||
label4.TabIndex = 6;
|
label4.TabIndex = 6;
|
||||||
label4.Text = "Color:";
|
label4.Text = "Color:";
|
||||||
label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -179,9 +179,9 @@
|
|||||||
//
|
//
|
||||||
label5.AutoSize = true;
|
label5.AutoSize = true;
|
||||||
label5.Dock = System.Windows.Forms.DockStyle.Fill;
|
label5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label5.Location = new System.Drawing.Point(3, 402);
|
label5.Location = new System.Drawing.Point(3, 399);
|
||||||
label5.Name = "label5";
|
label5.Name = "label5";
|
||||||
label5.Size = new System.Drawing.Size(74, 38);
|
label5.Size = new System.Drawing.Size(74, 37);
|
||||||
label5.TabIndex = 7;
|
label5.TabIndex = 7;
|
||||||
label5.Text = "Mileage:";
|
label5.Text = "Mileage:";
|
||||||
label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -190,9 +190,9 @@
|
|||||||
//
|
//
|
||||||
label6.AutoSize = true;
|
label6.AutoSize = true;
|
||||||
label6.Dock = System.Windows.Forms.DockStyle.Fill;
|
label6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
label6.Location = new System.Drawing.Point(3, 440);
|
label6.Location = new System.Drawing.Point(3, 436);
|
||||||
label6.Name = "label6";
|
label6.Name = "label6";
|
||||||
label6.Size = new System.Drawing.Size(74, 38);
|
label6.Size = new System.Drawing.Size(74, 37);
|
||||||
label6.TabIndex = 8;
|
label6.TabIndex = 8;
|
||||||
label6.Text = "Price:";
|
label6.Text = "Price:";
|
||||||
label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -205,16 +205,16 @@
|
|||||||
flowLayoutPanel1.Controls.Add(lblID);
|
flowLayoutPanel1.Controls.Add(lblID);
|
||||||
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
flowLayoutPanel1.Location = new System.Drawing.Point(3, 482);
|
flowLayoutPanel1.Location = new System.Drawing.Point(3, 477);
|
||||||
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
|
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(5);
|
||||||
flowLayoutPanel1.Size = new System.Drawing.Size(530, 76);
|
flowLayoutPanel1.Size = new System.Drawing.Size(530, 82);
|
||||||
flowLayoutPanel1.TabIndex = 9;
|
flowLayoutPanel1.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// btnSave
|
// btnSave
|
||||||
//
|
//
|
||||||
btnSave.Location = new System.Drawing.Point(442, 10);
|
btnSave.Location = new System.Drawing.Point(442, 9);
|
||||||
btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
btnSave.Name = "btnSave";
|
btnSave.Name = "btnSave";
|
||||||
btnSave.Size = new System.Drawing.Size(75, 29);
|
btnSave.Size = new System.Drawing.Size(75, 29);
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
//
|
//
|
||||||
// btnDelete
|
// btnDelete
|
||||||
//
|
//
|
||||||
btnDelete.Location = new System.Drawing.Point(361, 10);
|
btnDelete.Location = new System.Drawing.Point(361, 9);
|
||||||
btnDelete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
btnDelete.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
btnDelete.Name = "btnDelete";
|
btnDelete.Name = "btnDelete";
|
||||||
btnDelete.Size = new System.Drawing.Size(75, 29);
|
btnDelete.Size = new System.Drawing.Size(75, 29);
|
||||||
@@ -237,7 +237,7 @@
|
|||||||
// lblID
|
// lblID
|
||||||
//
|
//
|
||||||
lblID.AutoSize = true;
|
lblID.AutoSize = true;
|
||||||
lblID.Location = new System.Drawing.Point(331, 6);
|
lblID.Location = new System.Drawing.Point(331, 5);
|
||||||
lblID.Name = "lblID";
|
lblID.Name = "lblID";
|
||||||
lblID.Size = new System.Drawing.Size(24, 20);
|
lblID.Size = new System.Drawing.Size(24, 20);
|
||||||
lblID.TabIndex = 2;
|
lblID.TabIndex = 2;
|
||||||
@@ -246,7 +246,7 @@
|
|||||||
// tbxColor
|
// tbxColor
|
||||||
//
|
//
|
||||||
tbxColor.Dock = System.Windows.Forms.DockStyle.Fill;
|
tbxColor.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
tbxColor.Location = new System.Drawing.Point(83, 368);
|
tbxColor.Location = new System.Drawing.Point(83, 366);
|
||||||
tbxColor.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
tbxColor.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
tbxColor.Name = "tbxColor";
|
tbxColor.Name = "tbxColor";
|
||||||
tbxColor.Size = new System.Drawing.Size(450, 27);
|
tbxColor.Size = new System.Drawing.Size(450, 27);
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
//
|
//
|
||||||
// nudMileage
|
// nudMileage
|
||||||
//
|
//
|
||||||
nudMileage.Location = new System.Drawing.Point(83, 406);
|
nudMileage.Location = new System.Drawing.Point(83, 403);
|
||||||
nudMileage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
nudMileage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
nudMileage.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
nudMileage.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
||||||
nudMileage.Name = "nudMileage";
|
nudMileage.Name = "nudMileage";
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
// nudPrice
|
// nudPrice
|
||||||
//
|
//
|
||||||
nudPrice.DecimalPlaces = 2;
|
nudPrice.DecimalPlaces = 2;
|
||||||
nudPrice.Location = new System.Drawing.Point(83, 444);
|
nudPrice.Location = new System.Drawing.Point(83, 440);
|
||||||
nudPrice.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
nudPrice.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
nudPrice.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
nudPrice.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
|
||||||
nudPrice.Name = "nudPrice";
|
nudPrice.Name = "nudPrice";
|
||||||
@@ -287,12 +287,12 @@
|
|||||||
tableLayoutPanel2.Controls.Add(lblAge, 1, 0);
|
tableLayoutPanel2.Controls.Add(lblAge, 1, 0);
|
||||||
tableLayoutPanel2.Controls.Add(tbxAge, 2, 0);
|
tableLayoutPanel2.Controls.Add(tbxAge, 2, 0);
|
||||||
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
tableLayoutPanel2.Location = new System.Drawing.Point(83, 330);
|
tableLayoutPanel2.Location = new System.Drawing.Point(83, 329);
|
||||||
tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||||
tableLayoutPanel2.RowCount = 1;
|
tableLayoutPanel2.RowCount = 1;
|
||||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
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(450, 29);
|
||||||
tableLayoutPanel2.TabIndex = 10;
|
tableLayoutPanel2.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// nudYear
|
// nudYear
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
lblAge.Location = new System.Drawing.Point(153, 0);
|
lblAge.Location = new System.Drawing.Point(153, 0);
|
||||||
lblAge.Name = "lblAge";
|
lblAge.Name = "lblAge";
|
||||||
lblAge.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
lblAge.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||||
lblAge.Size = new System.Drawing.Size(144, 30);
|
lblAge.Size = new System.Drawing.Size(144, 29);
|
||||||
lblAge.TabIndex = 4;
|
lblAge.TabIndex = 4;
|
||||||
lblAge.Text = "Age";
|
lblAge.Text = "Age";
|
||||||
lblAge.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
lblAge.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
@@ -332,7 +332,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
ClientSize = new System.Drawing.Size(536, 562);
|
ClientSize = new System.Drawing.Size(536, 563);
|
||||||
Controls.Add(tableLayoutPanel1);
|
Controls.Add(tableLayoutPanel1);
|
||||||
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using CarManagerV3.Util;
|
||||||
|
|
||||||
namespace CarManagerV3
|
namespace CarManagerV3
|
||||||
{
|
{
|
||||||
@@ -29,6 +30,39 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
lblID.Text = $"ID: {car.Id}";
|
lblID.Text = $"ID: {car.Id}";
|
||||||
}
|
}
|
||||||
|
SetAutoCompleteForMake();
|
||||||
|
SetAutoCompleteForModel();
|
||||||
|
SetAutoCompleteForColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetAutoCompleteForMake()
|
||||||
|
{
|
||||||
|
var makes = CarCompletions.GetCarBrands();
|
||||||
|
var makeAutoComplete = new AutoCompleteStringCollection();
|
||||||
|
makeAutoComplete.AddRange(makes.ToArray());
|
||||||
|
tbxMake.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
|
||||||
|
tbxMake.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||||
|
tbxMake.AutoCompleteCustomSource = makeAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetAutoCompleteForModel()
|
||||||
|
{
|
||||||
|
var models = CarCompletions.GetCarModels(tbxMake.Text);
|
||||||
|
var modelAutoComplete = new AutoCompleteStringCollection();
|
||||||
|
modelAutoComplete.AddRange(models.ToArray());
|
||||||
|
tbxModel.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
|
||||||
|
tbxModel.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||||
|
tbxModel.AutoCompleteCustomSource = modelAutoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetAutoCompleteForColor()
|
||||||
|
{
|
||||||
|
var colors = CarCompletions.CommonColors;
|
||||||
|
var colorAutoComplete = new AutoCompleteStringCollection();
|
||||||
|
colorAutoComplete.AddRange(colors.ToArray());
|
||||||
|
tbxColor.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
|
||||||
|
tbxColor.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||||
|
tbxColor.AutoCompleteCustomSource = colorAutoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -69,6 +103,7 @@ namespace CarManagerV3
|
|||||||
() => car.Make = ValueOrFormer(tbxMake.Text, car.Make),
|
() => car.Make = ValueOrFormer(tbxMake.Text, car.Make),
|
||||||
() => tbxMake.Text = car.Make
|
() => tbxMake.Text = car.Make
|
||||||
);
|
);
|
||||||
|
SetAutoCompleteForModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tbxModel_TextChanged(object sender, EventArgs e)
|
private void tbxModel_TextChanged(object sender, EventArgs e)
|
||||||
@@ -163,7 +198,8 @@ namespace CarManagerV3
|
|||||||
|
|
||||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||||
{
|
{
|
||||||
if (keyData == Keys.Enter)
|
// Ctrl+S to save, Esc to close, Delete to delete
|
||||||
|
if (keyData == (Keys.Control | Keys.S))
|
||||||
{
|
{
|
||||||
btnSave.PerformClick();
|
btnSave.PerformClick();
|
||||||
return true; // Indicate that the key has been handled
|
return true; // Indicate that the key has been handled
|
||||||
|
|||||||
180
CarManagerV3/Forms/Components/AnimatedProgressBar.cs
Normal file
180
CarManagerV3/Forms/Components/AnimatedProgressBar.cs
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace CarManagerV3
|
||||||
|
{
|
||||||
|
public class AnimatedProgressBar : UserControl
|
||||||
|
{
|
||||||
|
private Timer animationTimer;
|
||||||
|
private float animationPosition = 0f;
|
||||||
|
private Color primaryColor = Color.FromArgb(0, 120, 215);
|
||||||
|
private Color secondaryColor = Color.FromArgb(100, 180, 255);
|
||||||
|
private Color backgroundColor = Color.FromArgb(240, 240, 240);
|
||||||
|
|
||||||
|
public AnimatedProgressBar()
|
||||||
|
{
|
||||||
|
this.SetStyle(
|
||||||
|
ControlStyles.AllPaintingInWmPaint |
|
||||||
|
ControlStyles.UserPaint |
|
||||||
|
ControlStyles.OptimizedDoubleBuffer |
|
||||||
|
ControlStyles.ResizeRedraw,
|
||||||
|
true);
|
||||||
|
|
||||||
|
this.Height = 8;
|
||||||
|
|
||||||
|
// Initialize animation timer
|
||||||
|
animationTimer = new Timer();
|
||||||
|
animationTimer.Interval = 20; // 50 FPS
|
||||||
|
animationTimer.Tick += AnimationTimer_Tick;
|
||||||
|
animationTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AnimationTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
animationPosition += 2f;
|
||||||
|
if (animationPosition > this.Width + 100)
|
||||||
|
{
|
||||||
|
animationPosition = -100;
|
||||||
|
}
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnPaint(e);
|
||||||
|
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
|
|
||||||
|
// Draw background with rounded corners
|
||||||
|
using (GraphicsPath path = GetRoundedRect(ClientRectangle, 4))
|
||||||
|
{
|
||||||
|
using (SolidBrush bgBrush = new SolidBrush(backgroundColor))
|
||||||
|
{
|
||||||
|
g.FillPath(bgBrush, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create animated gradient bar
|
||||||
|
float barWidth = 100f;
|
||||||
|
RectangleF barRect = new RectangleF(animationPosition, 0, barWidth, this.Height);
|
||||||
|
|
||||||
|
if (barRect.Right > 0 && barRect.Left < this.Width)
|
||||||
|
{
|
||||||
|
using (GraphicsPath barPath = GetRoundedRect(barRect, 4))
|
||||||
|
{
|
||||||
|
// Create gradient brush
|
||||||
|
using (LinearGradientBrush gradientBrush = new LinearGradientBrush(
|
||||||
|
barRect,
|
||||||
|
Color.Transparent,
|
||||||
|
Color.Transparent,
|
||||||
|
LinearGradientMode.Horizontal))
|
||||||
|
{
|
||||||
|
ColorBlend colorBlend = new ColorBlend();
|
||||||
|
colorBlend.Colors = new Color[] {
|
||||||
|
Color.FromArgb(0, primaryColor),
|
||||||
|
primaryColor,
|
||||||
|
secondaryColor,
|
||||||
|
primaryColor,
|
||||||
|
Color.FromArgb(0, primaryColor)
|
||||||
|
};
|
||||||
|
colorBlend.Positions = new float[] { 0f, 0.2f, 0.5f, 0.8f, 1f };
|
||||||
|
gradientBrush.InterpolationColors = colorBlend;
|
||||||
|
|
||||||
|
// Clip to control bounds
|
||||||
|
Region oldClip = g.Clip;
|
||||||
|
using (GraphicsPath clipPath = GetRoundedRect(ClientRectangle, 4))
|
||||||
|
{
|
||||||
|
g.SetClip(clipPath);
|
||||||
|
g.FillPath(gradientBrush, barPath);
|
||||||
|
g.Clip = oldClip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw subtle border
|
||||||
|
using (GraphicsPath borderPath = GetRoundedRect(ClientRectangle, 4))
|
||||||
|
{
|
||||||
|
using (Pen borderPen = new Pen(Color.FromArgb(220, 220, 220), 1))
|
||||||
|
{
|
||||||
|
g.DrawPath(borderPen, borderPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private GraphicsPath GetRoundedRect(RectangleF rect, float radius)
|
||||||
|
{
|
||||||
|
GraphicsPath path = new GraphicsPath();
|
||||||
|
float diameter = radius * 2;
|
||||||
|
|
||||||
|
path.AddArc(rect.X, rect.Y, diameter, diameter, 180, 90);
|
||||||
|
path.AddArc(rect.Right - diameter, rect.Y, diameter, diameter, 270, 90);
|
||||||
|
path.AddArc(rect.Right - diameter, rect.Bottom - diameter, diameter, diameter, 0, 90);
|
||||||
|
path.AddArc(rect.X, rect.Bottom - diameter, diameter, diameter, 90, 90);
|
||||||
|
path.CloseFigure();
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartAnimation()
|
||||||
|
{
|
||||||
|
animationTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopAnimation()
|
||||||
|
{
|
||||||
|
animationTimer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
//protected override void Dispose(bool disposing)
|
||||||
|
//{
|
||||||
|
// if (disposing)
|
||||||
|
// {
|
||||||
|
// animationTimer?.Stop();
|
||||||
|
// animationTimer?.Dispose();
|
||||||
|
// }
|
||||||
|
// base.Dispose(disposing);
|
||||||
|
//}
|
||||||
|
|
||||||
|
// Properties for customization
|
||||||
|
public Color PrimaryColor
|
||||||
|
{
|
||||||
|
get => primaryColor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primaryColor = value;
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color SecondaryColor
|
||||||
|
{
|
||||||
|
get => secondaryColor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
secondaryColor = value;
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color ProgressBackColor
|
||||||
|
{
|
||||||
|
get => backgroundColor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
backgroundColor = value;
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
CarManagerV3/Forms/Components/AnimatedProgressBar.resx
Normal file
120
CarManagerV3/Forms/Components/AnimatedProgressBar.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
121
CarManagerV3/Forms/Components/CarCard.Designer.cs
generated
121
CarManagerV3/Forms/Components/CarCard.Designer.cs
generated
@@ -29,81 +29,82 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarCard));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarCard));
|
||||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.lblCarDetails = new System.Windows.Forms.Label();
|
lblCarDetails = new System.Windows.Forms.Label();
|
||||||
this.lblCarName = new System.Windows.Forms.Label();
|
lblCarName = new System.Windows.Forms.Label();
|
||||||
this.pbxCar = new System.Windows.Forms.PictureBox();
|
pbxCar = new System.Windows.Forms.PictureBox();
|
||||||
this.tableLayoutPanel1.SuspendLayout();
|
tableLayoutPanel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pbxCar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pbxCar).BeginInit();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// tableLayoutPanel1
|
// tableLayoutPanel1
|
||||||
//
|
//
|
||||||
this.tableLayoutPanel1.AutoSize = true;
|
tableLayoutPanel1.AutoSize = true;
|
||||||
this.tableLayoutPanel1.ColumnCount = 1;
|
tableLayoutPanel1.ColumnCount = 1;
|
||||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tableLayoutPanel1.Controls.Add(this.lblCarDetails, 0, 2);
|
tableLayoutPanel1.Controls.Add(lblCarDetails, 0, 2);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.lblCarName, 0, 1);
|
tableLayoutPanel1.Controls.Add(lblCarName, 0, 1);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.pbxCar, 0, 0);
|
tableLayoutPanel1.Controls.Add(pbxCar, 0, 0);
|
||||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.tableLayoutPanel1.MaximumSize = new System.Drawing.Size(210, 0);
|
tableLayoutPanel1.MaximumSize = new System.Drawing.Size(184, 0);
|
||||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
this.tableLayoutPanel1.RowCount = 3;
|
tableLayoutPanel1.RowCount = 3;
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 130F));
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 122F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(210, 200);
|
tableLayoutPanel1.Size = new System.Drawing.Size(184, 188);
|
||||||
this.tableLayoutPanel1.TabIndex = 0;
|
tableLayoutPanel1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// lblCarDetails
|
// lblCarDetails
|
||||||
//
|
//
|
||||||
this.lblCarDetails.AutoSize = true;
|
lblCarDetails.AutoSize = true;
|
||||||
this.lblCarDetails.Location = new System.Drawing.Point(3, 174);
|
lblCarDetails.Location = new System.Drawing.Point(3, 166);
|
||||||
this.lblCarDetails.Name = "lblCarDetails";
|
lblCarDetails.Name = "lblCarDetails";
|
||||||
this.lblCarDetails.Size = new System.Drawing.Size(101, 16);
|
lblCarDetails.Size = new System.Drawing.Size(92, 15);
|
||||||
this.lblCarDetails.TabIndex = 5;
|
lblCarDetails.TabIndex = 5;
|
||||||
this.lblCarDetails.Text = "2009 - 13.000km";
|
lblCarDetails.Text = "2009 - 13.000km";
|
||||||
//
|
//
|
||||||
// lblCarName
|
// lblCarName
|
||||||
//
|
//
|
||||||
this.lblCarName.AutoSize = true;
|
lblCarName.AutoSize = true;
|
||||||
this.lblCarName.Dock = System.Windows.Forms.DockStyle.Fill;
|
lblCarName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.lblCarName.Font = new System.Drawing.Font("Arial", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
lblCarName.Font = new System.Drawing.Font("Arial", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
|
||||||
this.lblCarName.Location = new System.Drawing.Point(3, 130);
|
lblCarName.Location = new System.Drawing.Point(3, 122);
|
||||||
this.lblCarName.Name = "lblCarName";
|
lblCarName.Name = "lblCarName";
|
||||||
this.lblCarName.Size = new System.Drawing.Size(204, 44);
|
lblCarName.Size = new System.Drawing.Size(178, 44);
|
||||||
this.lblCarName.TabIndex = 4;
|
lblCarName.TabIndex = 4;
|
||||||
this.lblCarName.Text = "Skoda Fabia fdsdfsdfsdfsdf";
|
lblCarName.Text = "Skoda Fabia fdsdfsdfsdfsdf";
|
||||||
this.lblCarName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
lblCarName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
//
|
//
|
||||||
// pbxCar
|
// pbxCar
|
||||||
//
|
//
|
||||||
this.pbxCar.Dock = System.Windows.Forms.DockStyle.Fill;
|
pbxCar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pbxCar.Image = ((System.Drawing.Image)(resources.GetObject("pbxCar.Image")));
|
pbxCar.ErrorImage = (System.Drawing.Image)resources.GetObject("pbxCar.ErrorImage");
|
||||||
this.pbxCar.ImageLocation = "";
|
pbxCar.Image = (System.Drawing.Image)resources.GetObject("pbxCar.Image");
|
||||||
this.pbxCar.InitialImage = ((System.Drawing.Image)(resources.GetObject("pbxCar.InitialImage")));
|
pbxCar.ImageLocation = "";
|
||||||
this.pbxCar.Location = new System.Drawing.Point(3, 3);
|
pbxCar.InitialImage = (System.Drawing.Image)resources.GetObject("pbxCar.InitialImage");
|
||||||
this.pbxCar.Name = "pbxCar";
|
pbxCar.Location = new System.Drawing.Point(3, 3);
|
||||||
this.pbxCar.Size = new System.Drawing.Size(204, 124);
|
pbxCar.Name = "pbxCar";
|
||||||
this.pbxCar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
pbxCar.Size = new System.Drawing.Size(178, 116);
|
||||||
this.pbxCar.TabIndex = 3;
|
pbxCar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
this.pbxCar.TabStop = false;
|
pbxCar.TabIndex = 3;
|
||||||
|
pbxCar.TabStop = false;
|
||||||
//
|
//
|
||||||
// CarCard
|
// CarCard
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.AutoSize = true;
|
AutoSize = true;
|
||||||
this.BackColor = System.Drawing.SystemColors.Control;
|
BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.Controls.Add(this.tableLayoutPanel1);
|
Controls.Add(tableLayoutPanel1);
|
||||||
this.Name = "CarCard";
|
Name = "CarCard";
|
||||||
this.Size = new System.Drawing.Size(210, 200);
|
Size = new System.Drawing.Size(184, 188);
|
||||||
this.tableLayoutPanel1.ResumeLayout(false);
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
this.tableLayoutPanel1.PerformLayout();
|
tableLayoutPanel1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pbxCar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)pbxCar).EndInit();
|
||||||
this.ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
this.PerformLayout();
|
PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ namespace CarManagerV3
|
|||||||
|
|
||||||
public async void LoadImage()
|
public async void LoadImage()
|
||||||
{
|
{
|
||||||
|
this.CarImage = null; // Clear current image
|
||||||
this.CarImage = pbxCar.InitialImage; // Set to loading image
|
this.CarImage = pbxCar.InitialImage; // Set to loading image
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -58,6 +59,10 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
this.CarImage = img;
|
this.CarImage = img;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.CarImage = pbxCar.ErrorImage; // Set to error image if loading fails
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
146
CarManagerV3/Forms/MainForm.Designer.cs
generated
146
CarManagerV3/Forms/MainForm.Designer.cs
generated
@@ -42,10 +42,21 @@
|
|||||||
openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
recentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
recentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
revealInFileExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
revealInFileExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
addCarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
clearSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
openWelcomeScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
clearRecentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
imageList1 = new System.Windows.Forms.ImageList(components);
|
imageList1 = new System.Windows.Forms.ImageList(components);
|
||||||
|
aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
gitRepositoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
tableLayoutPanel1.SuspendLayout();
|
tableLayoutPanel1.SuspendLayout();
|
||||||
tlpControls.SuspendLayout();
|
tlpControls.SuspendLayout();
|
||||||
tlpSearch.SuspendLayout();
|
tlpSearch.SuspendLayout();
|
||||||
@@ -68,7 +79,7 @@
|
|||||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
||||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
tableLayoutPanel1.Size = new System.Drawing.Size(802, 572);
|
tableLayoutPanel1.Size = new System.Drawing.Size(902, 653);
|
||||||
tableLayoutPanel1.TabIndex = 0;
|
tableLayoutPanel1.TabIndex = 0;
|
||||||
tableLayoutPanel1.Paint += tableLayoutPanel1_Paint;
|
tableLayoutPanel1.Paint += tableLayoutPanel1_Paint;
|
||||||
//
|
//
|
||||||
@@ -80,7 +91,7 @@
|
|||||||
flpCars.Location = new System.Drawing.Point(3, 82);
|
flpCars.Location = new System.Drawing.Point(3, 82);
|
||||||
flpCars.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
flpCars.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
flpCars.Name = "flpCars";
|
flpCars.Name = "flpCars";
|
||||||
flpCars.Size = new System.Drawing.Size(796, 515);
|
flpCars.Size = new System.Drawing.Size(896, 567);
|
||||||
flpCars.TabIndex = 1;
|
flpCars.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// tlpControls
|
// tlpControls
|
||||||
@@ -96,7 +107,7 @@
|
|||||||
tlpControls.Name = "tlpControls";
|
tlpControls.Name = "tlpControls";
|
||||||
tlpControls.RowCount = 1;
|
tlpControls.RowCount = 1;
|
||||||
tlpControls.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
tlpControls.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
tlpControls.Size = new System.Drawing.Size(802, 50);
|
tlpControls.Size = new System.Drawing.Size(902, 50);
|
||||||
tlpControls.TabIndex = 2;
|
tlpControls.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// btnNewCar
|
// btnNewCar
|
||||||
@@ -108,7 +119,7 @@
|
|||||||
btnNewCar.FlatAppearance.BorderSize = 0;
|
btnNewCar.FlatAppearance.BorderSize = 0;
|
||||||
btnNewCar.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
btnNewCar.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
btnNewCar.Image = (System.Drawing.Image)resources.GetObject("btnNewCar.Image");
|
btnNewCar.Image = (System.Drawing.Image)resources.GetObject("btnNewCar.Image");
|
||||||
btnNewCar.Location = new System.Drawing.Point(722, 0);
|
btnNewCar.Location = new System.Drawing.Point(822, 0);
|
||||||
btnNewCar.Margin = new System.Windows.Forms.Padding(0);
|
btnNewCar.Margin = new System.Windows.Forms.Padding(0);
|
||||||
btnNewCar.Name = "btnNewCar";
|
btnNewCar.Name = "btnNewCar";
|
||||||
btnNewCar.Size = new System.Drawing.Size(80, 50);
|
btnNewCar.Size = new System.Drawing.Size(80, 50);
|
||||||
@@ -131,7 +142,7 @@
|
|||||||
tlpSearch.RowCount = 1;
|
tlpSearch.RowCount = 1;
|
||||||
tlpSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
tlpSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
tlpSearch.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
tlpSearch.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
tlpSearch.Size = new System.Drawing.Size(722, 50);
|
tlpSearch.Size = new System.Drawing.Size(822, 50);
|
||||||
tlpSearch.TabIndex = 5;
|
tlpSearch.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// tbxSearch
|
// tbxSearch
|
||||||
@@ -143,7 +154,7 @@
|
|||||||
tbxSearch.Location = new System.Drawing.Point(53, 15);
|
tbxSearch.Location = new System.Drawing.Point(53, 15);
|
||||||
tbxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
tbxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
tbxSearch.Name = "tbxSearch";
|
tbxSearch.Name = "tbxSearch";
|
||||||
tbxSearch.Size = new System.Drawing.Size(666, 20);
|
tbxSearch.Size = new System.Drawing.Size(766, 20);
|
||||||
tbxSearch.TabIndex = 3;
|
tbxSearch.TabIndex = 3;
|
||||||
tbxSearch.TextChanged += tbxSearch_TextChanged;
|
tbxSearch.TextChanged += tbxSearch_TextChanged;
|
||||||
//
|
//
|
||||||
@@ -163,22 +174,24 @@
|
|||||||
//
|
//
|
||||||
menuStrip1.BackColor = System.Drawing.SystemColors.ButtonFace;
|
menuStrip1.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||||
menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem });
|
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, toolsToolStripMenuItem, aboutToolStripMenuItem });
|
||||||
menuStrip1.Location = new System.Drawing.Point(0, 0);
|
menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
menuStrip1.Name = "menuStrip1";
|
menuStrip1.Name = "menuStrip1";
|
||||||
menuStrip1.Size = new System.Drawing.Size(802, 28);
|
menuStrip1.Size = new System.Drawing.Size(902, 28);
|
||||||
menuStrip1.TabIndex = 3;
|
menuStrip1.TabIndex = 3;
|
||||||
menuStrip1.Text = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// fileToolStripMenuItem
|
// fileToolStripMenuItem
|
||||||
//
|
//
|
||||||
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, importToolStripMenuItem, recentFilesToolStripMenuItem, revealInFileExplorerToolStripMenuItem });
|
fileToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
|
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, recentFilesToolStripMenuItem, revealInFileExplorerToolStripMenuItem, exitToolStripMenuItem });
|
||||||
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24);
|
fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24);
|
||||||
fileToolStripMenuItem.Text = "File";
|
fileToolStripMenuItem.Text = "File";
|
||||||
//
|
//
|
||||||
// openToolStripMenuItem
|
// openToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
openToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||||
openToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
openToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
||||||
openToolStripMenuItem.Text = "Open";
|
openToolStripMenuItem.Text = "Open";
|
||||||
@@ -186,6 +199,7 @@
|
|||||||
//
|
//
|
||||||
// saveToolStripMenuItem
|
// saveToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
saveToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
saveToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
saveToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
||||||
saveToolStripMenuItem.Text = "Save";
|
saveToolStripMenuItem.Text = "Save";
|
||||||
@@ -198,13 +212,6 @@
|
|||||||
saveAsToolStripMenuItem.Text = "Save as";
|
saveAsToolStripMenuItem.Text = "Save as";
|
||||||
saveAsToolStripMenuItem.Click += saveAsToolStripMenuItem_Click;
|
saveAsToolStripMenuItem.Click += saveAsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// importToolStripMenuItem
|
|
||||||
//
|
|
||||||
importToolStripMenuItem.Name = "importToolStripMenuItem";
|
|
||||||
importToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
|
||||||
importToolStripMenuItem.Text = "Import";
|
|
||||||
importToolStripMenuItem.Click += importToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// recentFilesToolStripMenuItem
|
// recentFilesToolStripMenuItem
|
||||||
//
|
//
|
||||||
recentFilesToolStripMenuItem.Name = "recentFilesToolStripMenuItem";
|
recentFilesToolStripMenuItem.Name = "recentFilesToolStripMenuItem";
|
||||||
@@ -219,6 +226,72 @@
|
|||||||
revealInFileExplorerToolStripMenuItem.Text = "Reveal in File Explorer";
|
revealInFileExplorerToolStripMenuItem.Text = "Reveal in File Explorer";
|
||||||
revealInFileExplorerToolStripMenuItem.Click += revealInFileExplorerToolStripMenuItem_Click;
|
revealInFileExplorerToolStripMenuItem.Click += revealInFileExplorerToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// exitToolStripMenuItem
|
||||||
|
//
|
||||||
|
exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
exitToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
||||||
|
exitToolStripMenuItem.Text = "Save and Exit";
|
||||||
|
exitToolStripMenuItem.Click += exitToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// editToolStripMenuItem
|
||||||
|
//
|
||||||
|
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { addCarToolStripMenuItem, importToolStripMenuItem, clearSearchToolStripMenuItem, settingsToolStripMenuItem });
|
||||||
|
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
|
editToolStripMenuItem.Size = new System.Drawing.Size(49, 24);
|
||||||
|
editToolStripMenuItem.Text = "Edit";
|
||||||
|
//
|
||||||
|
// addCarToolStripMenuItem
|
||||||
|
//
|
||||||
|
addCarToolStripMenuItem.Name = "addCarToolStripMenuItem";
|
||||||
|
addCarToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||||
|
addCarToolStripMenuItem.Text = "Add Car";
|
||||||
|
addCarToolStripMenuItem.Click += addCarToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// importToolStripMenuItem
|
||||||
|
//
|
||||||
|
importToolStripMenuItem.Name = "importToolStripMenuItem";
|
||||||
|
importToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||||
|
importToolStripMenuItem.Text = "Import";
|
||||||
|
importToolStripMenuItem.Click += importToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// clearSearchToolStripMenuItem
|
||||||
|
//
|
||||||
|
clearSearchToolStripMenuItem.Name = "clearSearchToolStripMenuItem";
|
||||||
|
clearSearchToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||||
|
clearSearchToolStripMenuItem.Text = "Clear Search";
|
||||||
|
clearSearchToolStripMenuItem.Click += clearSearchToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// settingsToolStripMenuItem
|
||||||
|
//
|
||||||
|
settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||||
|
settingsToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||||
|
settingsToolStripMenuItem.Text = "Settings";
|
||||||
|
settingsToolStripMenuItem.Click += settingsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// toolsToolStripMenuItem
|
||||||
|
//
|
||||||
|
toolsToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
|
toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { openWelcomeScreenToolStripMenuItem, clearRecentFilesToolStripMenuItem });
|
||||||
|
toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
||||||
|
toolsToolStripMenuItem.Size = new System.Drawing.Size(58, 24);
|
||||||
|
toolsToolStripMenuItem.Text = "Tools";
|
||||||
|
//
|
||||||
|
// openWelcomeScreenToolStripMenuItem
|
||||||
|
//
|
||||||
|
openWelcomeScreenToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
|
openWelcomeScreenToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
|
openWelcomeScreenToolStripMenuItem.Name = "openWelcomeScreenToolStripMenuItem";
|
||||||
|
openWelcomeScreenToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
||||||
|
openWelcomeScreenToolStripMenuItem.Text = "Open welcome screen";
|
||||||
|
openWelcomeScreenToolStripMenuItem.Click += openWelcomeScreenToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// clearRecentFilesToolStripMenuItem
|
||||||
|
//
|
||||||
|
clearRecentFilesToolStripMenuItem.Name = "clearRecentFilesToolStripMenuItem";
|
||||||
|
clearRecentFilesToolStripMenuItem.Size = new System.Drawing.Size(238, 26);
|
||||||
|
clearRecentFilesToolStripMenuItem.Text = "Clear recent files";
|
||||||
|
clearRecentFilesToolStripMenuItem.Click += clearRecentFilesToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// imageList1
|
// imageList1
|
||||||
//
|
//
|
||||||
imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
||||||
@@ -227,17 +300,39 @@
|
|||||||
imageList1.Images.SetKeyName(0, "Icon_Search.png");
|
imageList1.Images.SetKeyName(0, "Icon_Search.png");
|
||||||
imageList1.Images.SetKeyName(1, "Icon_Add.png");
|
imageList1.Images.SetKeyName(1, "Icon_Add.png");
|
||||||
//
|
//
|
||||||
|
// aboutToolStripMenuItem
|
||||||
|
//
|
||||||
|
aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { checkForUpdatesToolStripMenuItem, gitRepositoryToolStripMenuItem });
|
||||||
|
aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||||
|
aboutToolStripMenuItem.Size = new System.Drawing.Size(64, 24);
|
||||||
|
aboutToolStripMenuItem.Text = "About";
|
||||||
|
//
|
||||||
|
// checkForUpdatesToolStripMenuItem
|
||||||
|
//
|
||||||
|
checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
|
||||||
|
checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
|
checkForUpdatesToolStripMenuItem.Text = "Check for Updates";
|
||||||
|
checkForUpdatesToolStripMenuItem.Click += checkForUpdatesToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// gitRepositoryToolStripMenuItem
|
||||||
|
//
|
||||||
|
gitRepositoryToolStripMenuItem.Name = "gitRepositoryToolStripMenuItem";
|
||||||
|
gitRepositoryToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
|
gitRepositoryToolStripMenuItem.Text = "Git Repository";
|
||||||
|
gitRepositoryToolStripMenuItem.Click += gitRepositoryToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
ClientSize = new System.Drawing.Size(802, 572);
|
ClientSize = new System.Drawing.Size(902, 653);
|
||||||
Controls.Add(tableLayoutPanel1);
|
Controls.Add(tableLayoutPanel1);
|
||||||
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
||||||
MainMenuStrip = menuStrip1;
|
MainMenuStrip = menuStrip1;
|
||||||
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
MinimumSize = new System.Drawing.Size(818, 609);
|
MinimumSize = new System.Drawing.Size(920, 700);
|
||||||
Name = "MainForm";
|
Name = "MainForm";
|
||||||
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
Text = "Carmanager 3";
|
Text = "Carmanager 3";
|
||||||
tableLayoutPanel1.ResumeLayout(false);
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
tableLayoutPanel1.PerformLayout();
|
tableLayoutPanel1.PerformLayout();
|
||||||
@@ -263,11 +358,22 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem recentFilesToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem recentFilesToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem revealInFileExplorerToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem revealInFileExplorerToolStripMenuItem;
|
||||||
private System.Windows.Forms.TableLayoutPanel tlpSearch;
|
private System.Windows.Forms.TableLayoutPanel tlpSearch;
|
||||||
private System.Windows.Forms.PictureBox pbxSearch;
|
private System.Windows.Forms.PictureBox pbxSearch;
|
||||||
private System.Windows.Forms.ImageList imageList1;
|
private System.Windows.Forms.ImageList imageList1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem openWelcomeScreenToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem addCarToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem clearSearchToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem clearRecentFilesToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem gitRepositoryToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,24 +4,48 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using CarManagerV3.Forms;
|
||||||
|
using CarManagerV3.Manager;
|
||||||
|
using CarManagerV3.Util;
|
||||||
|
|
||||||
namespace CarManagerV3
|
namespace CarManagerV3
|
||||||
{
|
{
|
||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
List<Car> cars = new List<Car>();
|
List<Car> cars = new List<Car>();
|
||||||
string filepath = "cars.csv";
|
string filepath = "";
|
||||||
|
|
||||||
public MainForm()
|
public static MainForm GetMainForm()
|
||||||
|
{
|
||||||
|
// This is a singleton pattern to ensure only one instance of MainForm exists.
|
||||||
|
// If you need to access the MainForm instance, you can use this method.
|
||||||
|
return Application.OpenForms.OfType<MainForm>().FirstOrDefault() ?? new MainForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainForm(string pathToOpen = "")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
if (Properties.Settings.Default.DataLocation == "")
|
||||||
|
{
|
||||||
|
Properties.Settings.Default.DataLocation = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3";
|
||||||
|
Properties.Settings.Default.Save();
|
||||||
|
}
|
||||||
|
|
||||||
// Open the most recent file if it exists. Otherwise, use default filepath.
|
// Open the most recent file if it exists. Otherwise, use default filepath.
|
||||||
List<string> recentFiles = SafeManager.GetRecentPaths();
|
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];
|
filepath = recentFiles[0];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
openWelcomeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
SafeManager.InitializeFile(filepath);
|
SafeManager.InitializeFile(filepath);
|
||||||
StateManager.setFilePath(filepath);
|
StateManager.setFilePath(filepath);
|
||||||
@@ -38,6 +62,60 @@ namespace CarManagerV3
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshRecents();
|
refreshRecents();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||||
|
{
|
||||||
|
if (InstallModeDetector.IsInstalledViaMsi())
|
||||||
|
{
|
||||||
|
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
|
||||||
|
updatePrompt.ShowDialog();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
DialogResult updateResult = MessageBox.Show($"A new version of Car Manager is available! \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)} \n\nDo you want to open the Git repository to download the update?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||||
|
if (updateResult == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
Updater.OpenReleasePage(Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Error checking for updates: " + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
CarCompletions.UpdateCarCompletionDataAsync();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openWelcomeScreen()
|
||||||
|
{
|
||||||
|
Welcome welcome = new Welcome();
|
||||||
|
// disable main form while welcome screen is open
|
||||||
|
this.Enabled = false;
|
||||||
|
welcome.OpenFileCallback = () =>
|
||||||
|
{
|
||||||
|
showOpenFileDialog();
|
||||||
|
if (filepath != "")
|
||||||
|
{
|
||||||
|
welcome.Close();
|
||||||
|
this.Enabled = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
welcome.NewFileCallback = () =>
|
||||||
|
{
|
||||||
|
showSaveAsDialog();
|
||||||
|
if (filepath != "")
|
||||||
|
{
|
||||||
|
welcome.Close();
|
||||||
|
this.Enabled = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
welcome.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,13 +124,18 @@ namespace CarManagerV3
|
|||||||
openToolStripMenuItem.PerformClick();
|
openToolStripMenuItem.PerformClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showSaveAsDialog()
|
||||||
|
{
|
||||||
|
saveAsToolStripMenuItem.PerformClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refreshes the cars displayed in the flow layout panel.
|
/// Refreshes the cars displayed in the flow layout panel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_cars">The cars.</param>
|
/// <param name="_cars">The cars.</param>
|
||||||
/// <param name="updateGlobal">if set to <c>true</c> [update global].</param>
|
/// <param name="updateGlobal">if set to <c>true</c> [update global].</param>
|
||||||
private async void refreshCars(List<Car> _cars, bool updateGlobal = true)
|
private async void refreshCars(List<Car> _cars, bool updateGlobal = true, bool force = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.Text = "Car Manager - " + System.IO.Path.GetFileName(filepath);
|
this.Text = "Car Manager - " + System.IO.Path.GetFileName(filepath);
|
||||||
@@ -82,12 +165,12 @@ namespace CarManagerV3
|
|||||||
}
|
}
|
||||||
// compare details
|
// compare details
|
||||||
// Console.WriteLine($"[L] Checking car: {car.Id} | Car Color: {car.Color} | Ex Color: {existingCar.Color}");
|
// Console.WriteLine($"[L] Checking car: {car.Id} | Car Color: {car.Color} | Ex Color: {existingCar.Color}");
|
||||||
if (existingCar.IsChanged(car))
|
if (existingCar.IsChanged(car) || force)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"[L] Updating car: {car.Id}");
|
Console.WriteLine($"[L] Updating car: {car.Id}");
|
||||||
// changes
|
// changes
|
||||||
card = existing;
|
card = existing;
|
||||||
|
if (force) card.LoadImage(); // reload image if forced refresh
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -135,7 +218,7 @@ namespace CarManagerV3
|
|||||||
Car other = cars.Where(c => c.Order < order).OrderByDescending(c => c.Order).FirstOrDefault();
|
Car other = cars.Where(c => c.Order < order).OrderByDescending(c => c.Order).FirstOrDefault();
|
||||||
if (other != null)
|
if (other != null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
|
System.Diagnostics.Debug.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
|
||||||
int temp = car.Order;
|
int temp = car.Order;
|
||||||
car.Order = other.Order;
|
car.Order = other.Order;
|
||||||
other.Order = temp;
|
other.Order = temp;
|
||||||
@@ -152,7 +235,7 @@ namespace CarManagerV3
|
|||||||
Car other = cars.Where(c => c.Order > order).OrderBy(c => c.Order).FirstOrDefault();
|
Car other = cars.Where(c => c.Order > order).OrderBy(c => c.Order).FirstOrDefault();
|
||||||
if (other != null)
|
if (other != null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
|
System.Diagnostics.Debug.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
|
||||||
int temp = car.Order;
|
int temp = car.Order;
|
||||||
car.Order = other.Order;
|
car.Order = other.Order;
|
||||||
other.Order = temp;
|
other.Order = temp;
|
||||||
@@ -253,7 +336,7 @@ namespace CarManagerV3
|
|||||||
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog dlgOpen = new OpenFileDialog();
|
OpenFileDialog dlgOpen = new OpenFileDialog();
|
||||||
dlgOpen.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*";
|
dlgOpen.Filter = "Compatible Files (*.csv;*.cars)|*.csv;*.cars|CSV Files (*.csv)|*.csv|Car Manager CSV (*.cars)|*.cars|All Files (*.*)|*.*";
|
||||||
dlgOpen.Title = "Open Car Data File";
|
dlgOpen.Title = "Open Car Data File";
|
||||||
// Default to users documents
|
// Default to users documents
|
||||||
dlgOpen.InitialDirectory = SafeManager.getRecentFolder();
|
dlgOpen.InitialDirectory = SafeManager.getRecentFolder();
|
||||||
@@ -264,7 +347,7 @@ namespace CarManagerV3
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Car> importedCars = SafeManager.ReadCars(dlgOpen.FileName);
|
List<Car> importedCars = SafeManager.ReadCars(dlgOpen.FileName);
|
||||||
if(importedCars.Count == 0)
|
if (importedCars.Count == 0)
|
||||||
{
|
{
|
||||||
throw new Exception("File doesn't contain valid Cars.");
|
throw new Exception("File doesn't contain valid Cars.");
|
||||||
}
|
}
|
||||||
@@ -299,7 +382,7 @@ namespace CarManagerV3
|
|||||||
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SaveFileDialog dlgSave = new SaveFileDialog();
|
SaveFileDialog dlgSave = new SaveFileDialog();
|
||||||
dlgSave.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*";
|
dlgSave.Filter = "Compatible Files (*.csv;*.cars)|*.csv;*.cars|CSV Files (*.csv)|*.csv|Car Manager CSV (*.cars)|*.cars|All Files (*.*)|*.*";
|
||||||
dlgSave.Title = "Save Car Data File As";
|
dlgSave.Title = "Save Car Data File As";
|
||||||
// Default to users documents
|
// Default to users documents
|
||||||
dlgSave.InitialDirectory = SafeManager.getRecentFolder();
|
dlgSave.InitialDirectory = SafeManager.getRecentFolder();
|
||||||
@@ -332,7 +415,7 @@ namespace CarManagerV3
|
|||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
OpenFileDialog dlgOpen = new OpenFileDialog();
|
OpenFileDialog dlgOpen = new OpenFileDialog();
|
||||||
dlgOpen.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*";
|
dlgOpen.Filter = "Compatible Files (*.csv;*.cars)|*.csv;*.cars|CSV Files (*.csv)|*.csv|Car Manager CSV (*.cars)|*.cars|All Files (*.*)|*.*";
|
||||||
dlgOpen.Title = "Import Car Data File";
|
dlgOpen.Title = "Import Car Data File";
|
||||||
// Default to users documents
|
// Default to users documents
|
||||||
dlgOpen.InitialDirectory = SafeManager.getRecentFolder();
|
dlgOpen.InitialDirectory = SafeManager.getRecentFolder();
|
||||||
@@ -343,7 +426,7 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
Console.WriteLine("Starting merge...");
|
Console.WriteLine("Starting merge...");
|
||||||
List<Car> importedCars = SafeManager.ReadCars(dlgOpen.FileName);
|
List<Car> importedCars = SafeManager.ReadCars(dlgOpen.FileName);
|
||||||
if(importedCars.Count == 0)
|
if (importedCars.Count == 0)
|
||||||
{
|
{
|
||||||
throw new Exception("File doesn't contain valid Cars.");
|
throw new Exception("File doesn't contain valid Cars.");
|
||||||
}
|
}
|
||||||
@@ -356,7 +439,7 @@ namespace CarManagerV3
|
|||||||
if (mergeAsNewFileResult == DialogResult.Yes)
|
if (mergeAsNewFileResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
SaveFileDialog dlgSave = new SaveFileDialog();
|
SaveFileDialog dlgSave = new SaveFileDialog();
|
||||||
dlgSave.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*";
|
dlgSave.Filter = "Compatible Files (*.csv;*.cars)|*.csv;*.cars|CSV Files (*.csv)|*.csv|Car Manager CSV (*.cars)|*.cars|All Files (*.*)|*.*";
|
||||||
dlgSave.Title = "Save Merged Car Data File As";
|
dlgSave.Title = "Save Merged Car Data File As";
|
||||||
// Default to users documents
|
// Default to users documents
|
||||||
dlgSave.InitialDirectory = SafeManager.getRecentFolder();
|
dlgSave.InitialDirectory = SafeManager.getRecentFolder();
|
||||||
@@ -418,7 +501,7 @@ namespace CarManagerV3
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Car> importedCars = SafeManager.ReadCars(path);
|
List<Car> importedCars = SafeManager.ReadCars(path);
|
||||||
if(importedCars.Count == 0)
|
if (importedCars.Count == 0)
|
||||||
{
|
{
|
||||||
throw new Exception("File doesn't contain valid Cars.");
|
throw new Exception("File doesn't contain valid Cars.");
|
||||||
}
|
}
|
||||||
@@ -429,6 +512,10 @@ namespace CarManagerV3
|
|||||||
refreshCars(cars);
|
refreshCars(cars);
|
||||||
MessageBox.Show("File loaded successfully.", "Load File", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("File loaded successfully.", "Load File", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
catch (LegacyException)
|
||||||
|
{
|
||||||
|
MessageBox.Show("The file you are trying to open is in a legacy format that is no longer supported. Please convert the file to the new format and try again.", "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Error loading file: " + ex.Message);
|
MessageBox.Show("Error loading file: " + ex.Message);
|
||||||
@@ -451,5 +538,75 @@ namespace CarManagerV3
|
|||||||
MessageBox.Show("File does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("File does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openWelcomeScreenToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
openWelcomeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCarToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
btnNewCar.PerformClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearSearchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
tbxSearch.Text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SafeManager.SaveCars(filepath, cars);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearRecentFilesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SafeManager.ClearRecentPaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SettingsForm settingsForm = new SettingsForm();
|
||||||
|
settingsForm.FormClosed += (s2, e2) =>
|
||||||
|
{
|
||||||
|
// refresh cars in case data location changed
|
||||||
|
List<Car> cars_ = SafeManager.ReadCars(filepath);
|
||||||
|
refreshCars(cars_, false, true);
|
||||||
|
System.Diagnostics.Debug.WriteLine("Refreshed!");
|
||||||
|
};
|
||||||
|
settingsForm.ShowDialog();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||||
|
{
|
||||||
|
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
|
||||||
|
updatePrompt.ShowDialog();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show($"You are already using the latest version. \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)}", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error checking for updates: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gitRepositoryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Open the Git repository in the user's default browser
|
||||||
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://git.jaro.digital/frozd/carmanager-3",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
182
CarManagerV3/Forms/NetCredentials.Designer.cs
generated
Normal file
182
CarManagerV3/Forms/NetCredentials.Designer.cs
generated
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
partial class NetCredentials
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
label1 = new System.Windows.Forms.Label();
|
||||||
|
label2 = new System.Windows.Forms.Label();
|
||||||
|
label3 = new System.Windows.Forms.Label();
|
||||||
|
tbxUsername = new System.Windows.Forms.TextBox();
|
||||||
|
label4 = new System.Windows.Forms.Label();
|
||||||
|
tbxPassword = new System.Windows.Forms.TextBox();
|
||||||
|
flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
btnAccept = new System.Windows.Forms.Button();
|
||||||
|
btnCancel = new System.Windows.Forms.Button();
|
||||||
|
flowLayoutPanel1.SuspendLayout();
|
||||||
|
flowLayoutPanel2.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// flowLayoutPanel1
|
||||||
|
//
|
||||||
|
flowLayoutPanel1.Controls.Add(label1);
|
||||||
|
flowLayoutPanel1.Controls.Add(label2);
|
||||||
|
flowLayoutPanel1.Controls.Add(label3);
|
||||||
|
flowLayoutPanel1.Controls.Add(tbxUsername);
|
||||||
|
flowLayoutPanel1.Controls.Add(label4);
|
||||||
|
flowLayoutPanel1.Controls.Add(tbxPassword);
|
||||||
|
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
|
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(10);
|
||||||
|
flowLayoutPanel1.Size = new System.Drawing.Size(349, 248);
|
||||||
|
flowLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Font = new System.Drawing.Font("Segoe UI", 14F);
|
||||||
|
label1.Location = new System.Drawing.Point(13, 10);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new System.Drawing.Size(232, 25);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Enter Network Credentials";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new System.Drawing.Point(13, 35);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(308, 30);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Your network requires credentials to access data through the proxy";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new System.Drawing.Point(13, 85);
|
||||||
|
label3.Margin = new System.Windows.Forms.Padding(3, 20, 3, 0);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new System.Drawing.Size(86, 15);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "Your username";
|
||||||
|
//
|
||||||
|
// tbxUsername
|
||||||
|
//
|
||||||
|
tbxUsername.Location = new System.Drawing.Point(13, 103);
|
||||||
|
tbxUsername.Name = "tbxUsername";
|
||||||
|
tbxUsername.Size = new System.Drawing.Size(308, 23);
|
||||||
|
tbxUsername.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new System.Drawing.Point(13, 139);
|
||||||
|
label4.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new System.Drawing.Size(84, 15);
|
||||||
|
label4.TabIndex = 4;
|
||||||
|
label4.Text = "Your password";
|
||||||
|
//
|
||||||
|
// tbxPassword
|
||||||
|
//
|
||||||
|
tbxPassword.Location = new System.Drawing.Point(13, 157);
|
||||||
|
tbxPassword.Name = "tbxPassword";
|
||||||
|
tbxPassword.PasswordChar = '*';
|
||||||
|
tbxPassword.Size = new System.Drawing.Size(308, 23);
|
||||||
|
tbxPassword.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel2
|
||||||
|
//
|
||||||
|
flowLayoutPanel2.Controls.Add(btnAccept);
|
||||||
|
flowLayoutPanel2.Controls.Add(btnCancel);
|
||||||
|
flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
|
flowLayoutPanel2.Location = new System.Drawing.Point(0, 198);
|
||||||
|
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||||
|
flowLayoutPanel2.Size = new System.Drawing.Size(349, 50);
|
||||||
|
flowLayoutPanel2.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// btnAccept
|
||||||
|
//
|
||||||
|
btnAccept.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnAccept.Location = new System.Drawing.Point(271, 3);
|
||||||
|
btnAccept.Name = "btnAccept";
|
||||||
|
btnAccept.Size = new System.Drawing.Size(75, 23);
|
||||||
|
btnAccept.TabIndex = 0;
|
||||||
|
btnAccept.Text = "Save";
|
||||||
|
btnAccept.UseVisualStyleBackColor = true;
|
||||||
|
btnAccept.Click += btnAccept_Click;
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
btnCancel.Location = new System.Drawing.Point(190, 3);
|
||||||
|
btnCancel.Name = "btnCancel";
|
||||||
|
btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
|
btnCancel.TabIndex = 1;
|
||||||
|
btnCancel.Text = "Cancel";
|
||||||
|
btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// NetCredentials
|
||||||
|
//
|
||||||
|
AcceptButton = btnAccept;
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
CancelButton = btnCancel;
|
||||||
|
ClientSize = new System.Drawing.Size(349, 248);
|
||||||
|
ControlBox = false;
|
||||||
|
Controls.Add(flowLayoutPanel2);
|
||||||
|
Controls.Add(flowLayoutPanel1);
|
||||||
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
MaximizeBox = false;
|
||||||
|
Name = "NetCredentials";
|
||||||
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
Text = "Enter Network Credentials";
|
||||||
|
TopMost = true;
|
||||||
|
Load += NetCredentials_Load;
|
||||||
|
flowLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel1.PerformLayout();
|
||||||
|
flowLayoutPanel2.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.TextBox tbxUsername;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.TextBox tbxPassword;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Button btnAccept;
|
||||||
|
private System.Windows.Forms.Button btnCancel;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
CarManagerV3/Forms/NetCredentials.cs
Normal file
38
CarManagerV3/Forms/NetCredentials.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
public partial class NetCredentials : Form
|
||||||
|
{
|
||||||
|
public NetCredentials()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkCredential GetCredentails()
|
||||||
|
{
|
||||||
|
return new NetworkCredential(tbxUsername.Text, tbxPassword.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NetCredentials_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.BringToFront();
|
||||||
|
this.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAccept_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.DialogResult = DialogResult.OK;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
CarManagerV3/Forms/NetCredentials.resx
Normal file
120
CarManagerV3/Forms/NetCredentials.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
361
CarManagerV3/Forms/SettingsForm.Designer.cs
generated
Normal file
361
CarManagerV3/Forms/SettingsForm.Designer.cs
generated
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
partial class SettingsForm
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
||||||
|
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
label1 = new System.Windows.Forms.Label();
|
||||||
|
label2 = new System.Windows.Forms.Label();
|
||||||
|
flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
btnAccept = new System.Windows.Forms.Button();
|
||||||
|
btnDiscard = new System.Windows.Forms.Button();
|
||||||
|
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
lblCompletionsRefreshWindow = new System.Windows.Forms.Label();
|
||||||
|
lblDataLocation = new System.Windows.Forms.Label();
|
||||||
|
tbxDataLocation = new System.Windows.Forms.TextBox();
|
||||||
|
cbxPreRelease = new System.Windows.Forms.CheckBox();
|
||||||
|
flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
nudCompletionIntervalHours = new System.Windows.Forms.NumericUpDown();
|
||||||
|
label3 = new System.Windows.Forms.Label();
|
||||||
|
nudCompletionIntervalMinutes = new System.Windows.Forms.NumericUpDown();
|
||||||
|
label4 = new System.Windows.Forms.Label();
|
||||||
|
tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
btnReset = new System.Windows.Forms.Button();
|
||||||
|
flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
lblEnv = new System.Windows.Forms.Label();
|
||||||
|
flowLayoutPanel1.SuspendLayout();
|
||||||
|
flowLayoutPanel2.SuspendLayout();
|
||||||
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
flowLayoutPanel4.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalHours).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalMinutes).BeginInit();
|
||||||
|
tableLayoutPanel2.SuspendLayout();
|
||||||
|
flowLayoutPanel3.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// flowLayoutPanel1
|
||||||
|
//
|
||||||
|
flowLayoutPanel1.Controls.Add(label1);
|
||||||
|
flowLayoutPanel1.Controls.Add(label2);
|
||||||
|
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
|
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(11, 13, 11, 13);
|
||||||
|
flowLayoutPanel1.Size = new System.Drawing.Size(499, 86);
|
||||||
|
flowLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Font = new System.Drawing.Font("Segoe UI", 14F);
|
||||||
|
label1.Location = new System.Drawing.Point(14, 13);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new System.Drawing.Size(100, 32);
|
||||||
|
label1.TabIndex = 2;
|
||||||
|
label1.Text = "Settings";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new System.Drawing.Point(14, 45);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(276, 20);
|
||||||
|
label2.TabIndex = 3;
|
||||||
|
label2.Text = "Adjust settings related to Car Manager 3";
|
||||||
|
//
|
||||||
|
// flowLayoutPanel2
|
||||||
|
//
|
||||||
|
flowLayoutPanel2.Controls.Add(btnAccept);
|
||||||
|
flowLayoutPanel2.Controls.Add(btnDiscard);
|
||||||
|
flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
|
flowLayoutPanel2.Location = new System.Drawing.Point(249, 30);
|
||||||
|
flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||||
|
flowLayoutPanel2.Size = new System.Drawing.Size(240, 44);
|
||||||
|
flowLayoutPanel2.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// btnAccept
|
||||||
|
//
|
||||||
|
btnAccept.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnAccept.Location = new System.Drawing.Point(151, 4);
|
||||||
|
btnAccept.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
btnAccept.Name = "btnAccept";
|
||||||
|
btnAccept.Size = new System.Drawing.Size(86, 31);
|
||||||
|
btnAccept.TabIndex = 0;
|
||||||
|
btnAccept.Text = "Save";
|
||||||
|
btnAccept.UseVisualStyleBackColor = true;
|
||||||
|
btnAccept.Click += btnAccept_Click;
|
||||||
|
//
|
||||||
|
// btnDiscard
|
||||||
|
//
|
||||||
|
btnDiscard.Location = new System.Drawing.Point(59, 4);
|
||||||
|
btnDiscard.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
btnDiscard.Name = "btnDiscard";
|
||||||
|
btnDiscard.Size = new System.Drawing.Size(86, 31);
|
||||||
|
btnDiscard.TabIndex = 1;
|
||||||
|
btnDiscard.Text = "Discard";
|
||||||
|
btnDiscard.UseVisualStyleBackColor = true;
|
||||||
|
btnDiscard.Click += btnDiscard_Click;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel1
|
||||||
|
//
|
||||||
|
tableLayoutPanel1.ColumnCount = 2;
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel1.Controls.Add(lblCompletionsRefreshWindow, 0, 2);
|
||||||
|
tableLayoutPanel1.Controls.Add(lblDataLocation, 0, 0);
|
||||||
|
tableLayoutPanel1.Controls.Add(tbxDataLocation, 1, 0);
|
||||||
|
tableLayoutPanel1.Controls.Add(cbxPreRelease, 0, 1);
|
||||||
|
tableLayoutPanel1.Controls.Add(flowLayoutPanel4, 1, 2);
|
||||||
|
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
tableLayoutPanel1.Location = new System.Drawing.Point(0, 86);
|
||||||
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
|
tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||||
|
tableLayoutPanel1.RowCount = 7;
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 0F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
tableLayoutPanel1.Size = new System.Drawing.Size(499, 531);
|
||||||
|
tableLayoutPanel1.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// lblCompletionsRefreshWindow
|
||||||
|
//
|
||||||
|
lblCompletionsRefreshWindow.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblCompletionsRefreshWindow.AutoSize = true;
|
||||||
|
lblCompletionsRefreshWindow.Location = new System.Drawing.Point(13, 66);
|
||||||
|
lblCompletionsRefreshWindow.Margin = new System.Windows.Forms.Padding(3);
|
||||||
|
lblCompletionsRefreshWindow.MaximumSize = new System.Drawing.Size(150, 0);
|
||||||
|
lblCompletionsRefreshWindow.Name = "lblCompletionsRefreshWindow";
|
||||||
|
lblCompletionsRefreshWindow.Size = new System.Drawing.Size(148, 1);
|
||||||
|
lblCompletionsRefreshWindow.TabIndex = 4;
|
||||||
|
lblCompletionsRefreshWindow.Text = "Refresh completions after";
|
||||||
|
lblCompletionsRefreshWindow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// lblDataLocation
|
||||||
|
//
|
||||||
|
lblDataLocation.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblDataLocation.AutoSize = true;
|
||||||
|
lblDataLocation.Location = new System.Drawing.Point(13, 6);
|
||||||
|
lblDataLocation.Name = "lblDataLocation";
|
||||||
|
lblDataLocation.Size = new System.Drawing.Size(148, 20);
|
||||||
|
lblDataLocation.TabIndex = 0;
|
||||||
|
lblDataLocation.Text = "Data Location";
|
||||||
|
lblDataLocation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// tbxDataLocation
|
||||||
|
//
|
||||||
|
tbxDataLocation.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
tbxDataLocation.Location = new System.Drawing.Point(167, 3);
|
||||||
|
tbxDataLocation.Name = "tbxDataLocation";
|
||||||
|
tbxDataLocation.Size = new System.Drawing.Size(319, 27);
|
||||||
|
tbxDataLocation.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// cbxPreRelease
|
||||||
|
//
|
||||||
|
cbxPreRelease.AutoSize = true;
|
||||||
|
tableLayoutPanel1.SetColumnSpan(cbxPreRelease, 2);
|
||||||
|
cbxPreRelease.Location = new System.Drawing.Point(13, 36);
|
||||||
|
cbxPreRelease.Name = "cbxPreRelease";
|
||||||
|
cbxPreRelease.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||||
|
cbxPreRelease.Size = new System.Drawing.Size(164, 24);
|
||||||
|
cbxPreRelease.TabIndex = 3;
|
||||||
|
cbxPreRelease.Text = "Pre-Release channel";
|
||||||
|
cbxPreRelease.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel4
|
||||||
|
//
|
||||||
|
flowLayoutPanel4.AutoSize = true;
|
||||||
|
flowLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
flowLayoutPanel4.Controls.Add(nudCompletionIntervalHours);
|
||||||
|
flowLayoutPanel4.Controls.Add(label3);
|
||||||
|
flowLayoutPanel4.Controls.Add(nudCompletionIntervalMinutes);
|
||||||
|
flowLayoutPanel4.Controls.Add(label4);
|
||||||
|
flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel4.Location = new System.Drawing.Point(164, 66);
|
||||||
|
flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||||
|
flowLayoutPanel4.Name = "flowLayoutPanel4";
|
||||||
|
flowLayoutPanel4.Size = new System.Drawing.Size(325, 1);
|
||||||
|
flowLayoutPanel4.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// nudCompletionIntervalHours
|
||||||
|
//
|
||||||
|
nudCompletionIntervalHours.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
nudCompletionIntervalHours.Location = new System.Drawing.Point(3, 3);
|
||||||
|
nudCompletionIntervalHours.Name = "nudCompletionIntervalHours";
|
||||||
|
nudCompletionIntervalHours.Size = new System.Drawing.Size(44, 27);
|
||||||
|
nudCompletionIntervalHours.TabIndex = 0;
|
||||||
|
nudCompletionIntervalHours.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new System.Drawing.Point(53, 0);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new System.Drawing.Size(24, 33);
|
||||||
|
label3.TabIndex = 1;
|
||||||
|
label3.Text = "h :";
|
||||||
|
label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// nudCompletionIntervalMinutes
|
||||||
|
//
|
||||||
|
nudCompletionIntervalMinutes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
nudCompletionIntervalMinutes.Location = new System.Drawing.Point(83, 3);
|
||||||
|
nudCompletionIntervalMinutes.Name = "nudCompletionIntervalMinutes";
|
||||||
|
nudCompletionIntervalMinutes.Size = new System.Drawing.Size(44, 27);
|
||||||
|
nudCompletionIntervalMinutes.TabIndex = 2;
|
||||||
|
nudCompletionIntervalMinutes.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new System.Drawing.Point(133, 0);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new System.Drawing.Size(22, 33);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "m";
|
||||||
|
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel2
|
||||||
|
//
|
||||||
|
tableLayoutPanel2.AutoSize = true;
|
||||||
|
tableLayoutPanel2.ColumnCount = 2;
|
||||||
|
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel2.Controls.Add(flowLayoutPanel2, 1, 1);
|
||||||
|
tableLayoutPanel2.Controls.Add(btnReset, 0, 1);
|
||||||
|
tableLayoutPanel2.Controls.Add(flowLayoutPanel3, 0, 0);
|
||||||
|
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
tableLayoutPanel2.Location = new System.Drawing.Point(0, 543);
|
||||||
|
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||||
|
tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||||
|
tableLayoutPanel2.RowCount = 2;
|
||||||
|
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
tableLayoutPanel2.Size = new System.Drawing.Size(499, 74);
|
||||||
|
tableLayoutPanel2.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// btnReset
|
||||||
|
//
|
||||||
|
btnReset.AutoSize = true;
|
||||||
|
btnReset.Location = new System.Drawing.Point(13, 33);
|
||||||
|
btnReset.Name = "btnReset";
|
||||||
|
btnReset.Size = new System.Drawing.Size(130, 30);
|
||||||
|
btnReset.TabIndex = 3;
|
||||||
|
btnReset.Text = "Revert to default";
|
||||||
|
btnReset.UseVisualStyleBackColor = true;
|
||||||
|
btnReset.Click += btnReset_Click;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel3
|
||||||
|
//
|
||||||
|
flowLayoutPanel3.AutoSize = true;
|
||||||
|
flowLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
tableLayoutPanel2.SetColumnSpan(flowLayoutPanel3, 2);
|
||||||
|
flowLayoutPanel3.Controls.Add(lblEnv);
|
||||||
|
flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel3.Location = new System.Drawing.Point(10, 5);
|
||||||
|
flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5);
|
||||||
|
flowLayoutPanel3.Name = "flowLayoutPanel3";
|
||||||
|
flowLayoutPanel3.Size = new System.Drawing.Size(479, 20);
|
||||||
|
flowLayoutPanel3.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// lblEnv
|
||||||
|
//
|
||||||
|
lblEnv.AutoSize = true;
|
||||||
|
lblEnv.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||||
|
lblEnv.Location = new System.Drawing.Point(3, 0);
|
||||||
|
lblEnv.Name = "lblEnv";
|
||||||
|
lblEnv.Size = new System.Drawing.Size(131, 20);
|
||||||
|
lblEnv.TabIndex = 0;
|
||||||
|
lblEnv.Text = "Environment: %E%";
|
||||||
|
//
|
||||||
|
// SettingsForm
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(499, 617);
|
||||||
|
Controls.Add(tableLayoutPanel2);
|
||||||
|
Controls.Add(tableLayoutPanel1);
|
||||||
|
Controls.Add(flowLayoutPanel1);
|
||||||
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
|
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
||||||
|
MaximizeBox = false;
|
||||||
|
MinimizeBox = false;
|
||||||
|
Name = "SettingsForm";
|
||||||
|
Text = "Settings";
|
||||||
|
TopMost = true;
|
||||||
|
Load += SettingsForm_Load;
|
||||||
|
flowLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel1.PerformLayout();
|
||||||
|
flowLayoutPanel2.ResumeLayout(false);
|
||||||
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
tableLayoutPanel1.PerformLayout();
|
||||||
|
flowLayoutPanel4.ResumeLayout(false);
|
||||||
|
flowLayoutPanel4.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalHours).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalMinutes).EndInit();
|
||||||
|
tableLayoutPanel2.ResumeLayout(false);
|
||||||
|
tableLayoutPanel2.PerformLayout();
|
||||||
|
flowLayoutPanel3.ResumeLayout(false);
|
||||||
|
flowLayoutPanel3.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Button btnAccept;
|
||||||
|
private System.Windows.Forms.Button btnDiscard;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Label lblDataLocation;
|
||||||
|
private System.Windows.Forms.TextBox tbxDataLocation;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Button btnReset;
|
||||||
|
private System.Windows.Forms.CheckBox cbxPreRelease;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
|
||||||
|
private System.Windows.Forms.Label lblEnv;
|
||||||
|
private System.Windows.Forms.Label lblCompletionsRefreshWindow;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
|
||||||
|
private System.Windows.Forms.NumericUpDown nudCompletionIntervalHours;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.NumericUpDown nudCompletionIntervalMinutes;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
}
|
||||||
|
}
|
||||||
212
CarManagerV3/Forms/SettingsForm.cs
Normal file
212
CarManagerV3/Forms/SettingsForm.cs
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
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;
|
||||||
|
using CarManagerV3.Util;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
public partial class SettingsForm : Form
|
||||||
|
{
|
||||||
|
// Settings map (Maps settings to controls and default values + optional change event handler function that takes previous and new value)
|
||||||
|
private readonly Dictionary<string, ISettingBinding> settingsMap = new();
|
||||||
|
|
||||||
|
public SettingsForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
initializeSettingsMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeSettingsMap()
|
||||||
|
{
|
||||||
|
// Initialize the settings map with setting keys, associated controls, default values, and optional change event handlers
|
||||||
|
settingsMap["DataLocation"] =
|
||||||
|
new SettingBinding<string>(
|
||||||
|
control: tbxDataLocation,
|
||||||
|
defaultValue: Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3",
|
||||||
|
read: () => Properties.Settings.Default.DataLocation, // strongly typed
|
||||||
|
write: v => Properties.Settings.Default.DataLocation = v, // strongly typed
|
||||||
|
onChange: (before, after) =>
|
||||||
|
{
|
||||||
|
// TODO: handle path change if needed
|
||||||
|
});
|
||||||
|
|
||||||
|
settingsMap["AllowPrerelease"] =
|
||||||
|
new SettingBinding<bool>(
|
||||||
|
control: cbxPreRelease,
|
||||||
|
defaultValue: false,
|
||||||
|
read: () => Properties.Settings.Default.AllowPrerelease,
|
||||||
|
write: v => Properties.Settings.Default.AllowPrerelease = v);
|
||||||
|
|
||||||
|
//TODO: implement refresh settings
|
||||||
|
|
||||||
|
|
||||||
|
lblEnv.Text = lblEnv.Text.Replace("%E%", InstallModeDetector.IsInstalledViaMsi() ? "Installed via MSI" : "Running in portable mode");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SettingsForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
loadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadSettings()
|
||||||
|
{
|
||||||
|
foreach (var kvp in settingsMap)
|
||||||
|
kvp.Value.Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveSettings()
|
||||||
|
{
|
||||||
|
bool requiresRestart = false;
|
||||||
|
foreach (var kvp in settingsMap)
|
||||||
|
{
|
||||||
|
kvp.Value.Save();
|
||||||
|
if (kvp.Value.RequiresRestart())
|
||||||
|
requiresRestart = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Properties.Settings.Default.Save();
|
||||||
|
if(requiresRestart)
|
||||||
|
{
|
||||||
|
DialogResult result = MessageBox.Show(
|
||||||
|
"Some changes you made require a restart to take effect. Do you want to restart now?",
|
||||||
|
"Restart Required",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Information);
|
||||||
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
Application.Restart();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please restart the application as soon as possible to ensure all changes take effect.", "Restart Recommended", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetSettings()
|
||||||
|
{
|
||||||
|
DialogResult confirmReset = MessageBox.Show(
|
||||||
|
"Are you sure you want to reset all settings to their default values? This action cannot be undone.",
|
||||||
|
"Confirm Reset",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
if (confirmReset != DialogResult.Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var kvp in settingsMap)
|
||||||
|
kvp.Value.Reset();
|
||||||
|
|
||||||
|
Properties.Settings.Default.Save();
|
||||||
|
loadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAccept_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
saveSettings();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnDiscard_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReset_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
resetSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal interface ISettingBinding
|
||||||
|
{
|
||||||
|
void Load();
|
||||||
|
void Save();
|
||||||
|
void Reset();
|
||||||
|
bool RequiresRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sealed class SettingBinding<T> : ISettingBinding
|
||||||
|
{
|
||||||
|
private readonly Control control;
|
||||||
|
private readonly T defaultValue;
|
||||||
|
private readonly Func<T> read;
|
||||||
|
private readonly Action<T> write;
|
||||||
|
private readonly Action<T, T>? onChange;
|
||||||
|
private readonly bool requiresRestart;
|
||||||
|
private bool changeRequiresRestart;
|
||||||
|
|
||||||
|
public SettingBinding(Control control, T defaultValue, Func<T> read, Action<T> write, bool requiresRestart = false, Action<T, T>? onChange = null)
|
||||||
|
{
|
||||||
|
this.control = control;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.read = read;
|
||||||
|
this.write = write;
|
||||||
|
this.onChange = onChange;
|
||||||
|
this.requiresRestart = requiresRestart;
|
||||||
|
this.changeRequiresRestart = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Load()
|
||||||
|
{
|
||||||
|
T value = read();
|
||||||
|
ApplyToControl(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
T before = read();
|
||||||
|
T after = ReadFromControl();
|
||||||
|
|
||||||
|
write(after);
|
||||||
|
|
||||||
|
if (onChange != null && !EqualityComparer<T>.Default.Equals(before, after))
|
||||||
|
onChange(before, after);
|
||||||
|
|
||||||
|
if (requiresRestart && !EqualityComparer<T>.Default.Equals(before, after))
|
||||||
|
changeRequiresRestart = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset() => write(defaultValue);
|
||||||
|
|
||||||
|
public bool RequiresRestart() => changeRequiresRestart;
|
||||||
|
|
||||||
|
private void ApplyToControl(T value)
|
||||||
|
{
|
||||||
|
switch (control)
|
||||||
|
{
|
||||||
|
case TextBox tb:
|
||||||
|
tb.Text = value?.ToString() ?? string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CheckBox cb:
|
||||||
|
cb.Checked = value is bool b ? b : Convert.ToBoolean(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new NotSupportedException($"Control type '{control.GetType().Name}' not supported for {typeof(T).Name}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T ReadFromControl()
|
||||||
|
{
|
||||||
|
object result = control switch
|
||||||
|
{
|
||||||
|
TextBox tb when typeof(T) == typeof(string) => tb.Text,
|
||||||
|
CheckBox cb when typeof(T) == typeof(bool) => cb.Checked,
|
||||||
|
_ => throw new NotSupportedException($"Cannot read {typeof(T).Name} from control type '{control.GetType().Name}'.")
|
||||||
|
};
|
||||||
|
|
||||||
|
return (T)result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4636
CarManagerV3/Forms/SettingsForm.resx
Normal file
4636
CarManagerV3/Forms/SettingsForm.resx
Normal file
File diff suppressed because it is too large
Load Diff
191
CarManagerV3/Forms/UpdatePromptForm.Designer.cs
generated
Normal file
191
CarManagerV3/Forms/UpdatePromptForm.Designer.cs
generated
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
partial class UpdatePromptForm
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
lblUpdateTitleStatic = new System.Windows.Forms.Label();
|
||||||
|
label2 = new System.Windows.Forms.Label();
|
||||||
|
lblInstalledVersion = new System.Windows.Forms.Label();
|
||||||
|
lblLatestVersion = new System.Windows.Forms.Label();
|
||||||
|
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
btnInstallUpdate = new System.Windows.Forms.Button();
|
||||||
|
btnDismissUpdate = new System.Windows.Forms.Button();
|
||||||
|
btnReadChangelog = new System.Windows.Forms.Button();
|
||||||
|
flowLayoutPanel1.SuspendLayout();
|
||||||
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
flowLayoutPanel2.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// flowLayoutPanel1
|
||||||
|
//
|
||||||
|
flowLayoutPanel1.Controls.Add(lblUpdateTitleStatic);
|
||||||
|
flowLayoutPanel1.Controls.Add(label2);
|
||||||
|
flowLayoutPanel1.Controls.Add(lblInstalledVersion);
|
||||||
|
flowLayoutPanel1.Controls.Add(lblLatestVersion);
|
||||||
|
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
|
flowLayoutPanel1.Location = new System.Drawing.Point(10, 20);
|
||||||
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
flowLayoutPanel1.Size = new System.Drawing.Size(846, 125);
|
||||||
|
flowLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// lblUpdateTitleStatic
|
||||||
|
//
|
||||||
|
lblUpdateTitleStatic.AutoSize = true;
|
||||||
|
lblUpdateTitleStatic.Font = new System.Drawing.Font("Segoe UI", 14F);
|
||||||
|
lblUpdateTitleStatic.Location = new System.Drawing.Point(3, 0);
|
||||||
|
lblUpdateTitleStatic.Name = "lblUpdateTitleStatic";
|
||||||
|
lblUpdateTitleStatic.Size = new System.Drawing.Size(298, 32);
|
||||||
|
lblUpdateTitleStatic.TabIndex = 4;
|
||||||
|
lblUpdateTitleStatic.Text = "A new Version is Available!";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new System.Drawing.Point(3, 32);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(600, 20);
|
||||||
|
label2.TabIndex = 5;
|
||||||
|
label2.Text = "A new version of Car Manager 3 has been released. Update now to get the latest features.";
|
||||||
|
//
|
||||||
|
// lblInstalledVersion
|
||||||
|
//
|
||||||
|
lblInstalledVersion.AutoSize = true;
|
||||||
|
lblInstalledVersion.Location = new System.Drawing.Point(3, 57);
|
||||||
|
lblInstalledVersion.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0);
|
||||||
|
lblInstalledVersion.Name = "lblInstalledVersion";
|
||||||
|
lblInstalledVersion.Size = new System.Drawing.Size(123, 20);
|
||||||
|
lblInstalledVersion.TabIndex = 6;
|
||||||
|
lblInstalledVersion.Text = "Your version: ?.?.?";
|
||||||
|
//
|
||||||
|
// lblLatestVersion
|
||||||
|
//
|
||||||
|
lblLatestVersion.AutoSize = true;
|
||||||
|
lblLatestVersion.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||||
|
lblLatestVersion.Location = new System.Drawing.Point(3, 77);
|
||||||
|
lblLatestVersion.Name = "lblLatestVersion";
|
||||||
|
lblLatestVersion.Size = new System.Drawing.Size(144, 20);
|
||||||
|
lblLatestVersion.TabIndex = 7;
|
||||||
|
lblLatestVersion.Text = "Latest version: ?.?.?";
|
||||||
|
//
|
||||||
|
// tableLayoutPanel1
|
||||||
|
//
|
||||||
|
tableLayoutPanel1.ColumnCount = 2;
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.Controls.Add(flowLayoutPanel2, 1, 0);
|
||||||
|
tableLayoutPanel1.Controls.Add(btnReadChangelog, 0, 0);
|
||||||
|
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
tableLayoutPanel1.Location = new System.Drawing.Point(10, 393);
|
||||||
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
|
tableLayoutPanel1.RowCount = 1;
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.Size = new System.Drawing.Size(846, 47);
|
||||||
|
tableLayoutPanel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel2
|
||||||
|
//
|
||||||
|
flowLayoutPanel2.Controls.Add(btnInstallUpdate);
|
||||||
|
flowLayoutPanel2.Controls.Add(btnDismissUpdate);
|
||||||
|
flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
|
flowLayoutPanel2.Location = new System.Drawing.Point(423, 0);
|
||||||
|
flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||||
|
flowLayoutPanel2.Size = new System.Drawing.Size(423, 47);
|
||||||
|
flowLayoutPanel2.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// btnInstallUpdate
|
||||||
|
//
|
||||||
|
btnInstallUpdate.AutoSize = true;
|
||||||
|
btnInstallUpdate.Location = new System.Drawing.Point(320, 3);
|
||||||
|
btnInstallUpdate.Name = "btnInstallUpdate";
|
||||||
|
btnInstallUpdate.Size = new System.Drawing.Size(100, 30);
|
||||||
|
btnInstallUpdate.TabIndex = 0;
|
||||||
|
btnInstallUpdate.Text = "Update now";
|
||||||
|
btnInstallUpdate.UseVisualStyleBackColor = true;
|
||||||
|
btnInstallUpdate.Click += btnInstallUpdate_Click;
|
||||||
|
//
|
||||||
|
// btnDismissUpdate
|
||||||
|
//
|
||||||
|
btnDismissUpdate.Location = new System.Drawing.Point(220, 3);
|
||||||
|
btnDismissUpdate.Name = "btnDismissUpdate";
|
||||||
|
btnDismissUpdate.Size = new System.Drawing.Size(94, 29);
|
||||||
|
btnDismissUpdate.TabIndex = 1;
|
||||||
|
btnDismissUpdate.Text = "Dismiss";
|
||||||
|
btnDismissUpdate.UseVisualStyleBackColor = true;
|
||||||
|
btnDismissUpdate.Click += btnDismissUpdate_Click;
|
||||||
|
//
|
||||||
|
// btnReadChangelog
|
||||||
|
//
|
||||||
|
btnReadChangelog.Location = new System.Drawing.Point(3, 3);
|
||||||
|
btnReadChangelog.Name = "btnReadChangelog";
|
||||||
|
btnReadChangelog.Size = new System.Drawing.Size(94, 29);
|
||||||
|
btnReadChangelog.TabIndex = 1;
|
||||||
|
btnReadChangelog.Text = "Changelog";
|
||||||
|
btnReadChangelog.UseVisualStyleBackColor = true;
|
||||||
|
btnReadChangelog.Click += btnReadChangelog_Click;
|
||||||
|
//
|
||||||
|
// UpdatePromptForm
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(866, 450);
|
||||||
|
Controls.Add(tableLayoutPanel1);
|
||||||
|
Controls.Add(flowLayoutPanel1);
|
||||||
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
MaximizeBox = false;
|
||||||
|
MinimizeBox = false;
|
||||||
|
Name = "UpdatePromptForm";
|
||||||
|
Padding = new System.Windows.Forms.Padding(10, 20, 10, 10);
|
||||||
|
Text = "Update Car Manager 3";
|
||||||
|
TopMost = true;
|
||||||
|
flowLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel1.PerformLayout();
|
||||||
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel2.ResumeLayout(false);
|
||||||
|
flowLayoutPanel2.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Label lblUpdateTitleStatic;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label lblInstalledVersion;
|
||||||
|
private System.Windows.Forms.Label lblLatestVersion;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Button btnInstallUpdate;
|
||||||
|
private System.Windows.Forms.Button btnDismissUpdate;
|
||||||
|
private System.Windows.Forms.Button btnReadChangelog;
|
||||||
|
}
|
||||||
|
}
|
||||||
59
CarManagerV3/Forms/UpdatePromptForm.cs
Normal file
59
CarManagerV3/Forms/UpdatePromptForm.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
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;
|
||||||
|
using CarManagerV3.Manager;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
public partial class UpdatePromptForm : Form
|
||||||
|
{
|
||||||
|
public UpdatePromptForm(string currentVersion, string latestVersion)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion);
|
||||||
|
lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion);
|
||||||
|
if (Updater.IsLatestVersionPrerelease())
|
||||||
|
{
|
||||||
|
lblLatestVersion.Text += " (Pre-release)";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnDismissUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnInstallUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
PleaseWait loadForm = new PleaseWait("Downloading the newest version...");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Enabled = false;
|
||||||
|
loadForm.Show();
|
||||||
|
Application.DoEvents();
|
||||||
|
//return;
|
||||||
|
Updater.DownloadNewestInstaller();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("An error occurred while trying to download the update: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
this.Enabled = true;
|
||||||
|
loadForm.Close();
|
||||||
|
this.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReadChangelog_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Updater.OpenReleasePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
CarManagerV3/Forms/UpdatePromptForm.resx
Normal file
120
CarManagerV3/Forms/UpdatePromptForm.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
119
CarManagerV3/Forms/Util/PleaseWait.Designer.cs
generated
119
CarManagerV3/Forms/Util/PleaseWait.Designer.cs
generated
@@ -28,65 +28,90 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
label1 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
lblContent = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
animatedProgressBar1 = new AnimatedProgressBar();
|
||||||
this.SuspendLayout();
|
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
//
|
flowLayoutPanel1.SuspendLayout();
|
||||||
// progressBar1
|
SuspendLayout();
|
||||||
//
|
|
||||||
this.progressBar1.Location = new System.Drawing.Point(12, 62);
|
|
||||||
this.progressBar1.Name = "progressBar1";
|
|
||||||
this.progressBar1.Size = new System.Drawing.Size(422, 23);
|
|
||||||
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
|
||||||
this.progressBar1.TabIndex = 0;
|
|
||||||
this.progressBar1.Click += new System.EventHandler(this.progressBar1_Click);
|
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
|
||||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
label1.Location = new System.Drawing.Point(13, 10);
|
||||||
this.label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(121, 20);
|
label1.Size = new System.Drawing.Size(140, 25);
|
||||||
this.label1.TabIndex = 1;
|
label1.TabIndex = 1;
|
||||||
this.label1.Text = "Please wait...";
|
label1.Text = "Please wait...";
|
||||||
|
label1.UseWaitCursor = true;
|
||||||
//
|
//
|
||||||
// label2
|
// lblContent
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
lblContent.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(13, 33);
|
lblContent.Location = new System.Drawing.Point(13, 40);
|
||||||
this.label2.Name = "label2";
|
lblContent.Margin = new System.Windows.Forms.Padding(3, 5, 3, 10);
|
||||||
this.label2.Size = new System.Drawing.Size(133, 16);
|
lblContent.Name = "lblContent";
|
||||||
this.label2.TabIndex = 2;
|
lblContent.Size = new System.Drawing.Size(144, 20);
|
||||||
this.label2.Text = "Saving your changes";
|
lblContent.TabIndex = 2;
|
||||||
|
lblContent.Text = "Saving your changes";
|
||||||
|
lblContent.UseWaitCursor = true;
|
||||||
|
//
|
||||||
|
// animatedProgressBar1
|
||||||
|
//
|
||||||
|
animatedProgressBar1.Location = new System.Drawing.Point(13, 73);
|
||||||
|
animatedProgressBar1.Name = "animatedProgressBar1";
|
||||||
|
animatedProgressBar1.PrimaryColor = System.Drawing.Color.FromArgb(0, 120, 215);
|
||||||
|
animatedProgressBar1.ProgressBackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
||||||
|
animatedProgressBar1.SecondaryColor = System.Drawing.Color.FromArgb(100, 180, 255);
|
||||||
|
animatedProgressBar1.Size = new System.Drawing.Size(408, 22);
|
||||||
|
animatedProgressBar1.TabIndex = 3;
|
||||||
|
animatedProgressBar1.UseWaitCursor = true;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel1
|
||||||
|
//
|
||||||
|
flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
|
||||||
|
flowLayoutPanel1.Controls.Add(label1);
|
||||||
|
flowLayoutPanel1.Controls.Add(lblContent);
|
||||||
|
flowLayoutPanel1.Controls.Add(animatedProgressBar1);
|
||||||
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
|
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(10);
|
||||||
|
flowLayoutPanel1.Size = new System.Drawing.Size(437, 153);
|
||||||
|
flowLayoutPanel1.TabIndex = 4;
|
||||||
|
flowLayoutPanel1.UseWaitCursor = true;
|
||||||
|
flowLayoutPanel1.WrapContents = false;
|
||||||
//
|
//
|
||||||
// PleaseWait
|
// PleaseWait
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.AutoSize = true;
|
AutoSize = true;
|
||||||
this.ClientSize = new System.Drawing.Size(446, 97);
|
ClientSize = new System.Drawing.Size(437, 153);
|
||||||
this.ControlBox = false;
|
ControlBox = false;
|
||||||
this.Controls.Add(this.label2);
|
Controls.Add(flowLayoutPanel1);
|
||||||
this.Controls.Add(this.label1);
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.Controls.Add(this.progressBar1);
|
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
MaximizeBox = false;
|
||||||
this.MaximizeBox = false;
|
MinimizeBox = false;
|
||||||
this.MinimizeBox = false;
|
Name = "PleaseWait";
|
||||||
this.Name = "PleaseWait";
|
ShowIcon = false;
|
||||||
this.ShowIcon = false;
|
ShowInTaskbar = false;
|
||||||
this.ShowInTaskbar = false;
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Please Wait";
|
Text = "Please Wait";
|
||||||
this.ResumeLayout(false);
|
TopMost = true;
|
||||||
this.PerformLayout();
|
UseWaitCursor = true;
|
||||||
|
flowLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.ProgressBar progressBar1;
|
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label lblContent;
|
||||||
|
private AnimatedProgressBar animatedProgressBar1;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,18 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
public partial class PleaseWait : Form
|
public partial class PleaseWait : Form
|
||||||
{
|
{
|
||||||
public PleaseWait()
|
public PleaseWait(string content = "Saving your changes...")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
|
||||||
|
ControlStyles.AllPaintingInWmPaint |
|
||||||
|
ControlStyles.UserPaint, true);
|
||||||
|
|
||||||
// loading animation
|
// loading animation
|
||||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
animatedProgressBar1.StartAnimation();
|
||||||
progressBar1.MarqueeAnimationSpeed = 30;
|
lblContent.Text = content;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
274
CarManagerV3/Forms/Welcome.Designer.cs
generated
Normal file
274
CarManagerV3/Forms/Welcome.Designer.cs
generated
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
namespace CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
partial class Welcome
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Welcome));
|
||||||
|
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
pbxLogo = new System.Windows.Forms.PictureBox();
|
||||||
|
lblWelcome = new System.Windows.Forms.Label();
|
||||||
|
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
label1 = new System.Windows.Forms.Label();
|
||||||
|
label2 = new System.Windows.Forms.Label();
|
||||||
|
label3 = new System.Windows.Forms.Label();
|
||||||
|
label4 = new System.Windows.Forms.Label();
|
||||||
|
flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
btnNewFile = new System.Windows.Forms.Button();
|
||||||
|
btnOpenFile = new System.Windows.Forms.Button();
|
||||||
|
btnExit = new System.Windows.Forms.Button();
|
||||||
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
tableLayoutPanel2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pbxLogo).BeginInit();
|
||||||
|
flowLayoutPanel1.SuspendLayout();
|
||||||
|
flowLayoutPanel2.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// tableLayoutPanel1
|
||||||
|
//
|
||||||
|
tableLayoutPanel1.ColumnCount = 1;
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 0);
|
||||||
|
tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 0, 1);
|
||||||
|
tableLayoutPanel1.Controls.Add(flowLayoutPanel2, 0, 2);
|
||||||
|
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
|
tableLayoutPanel1.RowCount = 3;
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 200F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
|
||||||
|
tableLayoutPanel1.Size = new System.Drawing.Size(590, 492);
|
||||||
|
tableLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// tableLayoutPanel2
|
||||||
|
//
|
||||||
|
tableLayoutPanel2.BackColor = System.Drawing.SystemColors.MenuHighlight;
|
||||||
|
tableLayoutPanel2.ColumnCount = 1;
|
||||||
|
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel2.Controls.Add(pbxLogo, 0, 0);
|
||||||
|
tableLayoutPanel2.Controls.Add(lblWelcome, 0, 1);
|
||||||
|
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
tableLayoutPanel2.ForeColor = System.Drawing.SystemColors.Window;
|
||||||
|
tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
|
||||||
|
tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||||
|
tableLayoutPanel2.RowCount = 2;
|
||||||
|
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F));
|
||||||
|
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
|
||||||
|
tableLayoutPanel2.Size = new System.Drawing.Size(590, 200);
|
||||||
|
tableLayoutPanel2.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// pbxLogo
|
||||||
|
//
|
||||||
|
pbxLogo.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
pbxLogo.Image = (System.Drawing.Image)resources.GetObject("pbxLogo.Image");
|
||||||
|
pbxLogo.Location = new System.Drawing.Point(3, 15);
|
||||||
|
pbxLogo.Margin = new System.Windows.Forms.Padding(3, 15, 3, 3);
|
||||||
|
pbxLogo.Name = "pbxLogo";
|
||||||
|
pbxLogo.Size = new System.Drawing.Size(584, 122);
|
||||||
|
pbxLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||||
|
pbxLogo.TabIndex = 0;
|
||||||
|
pbxLogo.TabStop = false;
|
||||||
|
//
|
||||||
|
// lblWelcome
|
||||||
|
//
|
||||||
|
lblWelcome.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblWelcome.AutoSize = true;
|
||||||
|
lblWelcome.Font = new System.Drawing.Font("Segoe UI", 20F, System.Drawing.FontStyle.Bold);
|
||||||
|
lblWelcome.Location = new System.Drawing.Point(0, 147);
|
||||||
|
lblWelcome.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
lblWelcome.Name = "lblWelcome";
|
||||||
|
lblWelcome.Size = new System.Drawing.Size(590, 46);
|
||||||
|
lblWelcome.TabIndex = 1;
|
||||||
|
lblWelcome.Text = "Welcome to Car Manager";
|
||||||
|
lblWelcome.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel1
|
||||||
|
//
|
||||||
|
flowLayoutPanel1.Controls.Add(label1);
|
||||||
|
flowLayoutPanel1.Controls.Add(label2);
|
||||||
|
flowLayoutPanel1.Controls.Add(label3);
|
||||||
|
flowLayoutPanel1.Controls.Add(label4);
|
||||||
|
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
|
flowLayoutPanel1.Location = new System.Drawing.Point(3, 203);
|
||||||
|
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(20, 20, 20, 0);
|
||||||
|
flowLayoutPanel1.Size = new System.Drawing.Size(584, 236);
|
||||||
|
flowLayoutPanel1.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||||
|
label1.Location = new System.Drawing.Point(23, 20);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new System.Drawing.Size(396, 20);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "Car Manager lets you manage your lot easier than ever!";
|
||||||
|
label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new System.Drawing.Point(23, 40);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(310, 20);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Get started by creating or opening a .CSV file.";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.ForeColor = System.Drawing.SystemColors.AppWorkspace;
|
||||||
|
label3.Location = new System.Drawing.Point(23, 110);
|
||||||
|
label3.Margin = new System.Windows.Forms.Padding(3, 50, 3, 0);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new System.Drawing.Size(203, 20);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "Developed by Jaro Kaulmann";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.ForeColor = System.Drawing.SystemColors.AppWorkspace;
|
||||||
|
label4.Location = new System.Drawing.Point(23, 130);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new System.Drawing.Size(204, 20);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "Copyright © Jaro.digital 2026";
|
||||||
|
//
|
||||||
|
// flowLayoutPanel2
|
||||||
|
//
|
||||||
|
flowLayoutPanel2.Controls.Add(btnNewFile);
|
||||||
|
flowLayoutPanel2.Controls.Add(btnOpenFile);
|
||||||
|
flowLayoutPanel2.Controls.Add(btnExit);
|
||||||
|
flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
|
flowLayoutPanel2.Location = new System.Drawing.Point(3, 445);
|
||||||
|
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||||
|
flowLayoutPanel2.Size = new System.Drawing.Size(584, 44);
|
||||||
|
flowLayoutPanel2.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// btnNewFile
|
||||||
|
//
|
||||||
|
btnNewFile.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnNewFile.AutoSize = true;
|
||||||
|
btnNewFile.BackColor = System.Drawing.SystemColors.MenuHighlight;
|
||||||
|
btnNewFile.FlatAppearance.BorderSize = 0;
|
||||||
|
btnNewFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
btnNewFile.ForeColor = System.Drawing.SystemColors.Window;
|
||||||
|
btnNewFile.Location = new System.Drawing.Point(434, 3);
|
||||||
|
btnNewFile.Name = "btnNewFile";
|
||||||
|
btnNewFile.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
btnNewFile.Size = new System.Drawing.Size(147, 36);
|
||||||
|
btnNewFile.TabIndex = 2;
|
||||||
|
btnNewFile.Text = "New File";
|
||||||
|
btnNewFile.UseVisualStyleBackColor = false;
|
||||||
|
btnNewFile.Click += btnNewFile_Click;
|
||||||
|
//
|
||||||
|
// btnOpenFile
|
||||||
|
//
|
||||||
|
btnOpenFile.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnOpenFile.AutoSize = true;
|
||||||
|
btnOpenFile.BackColor = System.Drawing.SystemColors.HotTrack;
|
||||||
|
btnOpenFile.FlatAppearance.BorderSize = 0;
|
||||||
|
btnOpenFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
btnOpenFile.ForeColor = System.Drawing.SystemColors.Window;
|
||||||
|
btnOpenFile.Location = new System.Drawing.Point(281, 3);
|
||||||
|
btnOpenFile.Name = "btnOpenFile";
|
||||||
|
btnOpenFile.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
btnOpenFile.Size = new System.Drawing.Size(147, 36);
|
||||||
|
btnOpenFile.TabIndex = 0;
|
||||||
|
btnOpenFile.Text = "Open a File";
|
||||||
|
btnOpenFile.UseVisualStyleBackColor = false;
|
||||||
|
btnOpenFile.Click += btnOpenFile_Click;
|
||||||
|
//
|
||||||
|
// btnExit
|
||||||
|
//
|
||||||
|
btnExit.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnExit.AutoSize = true;
|
||||||
|
btnExit.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||||
|
btnExit.FlatAppearance.BorderSize = 0;
|
||||||
|
btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
btnExit.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
btnExit.Location = new System.Drawing.Point(172, 3);
|
||||||
|
btnExit.Name = "btnExit";
|
||||||
|
btnExit.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
btnExit.Size = new System.Drawing.Size(103, 36);
|
||||||
|
btnExit.TabIndex = 1;
|
||||||
|
btnExit.Text = "Exit";
|
||||||
|
btnExit.UseVisualStyleBackColor = false;
|
||||||
|
btnExit.Click += btnExit_Click;
|
||||||
|
//
|
||||||
|
// Welcome
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(590, 492);
|
||||||
|
ControlBox = false;
|
||||||
|
Controls.Add(tableLayoutPanel1);
|
||||||
|
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
|
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
|
||||||
|
Name = "Welcome";
|
||||||
|
ShowInTaskbar = false;
|
||||||
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
Text = "Welcome";
|
||||||
|
TopMost = true;
|
||||||
|
Load += Welcome_Load;
|
||||||
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
tableLayoutPanel2.ResumeLayout(false);
|
||||||
|
tableLayoutPanel2.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pbxLogo).EndInit();
|
||||||
|
flowLayoutPanel1.ResumeLayout(false);
|
||||||
|
flowLayoutPanel1.PerformLayout();
|
||||||
|
flowLayoutPanel2.ResumeLayout(false);
|
||||||
|
flowLayoutPanel2.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private System.Windows.Forms.PictureBox pbxLogo;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Label lblWelcome;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Button btnOpenFile;
|
||||||
|
private System.Windows.Forms.Button btnExit;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||||
|
private System.Windows.Forms.Button btnNewFile;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
}
|
||||||
|
}
|
||||||
48
CarManagerV3/Forms/Welcome.cs
Normal file
48
CarManagerV3/Forms/Welcome.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
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 CarManagerV3.Forms
|
||||||
|
{
|
||||||
|
public partial class Welcome : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
// callback functions
|
||||||
|
// Open file
|
||||||
|
public Action OpenFileCallback;
|
||||||
|
|
||||||
|
public Action NewFileCallback;
|
||||||
|
|
||||||
|
|
||||||
|
public Welcome()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Welcome_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOpenFile_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.OpenFileCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnExit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnNewFile_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.NewFileCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5013
CarManagerV3/Forms/Welcome.resx
Normal file
5013
CarManagerV3/Forms/Welcome.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Net;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using CarManagerV3.Forms;
|
||||||
|
|
||||||
namespace CarManagerV3
|
namespace CarManagerV3
|
||||||
{
|
{
|
||||||
@@ -8,12 +11,18 @@ namespace CarManagerV3
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ImageManager
|
internal class ImageManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static string _imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||||
|
private static NetworkCredential myNetCred = null;
|
||||||
|
private static bool disableImageFetch = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the image folder by creating it if it does not exist.
|
/// Initializes the image folder by creating it if it does not exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void InitializeImageFolder()
|
public static void InitializeImageFolder()
|
||||||
{
|
{
|
||||||
string path = "images";
|
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||||
|
string path = _imagePath;
|
||||||
|
|
||||||
if (!System.IO.Directory.Exists(path))
|
if (!System.IO.Directory.Exists(path))
|
||||||
{
|
{
|
||||||
@@ -31,7 +40,8 @@ namespace CarManagerV3
|
|||||||
/// <returns>The image path for this Car.</returns>
|
/// <returns>The image path for this Car.</returns>
|
||||||
public static string GetImagePath(Car car)
|
public static string GetImagePath(Car car)
|
||||||
{
|
{
|
||||||
string basePath = "images/";
|
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||||
|
string basePath = $"{_imagePath}/";
|
||||||
string fileName = $"{car.Make}_{car.Model}_{car.Year}_{car.Color}.png";
|
string fileName = $"{car.Make}_{car.Model}_{car.Year}_{car.Color}.png";
|
||||||
return basePath + fileName;
|
return basePath + fileName;
|
||||||
}
|
}
|
||||||
@@ -60,7 +70,7 @@ namespace CarManagerV3
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Image.FromFile("images/no_image_available.png");
|
return Image.FromFile($"{_imagePath}/no_image_available.png");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -85,19 +95,65 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (disableImageFetch) return;
|
||||||
string url = $"https://cdn.imagin.studio/getimage?customer=hrjavascript-mastery&zoomType=fullscreen&make={car.Make}&modelFamily={car.Model}&modelYear={car.Year}&angle=front&paintDescription={car.Color}&fileType=png";
|
string url = $"https://cdn.imagin.studio/getimage?customer=hrjavascript-mastery&zoomType=fullscreen&make={car.Make}&modelFamily={car.Model}&modelYear={car.Year}&angle=front&paintDescription={car.Color}&fileType=png";
|
||||||
//add Referer header to avoid 403 error
|
//add Referer header to avoid 403 error
|
||||||
using (var client = new System.Net.WebClient())
|
using (var client = new System.Net.WebClient())
|
||||||
{
|
{
|
||||||
client.Headers.Add("Referer", "http://localhost");
|
client.Headers.Add("Referer", "http://localhost");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
client.Credentials = myNetCred;
|
||||||
|
client.Proxy.Credentials = myNetCred;
|
||||||
|
//DEBUG:: if (myNetCred == null) throw new WebException();
|
||||||
client.DownloadFile(url, path);
|
client.DownloadFile(url, path);
|
||||||
}
|
}
|
||||||
catch
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
|
// is status code 407?
|
||||||
|
//if (ex.Response is HttpWebResponse response && response.StatusCode == HttpStatusCode.ProxyAuthenticationRequired)
|
||||||
|
//{
|
||||||
|
// Console.Error.WriteLine("Proxy authentication required. Prompting for credentials.");
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (myNetCred != null)
|
||||||
|
{
|
||||||
|
DialogResult disableImgDialogRetry = MessageBox.Show("Something went wrong when fetching images. Are you credentials correct? Do you want to disable Image fetching for this session or rety with different credentials?", "Invalid Credentials", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
|
||||||
|
if(disableImgDialogRetry == DialogResult.Cancel)
|
||||||
|
{
|
||||||
|
disableImageFetch = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NetCredentials netCredForm = new NetCredentials();
|
||||||
|
DialogResult dialogRes = netCredForm.ShowDialog();
|
||||||
|
netCredForm.BringToFront();
|
||||||
|
netCredForm.Focus();
|
||||||
|
if (dialogRes == DialogResult.OK)
|
||||||
|
{
|
||||||
|
NetworkCredential netcred = netCredForm.GetCredentails();
|
||||||
|
myNetCred = netcred;
|
||||||
|
FetchImage(car);
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
DialogResult disableImgDialog = MessageBox.Show("Do you want to disable image fetching for this session?", "Disable Image fetching?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
if(disableImgDialog == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
disableImageFetch = true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
FetchImage(car);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine(ex.Message);
|
||||||
// if error, use fallback image no_image_available.png
|
// if error, use fallback image no_image_available.png
|
||||||
System.IO.File.Copy("images/no_image_available.png", path);
|
//System.IO.File.Copy($"{_imagePath}/no_image_available.png", path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ namespace CarManagerV3
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The path of the txt file that contains recently opened file paths.
|
/// The path of the txt file that contains recently opened file paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly string recentPathsFile = "recent_paths.txt";
|
private static string recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a file at a specified path if it does not already exist.
|
/// Initializes a file at a specified path if it does not already exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path of the file.</param>
|
||||||
public static void InitializeFile(string path)
|
public static void InitializeFile(string path)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -31,7 +31,7 @@ namespace CarManagerV3
|
|||||||
using (StreamWriter writer = new StreamWriter(@path))
|
using (StreamWriter writer = new StreamWriter(@path))
|
||||||
{
|
{
|
||||||
// Create the file, empty
|
// Create the file, empty
|
||||||
writer.WriteLine();
|
//writer.WriteLine();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,48 @@ namespace CarManagerV3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a file and its parent folders at a specified path if they do not already exist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path of the file.</param>
|
||||||
|
public static void initializeFileAndFolders(string path, bool folderOnly = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string directory = Path.GetDirectoryName(path);
|
||||||
|
Console.WriteLine($"Initializing file and folders for path: {path}");
|
||||||
|
if (!Directory.Exists(directory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
}
|
||||||
|
if(!folderOnly) InitializeFile(path);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine($"Error initializing file and folders: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures the directory exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
public static void EnsureDirectoryExists(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string directory = Path.GetDirectoryName(path);
|
||||||
|
if (directory != null && !Directory.Exists(directory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine($"Error ensuring directory exists: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads cars from a specified file path.
|
/// Reads cars from a specified file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -150,18 +192,7 @@ namespace CarManagerV3
|
|||||||
List<string> paths = new List<string>();
|
List<string> paths = new List<string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(recentPathsFile))
|
paths = GetRecentPaths();
|
||||||
{
|
|
||||||
using (StreamReader reader = new StreamReader(recentPathsFile))
|
|
||||||
{
|
|
||||||
string line;
|
|
||||||
while ((line = reader.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
paths.Add(line);
|
|
||||||
}
|
|
||||||
reader.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
paths.Remove(path);
|
paths.Remove(path);
|
||||||
paths.Insert(0, path);
|
paths.Insert(0, path);
|
||||||
if (paths.Count > 5)
|
if (paths.Count > 5)
|
||||||
@@ -194,7 +225,9 @@ namespace CarManagerV3
|
|||||||
List<string> paths = new List<string>();
|
List<string> paths = new List<string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(recentPathsFile))
|
recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||||
|
initializeFileAndFolders(recentPathsFile);
|
||||||
|
if (File.Exists(recentPathsFile)) //TODO: Remove
|
||||||
{
|
{
|
||||||
using (StreamReader reader = new StreamReader(recentPathsFile))
|
using (StreamReader reader = new StreamReader(recentPathsFile))
|
||||||
{
|
{
|
||||||
@@ -215,9 +248,11 @@ namespace CarManagerV3
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder of the most recently opened file, or the users documents folder if no recent files.
|
/// Gets the folder of the most recently opened file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>
|
||||||
|
/// The folder path of the most recently opened file, or the users documents folder if no recent files.
|
||||||
|
/// </returns>
|
||||||
public static string getRecentFolder()
|
public static string getRecentFolder()
|
||||||
{
|
{
|
||||||
List<string> recentPaths = GetRecentPaths();
|
List<string> recentPaths = GetRecentPaths();
|
||||||
@@ -232,7 +267,23 @@ namespace CarManagerV3
|
|||||||
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the recently opened file paths list by deleting the recent paths file.
|
||||||
|
/// </summary>
|
||||||
|
public static void ClearRecentPaths()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(recentPathsFile))
|
||||||
|
{
|
||||||
|
File.Delete(recentPathsFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine($"Error clearing recent paths: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ namespace CarManagerV3
|
|||||||
// Initialize global static list of cars
|
// Initialize global static list of cars
|
||||||
static List<Car> cars = new List<Car>();
|
static List<Car> cars = new List<Car>();
|
||||||
// Initialize default file path for car data.
|
// Initialize default file path for car data.
|
||||||
// TODO: If no recent file paths are found, prompt user to select a file path instead of using a hardcoded default in the program folder.
|
static string filePath = "";
|
||||||
static string filePath = "cars.csv";
|
|
||||||
|
|
||||||
static bool hasConfirmedMigration = false;
|
static bool hasConfirmedMigration = false;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ namespace CarManagerV3
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a car to the collection.
|
/// Adds a car to the collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="car">The car to add.</param>
|
/// <param name="car">The <see cref="Car"/> to add.</param>
|
||||||
public static void AddCar(Car car)
|
public static void AddCar(Car car)
|
||||||
{
|
{
|
||||||
cars = SafeManager.ReadCars(filePath);
|
cars = SafeManager.ReadCars(filePath);
|
||||||
@@ -57,7 +56,7 @@ namespace CarManagerV3
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes a car from the collection.
|
/// Removes a car from the collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="car">The car to remove.</param>
|
/// <param name="car">The <see cref="Car"/> to remove.</param>
|
||||||
public static void RemoveCar(Car car)
|
public static void RemoveCar(Car car)
|
||||||
{
|
{
|
||||||
cars = SafeManager.ReadCars(filePath);
|
cars = SafeManager.ReadCars(filePath);
|
||||||
@@ -73,7 +72,7 @@ namespace CarManagerV3
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If the car's Id has changed during editing, this will not work correctly. Keep Id immutable!
|
/// If the car's Id has changed during editing, this will not work correctly. Keep Id immutable!
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="car">The car to update.</param>
|
/// <param name="car">The <see cref="Car"/> to update.</param>
|
||||||
public static void UpdateCar(Car car)
|
public static void UpdateCar(Car car)
|
||||||
{
|
{
|
||||||
Car existingCar = GetCarById(car.Id);
|
Car existingCar = GetCarById(car.Id);
|
||||||
@@ -119,6 +118,11 @@ namespace CarManagerV3
|
|||||||
filePath = path;
|
filePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Normalizes the orders of the cars in the collection to be sequential starting from 1, while keeping the relative order the same.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cars">The list of <see cref="Car"/>s.</param>
|
||||||
|
/// <returns>A normalized List of <see cref="Car"/>s </returns>
|
||||||
public static List<Car> normalizeOrders(List<Car> cars)
|
public static List<Car> normalizeOrders(List<Car> cars)
|
||||||
{
|
{
|
||||||
// Normalize the Order field of all cars to be sequential starting from 1, while keeping the relative order the same.
|
// Normalize the Order field of all cars to be sequential starting from 1, while keeping the relative order the same.
|
||||||
@@ -130,6 +134,11 @@ namespace CarManagerV3
|
|||||||
return orderedCars;
|
return orderedCars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompts the user to confirm migration if they haven't already confirmed it for the current session.
|
||||||
|
/// This is to prevent multiple annoying popups if the user tries to open multiple files that require migration.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the user has accepted to migrate the file, otherwise False</returns>
|
||||||
public static bool askForMigration()
|
public static bool askForMigration()
|
||||||
{
|
{
|
||||||
if (hasConfirmedMigration)
|
if (hasConfirmedMigration)
|
||||||
|
|||||||
226
CarManagerV3/Manager/Updater.cs
Normal file
226
CarManagerV3/Manager/Updater.cs
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Manager
|
||||||
|
{
|
||||||
|
internal class Updater
|
||||||
|
{
|
||||||
|
|
||||||
|
private static readonly string GitApiUrl = "https://git.jaro.digital/api/v1";
|
||||||
|
private static readonly string GitRepoOwner = "frozd";
|
||||||
|
private static readonly string GitRepoName = "carmanager-3";
|
||||||
|
private static readonly string GitApiRepoUrl = $"{GitApiUrl}/repos/{GitRepoOwner}/{GitRepoName}";
|
||||||
|
private static readonly string LatestReleaseEndpoint = $"{GitApiRepoUrl}/releases/latest";
|
||||||
|
private static readonly string PreReleaseEndpoint = $"{GitApiRepoUrl}/releases?limit=1&pre-release=true";
|
||||||
|
private static string latestVersionCache = null;
|
||||||
|
private static DateTime lastChecked = DateTime.MinValue;
|
||||||
|
private static readonly int CacheDurationMinutes = 60;
|
||||||
|
private static bool cacheIncludesPrerelease = false;
|
||||||
|
private static readonly string debugVersion = null;//"1.2.0";
|
||||||
|
private static bool isLatestVersionPrerelease = false;
|
||||||
|
|
||||||
|
public static string GetCurrentVersion(bool cutTrailingZeros = false)
|
||||||
|
{
|
||||||
|
//DEBUG::
|
||||||
|
if (debugVersion != null)
|
||||||
|
{
|
||||||
|
return debugVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
var asm = Assembly.GetEntryAssembly()!;
|
||||||
|
Version v = asm.GetName().Version ?? new Version(0, 0, 0, 0);
|
||||||
|
string VersionString = v.ToString();
|
||||||
|
if(cutTrailingZeros)
|
||||||
|
{
|
||||||
|
// Remove trailing .0 parts
|
||||||
|
while (VersionString.EndsWith(".0"))
|
||||||
|
{
|
||||||
|
VersionString = VersionString.Substring(0, VersionString.Length - 2);
|
||||||
|
}
|
||||||
|
return VersionString;
|
||||||
|
}
|
||||||
|
return VersionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsCacheValid(bool includePreRelease = false)
|
||||||
|
{
|
||||||
|
return includePreRelease == cacheIncludesPrerelease && latestVersionCache != null && (DateTime.Now - lastChecked).TotalMinutes < CacheDurationMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void InvalidateCache()
|
||||||
|
{
|
||||||
|
latestVersionCache = null;
|
||||||
|
lastChecked = DateTime.MinValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetCache(string version, bool includePreRelease = false)
|
||||||
|
{
|
||||||
|
latestVersionCache = version;
|
||||||
|
cacheIncludesPrerelease = includePreRelease;
|
||||||
|
lastChecked = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string GetLatestVersion(bool includePreRelease = false)
|
||||||
|
{
|
||||||
|
if (IsCacheValid(includePreRelease))
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("Using cached latest version: " + latestVersionCache);
|
||||||
|
return latestVersionCache;
|
||||||
|
}
|
||||||
|
string latestVersion = null;
|
||||||
|
// Get the latest stable version first
|
||||||
|
using (var client = new System.Net.Http.HttpClient())
|
||||||
|
{
|
||||||
|
var response = client.GetAsync(LatestReleaseEndpoint).Result;
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var content = response.Content.ReadAsStringAsync().Result;
|
||||||
|
dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
||||||
|
latestVersion = release.tag_name;
|
||||||
|
isLatestVersionPrerelease = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If pre-release is requested, check for the latest pre-release version
|
||||||
|
if (includePreRelease)
|
||||||
|
{
|
||||||
|
using (var client = new System.Net.Http.HttpClient())
|
||||||
|
{
|
||||||
|
UrlEncoder encoder = System.Text.Encodings.Web.UrlEncoder.Default;
|
||||||
|
var response = client.GetAsync(PreReleaseEndpoint).Result;
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
var content = response.Content.ReadAsStringAsync().Result;
|
||||||
|
dynamic releases = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
||||||
|
//System.Diagnostics.Debug.WriteLine("Fetched pre-release versions, count: " + releases.Count);
|
||||||
|
if (releases.Count > 0)
|
||||||
|
{
|
||||||
|
var preReleaseVersion = releases[0].tag_name.ToString();
|
||||||
|
//System.Diagnostics.Debug.WriteLine("Latest unstable version: " + preReleaseVersion);
|
||||||
|
|
||||||
|
// Compare versions and return the newer one
|
||||||
|
if (IsNewerVersion(preReleaseVersion, latestVersion))
|
||||||
|
{
|
||||||
|
latestVersion = preReleaseVersion;
|
||||||
|
isLatestVersionPrerelease = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("Failed to fetch pre-release versions, status code: " + response.StatusCode + " at: " + PreReleaseEndpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetCache(latestVersion, includePreRelease);
|
||||||
|
return latestVersion;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsNewerVersion(string versionA, string versionB)
|
||||||
|
{
|
||||||
|
if (versionA == null) return false;
|
||||||
|
if (versionB == null) return true;
|
||||||
|
Version vA = new Version(versionA.TrimStart('v'));
|
||||||
|
Version vB = new Version(versionB.TrimStart('v'));
|
||||||
|
return vA > vB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void DownloadNewestInstaller(bool includePreRelease = false)
|
||||||
|
{
|
||||||
|
string latestVersion = GetLatestVersion(includePreRelease);
|
||||||
|
if (latestVersion == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Could not fetch latest version from Git API.");
|
||||||
|
}
|
||||||
|
|
||||||
|
string releaseUrl = $"{GitApiRepoUrl}/releases/tags/{latestVersion}";
|
||||||
|
using (var client = new System.Net.Http.HttpClient())
|
||||||
|
{
|
||||||
|
var response = client.GetAsync(releaseUrl).Result;
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var content = response.Content.ReadAsStringAsync().Result;
|
||||||
|
dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
||||||
|
string downloadUrl = null;
|
||||||
|
foreach (var asset in release.assets)
|
||||||
|
{
|
||||||
|
// file that ends with .msi
|
||||||
|
if (asset.name.ToString().EndsWith(".msi"))
|
||||||
|
{
|
||||||
|
downloadUrl = asset.browser_download_url;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (downloadUrl != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Download the installer to the users set Data dir, run it, and then exit the application.
|
||||||
|
string tempFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"CarManagerInstaller_{latestVersion}.msi");
|
||||||
|
using (var downloadClient = new System.Net.WebClient())
|
||||||
|
{
|
||||||
|
downloadClient.DownloadFile(downloadUrl, tempFilePath);
|
||||||
|
}
|
||||||
|
// Use ProcessStartInfo with UseShellExecute to launch the MSI file
|
||||||
|
var processStartInfo = new System.Diagnostics.ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = tempFilePath,
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
System.Diagnostics.Process.Start(processStartInfo);
|
||||||
|
|
||||||
|
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Could not find installer asset in the latest release.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Could not fetch release information from Git API.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsUpdateAvailable(bool includePreRelease = false)
|
||||||
|
{
|
||||||
|
string currentVersion = GetCurrentVersion();
|
||||||
|
string latestVersion = GetLatestVersion(includePreRelease);
|
||||||
|
return IsNewerVersion(latestVersion, currentVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenReleasePage(string version = null)
|
||||||
|
{
|
||||||
|
if (version == null)
|
||||||
|
{
|
||||||
|
version = GetLatestVersion(true);
|
||||||
|
}
|
||||||
|
string releaseUrl = $"https://git.jaro.digital/{GitRepoOwner}/{GitRepoName}/releases/tag/{version}";
|
||||||
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = releaseUrl,
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsLatestVersionPrerelease()
|
||||||
|
{
|
||||||
|
// Ensure we have the latest version info in cache
|
||||||
|
return isLatestVersionPrerelease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace CarManagerV3
|
namespace CarManagerV3
|
||||||
@@ -9,11 +10,13 @@ namespace CarManagerV3
|
|||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
string pathToOpen = null;
|
||||||
|
if (args.Length > 0) pathToOpen = args[0];
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new MainForm());
|
Application.Run(new MainForm(pathToOpen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,9 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="CarCompleteData" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\merged-cars.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
<data name="Icon_Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Icon_Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Icon_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Icon_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
48
CarManagerV3/Properties/Settings.Designer.cs
generated
48
CarManagerV3/Properties/Settings.Designer.cs
generated
@@ -22,5 +22,53 @@ namespace CarManagerV3.Properties {
|
|||||||
return defaultInstance;
|
return defaultInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||||
|
public string DataLocation {
|
||||||
|
get {
|
||||||
|
return ((string)(this["DataLocation"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["DataLocation"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||||
|
public bool AllowPrerelease {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["AllowPrerelease"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["AllowPrerelease"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("2026-01-01")]
|
||||||
|
public global::System.DateTime LastFetchedAutoCompletions {
|
||||||
|
get {
|
||||||
|
return ((global::System.DateTime)(this["LastFetchedAutoCompletions"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["LastFetchedAutoCompletions"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("24.00:00:00")]
|
||||||
|
public global::System.TimeSpan FetchAutoCompletionsInterval {
|
||||||
|
get {
|
||||||
|
return ((global::System.TimeSpan)(this["FetchAutoCompletionsInterval"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["FetchAutoCompletionsInterval"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CarManagerV3.Properties" GeneratedClassName="Settings">
|
||||||
<Profiles>
|
<Profiles />
|
||||||
<Profile Name="(Default)" />
|
<Settings>
|
||||||
</Profiles>
|
<Setting Name="DataLocation" Type="System.String" Scope="User">
|
||||||
<Settings />
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="AllowPrerelease" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">False</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="LastFetchedAutoCompletions" Type="System.DateTime" Scope="User">
|
||||||
|
<Value Profile="(Default)">2026-01-01</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FetchAutoCompletionsInterval" Type="System.TimeSpan" Scope="User">
|
||||||
|
<Value Profile="(Default)">24.00:00:00</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
7
CarManagerV3/Properties/launchSettings.json
Normal file
7
CarManagerV3/Properties/launchSettings.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"CarManagerV3": {
|
||||||
|
"commandName": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6573
CarManagerV3/Resources/merged-cars.json
Normal file
6573
CarManagerV3/Resources/merged-cars.json
Normal file
File diff suppressed because it is too large
Load Diff
261
CarManagerV3/Util/CarCompletions.cs
Normal file
261
CarManagerV3/Util/CarCompletions.cs
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using CarManagerV3.Classes;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Util
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides car manufacturer and model autocompletion data for the application.
|
||||||
|
/// Manages fetching, caching, and retrieval of car brand and model information from remote sources and local storage.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This class maintains a static list of car manufacturers and their models, supports fetching updated data from remote URLs,
|
||||||
|
/// and caches the data locally for offline use. It implements retry logic to prevent excessive network requests.
|
||||||
|
/// </remarks>
|
||||||
|
internal class CarCompletions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A list of URLs that should be used to fetch the json file with autocompletion data.
|
||||||
|
/// Multiple URLs are provided to ensure that if one source is unavailable, the others can be used as a fallback. The application should attempt to fetch the data from each URL in order until it successfully retrieves the data or exhausts all options.
|
||||||
|
/// </summary>
|
||||||
|
private static readonly string[] carDataFileUrls =
|
||||||
|
{
|
||||||
|
"https://static.clsw.app/carmgm/merged-cars.json"
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The filename for the cached car completion data in the user's data directory.
|
||||||
|
/// </summary>
|
||||||
|
private static readonly string carCompletionDataFileName = "car_data.json";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The timestamp of the last fetch attempt for car completion data.
|
||||||
|
/// Used to implement retry throttling to prevent excessive network requests.
|
||||||
|
/// </summary>
|
||||||
|
private static DateTime lastFetchAttempt = Properties.Settings.Default.LastFetchedAutoCompletions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum time interval that must elapse between fetch attempts.
|
||||||
|
/// Prevents excessive retry attempts when the remote source is unavailable.
|
||||||
|
/// </summary>
|
||||||
|
private static readonly TimeSpan fetchRetryInterval = Properties.Settings.Default.FetchAutoCompletionsInterval; // Minimum interval between fetch attempts
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the full file path for the car completion data file.
|
||||||
|
/// Ensures that the user data directory exists before returning the path.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The full file path to the car completion data file in the user's data directory.</returns>
|
||||||
|
private static string getCarCompletionDataFilePath()
|
||||||
|
{
|
||||||
|
var userDataDir = Properties.Settings.Default.DataLocation;
|
||||||
|
SafeManager.EnsureDirectoryExists(userDataDir);
|
||||||
|
return Path.Combine(userDataDir, carCompletionDataFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The static list of car manufacturers and their available models.
|
||||||
|
/// This list serves as the default data and is updated when fetching from remote sources or local cache.
|
||||||
|
/// </summary>
|
||||||
|
public static List<CarManufacturer> carBrands = new List<CarManufacturer>
|
||||||
|
{
|
||||||
|
new CarManufacturer("Toyota") { Models = new List<string> { "Camry", "Corolla", "RAV4" } },
|
||||||
|
new CarManufacturer("Honda") { Models = new List<string> { "Civic", "Accord", "CR-V" } },
|
||||||
|
new CarManufacturer("Ford") { Models = new List<string> { "F-150", "Mustang", "Escape" } },
|
||||||
|
new CarManufacturer("Chevrolet") { Models = new List<string> { "Silverado", "Malibu", "Equinox" } },
|
||||||
|
new CarManufacturer("BMW") { Models = new List<string> { "3 Series", "5 Series", "X5" } },
|
||||||
|
new CarManufacturer("Mercedes-Benz") { Models = new List<string> { "C-Class", "E-Class", "GLC" } },
|
||||||
|
new CarManufacturer("Audi") { Models = new List<string> { "A4", "A6", "Q5" } },
|
||||||
|
new CarManufacturer("Volkswagen") { Models = new List<string> { "Golf", "Passat", "Tiguan" } },
|
||||||
|
new CarManufacturer("Nissan") { Models = new List<string> { "Altima", "Sentra", "Rogue" } },
|
||||||
|
new CarManufacturer("Hyundai") { Models = new List<string> { "Elantra", "Sonata", "Tucson" } },
|
||||||
|
new CarManufacturer("SEAT") { Models = new List<string> { "Ibiza", "Leon", "Ateca", "Alhambra" } },
|
||||||
|
new CarManufacturer("Skoda") { Models = new List<string> { "Octavia", "Fabia", "Kodiaq" } },
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the full list of car brands.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A list of strings containing all available car manufacturer names.</returns>
|
||||||
|
public static List<string> GetCarBrands()
|
||||||
|
{
|
||||||
|
return carBrands.Select(c => c.Name).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the list of car models for a specified brand.
|
||||||
|
/// The search is case-insensitive.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="brand">The name of the car brand to search for.</param>
|
||||||
|
/// <returns>A list of car models for the specified brand, or an empty list if the brand is not found.</returns>
|
||||||
|
public static List<string> GetCarModels(string brand)
|
||||||
|
{
|
||||||
|
var manufacturer = carBrands.FirstOrDefault(c => c.Name.Equals(brand, StringComparison.OrdinalIgnoreCase));
|
||||||
|
return manufacturer != null ? manufacturer.Models : new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A predefined list of common car colors for autocompletion purposes.
|
||||||
|
/// Provides standard color options that are frequently used in vehicle descriptions.
|
||||||
|
/// </summary>
|
||||||
|
public static List<string> CommonColors = new List<string>
|
||||||
|
{
|
||||||
|
"Black", "White", "Gray", "Silver", "Red", "Blue", "Green", "Yellow", "Brown", "Orange"
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads car completion data from an embedded resource file.
|
||||||
|
/// This method is intended to populate the carBrands list from a JSON resource embedded in the project.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The expected resource format is a JSON object where keys are car brand names and values are lists of model names.
|
||||||
|
/// Resource name: CarCompleteData (JSON file format).
|
||||||
|
/// Currently not implemented.
|
||||||
|
/// </remarks>
|
||||||
|
public static void ReadFromResourceFile()
|
||||||
|
{
|
||||||
|
// Read the json file from the projects resources and populate the carBrands list
|
||||||
|
// Format is a json object with the key being the car brand and the value being a list of models
|
||||||
|
|
||||||
|
// Get the json string from the resources, Resource name is CarCompleteData, it is a .json file
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the car data from urls asynchronous and saves it in the users data directory for offline use.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A task representing the asynchronous operation.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method implements retry throttling using the <see cref="fetchRetryInterval"/> to prevent excessive network requests.
|
||||||
|
/// It attempts to fetch data from each URL in <see cref="carDataFileUrls"/> in order until successful or all URLs are exhausted.
|
||||||
|
/// The fetched data is saved to the local file system for offline access.
|
||||||
|
/// </remarks>
|
||||||
|
public static async Task FetchCarCompletionDataFromUrlsAsync()
|
||||||
|
{
|
||||||
|
if(DateTime.Now - lastFetchAttempt < fetchRetryInterval)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("Fetch attempt skipped to avoid excessive retries. Last attempt was at " + lastFetchAttempt);
|
||||||
|
Console.WriteLine("Fetch attempt skipped to avoid excessive retries. Last attempt was at " + lastFetchAttempt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach (var url in carDataFileUrls)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lastFetchAttempt = DateTime.Now;
|
||||||
|
Properties.Settings.Default.LastFetchedAutoCompletions = lastFetchAttempt;
|
||||||
|
Properties.Settings.Default.Save();
|
||||||
|
using var httpClient = new HttpClient();
|
||||||
|
var response = await httpClient.GetAsync(url);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
var jsonData = await response.Content.ReadAsStringAsync();
|
||||||
|
// Saves the json data to a file in the user's data directory for offline use
|
||||||
|
var filePath = getCarCompletionDataFilePath();
|
||||||
|
await File.WriteAllTextAsync(filePath, jsonData);
|
||||||
|
System.Diagnostics.Debug.WriteLine($"Successfully fetched car data from {url} and saved to {filePath}");
|
||||||
|
break; // Exit the loop if data is successfully fetched
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Log the error and try the next URL
|
||||||
|
System.Diagnostics.Debug.WriteLine($"Failed to fetch car data from {url}: {ex.Message}");
|
||||||
|
Console.WriteLine($"Failed to fetch car data from {url}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the car data from urls and saves it in the users data directory for offline use.
|
||||||
|
/// This is a synchronous wrapper that blocks until the asynchronous fetch operation completes.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A task representing the synchronous operation.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method wraps <see cref="FetchCarCompletionDataFromUrlsAsync"/> and runs it synchronously.
|
||||||
|
/// Consider using the async version directly when possible to avoid blocking the thread.
|
||||||
|
/// </remarks>
|
||||||
|
public static Task FetchCarCompletionDataFromUrls()
|
||||||
|
{
|
||||||
|
// Run synchronously
|
||||||
|
return Task.Run(() => FetchCarCompletionDataFromUrlsAsync().Wait());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads car manufacturer data from the locally cached file.
|
||||||
|
/// Optionally fetches updated data from remote sources before loading from file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skipOnlineUpdate">If true, skips fetching data from remote sources and only reads from the local cache. Default is false.</param>
|
||||||
|
/// <returns>A list of <see cref="CarManufacturer"/> objects populated from the cached file, or an empty list if the file doesn't exist or an error occurs.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// The expected file format is a JSON object where keys are car brand names and values are lists of model names.
|
||||||
|
/// If the file doesn't exist or cannot be read, an error message is logged and an empty list is returned.
|
||||||
|
/// </remarks>
|
||||||
|
public static List<CarManufacturer> GetFromFile(bool skipOnlineUpdate = false)
|
||||||
|
{
|
||||||
|
if (!skipOnlineUpdate) FetchCarCompletionDataFromUrls();
|
||||||
|
var filePath = getCarCompletionDataFilePath();
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var jsonData = File.ReadAllText(filePath);
|
||||||
|
// Parse the json data and populate the carBrands list
|
||||||
|
// Format is a json object with the key being the car brand and the value being a list of models
|
||||||
|
var carData = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(jsonData);
|
||||||
|
List<CarManufacturer> _carBrands = carData.Select(kvp => new CarManufacturer(kvp.Key) { Models = kvp.Value }).ToList();
|
||||||
|
return _carBrands;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Silent error.
|
||||||
|
Console.WriteLine($"Failed to read car data from file: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Car data file not found. Please ensure that the data has been fetched successfully at least once.");
|
||||||
|
}
|
||||||
|
return new List<CarManufacturer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the static <see cref="carBrands"/> list with data from the local cache file.
|
||||||
|
/// Only updates the list if the cached file contains valid data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skipOnlineUpdate">If true, skips fetching data from remote sources before updating. Default is false.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method calls <see cref="GetFromFile"/> and updates <see cref="carBrands"/> only if the returned list is not empty.
|
||||||
|
/// If no data is retrieved, the existing <see cref="carBrands"/> list remains unchanged.
|
||||||
|
/// </remarks>
|
||||||
|
public static void UpdateCarCompletionData(bool skipOnlineUpdate = false)
|
||||||
|
{
|
||||||
|
var updatedCarBrands = GetFromFile(skipOnlineUpdate);
|
||||||
|
if (updatedCarBrands.Count > 0)
|
||||||
|
{
|
||||||
|
carBrands = updatedCarBrands;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously updates the car completion data by fetching from remote sources and updating the local cache.
|
||||||
|
/// This is the recommended method for refreshing car data in the application.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A task representing the asynchronous update operation.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method first attempts to fetch updated data from remote URLs using <see cref="FetchCarCompletionDataFromUrlsAsync"/>,
|
||||||
|
/// then updates the static <see cref="carBrands"/> list from the local cache using <see cref="UpdateCarCompletionData"/>.
|
||||||
|
/// </remarks>
|
||||||
|
public static async Task UpdateCarCompletionDataAsync()
|
||||||
|
{
|
||||||
|
await FetchCarCompletionDataFromUrlsAsync();
|
||||||
|
System.Diagnostics.Debug.WriteLine("Car completion data fetch attempt completed. Now updating local data.");
|
||||||
|
UpdateCarCompletionData(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
38
CarManagerV3/Util/InstallModeDetector.cs
Normal file
38
CarManagerV3/Util/InstallModeDetector.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace CarManagerV3.Util
|
||||||
|
{
|
||||||
|
public static class InstallModeDetector
|
||||||
|
{
|
||||||
|
private const string _keyPath = @"Software\Jaro Digital\CarManager3";
|
||||||
|
private const string KeyPath = _keyPath;
|
||||||
|
private const string ValueName = "InstallType";
|
||||||
|
|
||||||
|
public static bool IsInstalledViaMsi()
|
||||||
|
{
|
||||||
|
// Prefer HKLM if your MSI is per-machine; fallback to HKCU if per-user.
|
||||||
|
System.Diagnostics.Debug.WriteLine($"Checking registry for install type at HKLM\\{KeyPath} and HKCU\\{KeyPath}");
|
||||||
|
object? val =
|
||||||
|
Registry.GetValue($@"HKEY_LOCAL_MACHINE\{KeyPath}", ValueName, null)
|
||||||
|
?? Registry.GetValue($@"HKEY_CURRENT_USER\{KeyPath}", ValueName, null);
|
||||||
|
|
||||||
|
return val is string s && string.Equals(s, "MSI", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPortable() => !IsInstalledViaMsi();
|
||||||
|
|
||||||
|
public static string GetInstallType()
|
||||||
|
{
|
||||||
|
object? val =
|
||||||
|
Registry.GetValue($@"HKEY_LOCAL_MACHINE\{KeyPath}", ValueName, null)
|
||||||
|
?? Registry.GetValue($@"HKEY_CURRENT_USER\{KeyPath}", ValueName, null);
|
||||||
|
return val as string ?? "Unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
# Car Manager 3
|
# Car Manager 3
|
||||||
|
|
||||||
This is a simple school project in C# - Honestly you shouldn't be looking at this if you don't know me.
|
This is a simple school project in C# - Honestly you shouldn't be looking at this if you don't know me.
|
||||||
|
|||||||
Reference in New Issue
Block a user