feat: settings, installer banner
This commit is contained in:
@@ -27,10 +27,22 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_9E31D74ECE8E439595C6ABD6B8247CF4"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_A6F761D38264485ABAB61B553E1CAE3C"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
"Configurations"
|
||||
{
|
||||
@@ -168,6 +180,46 @@
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9E31D74ECE8E439595C6ABD6B8247CF4"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\Downloads\\cm3_splash.jpg"
|
||||
"TargetName" = "8:cm3_splash.jpg"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_B69138933B80450EA18D704C54E8913F"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:TRUE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
{
|
||||
"SourcePath" = "8:..\\..\\..\\..\\Downloads\\cm3_installer.jpg"
|
||||
"TargetName" = "8:cm3_installer.jpg"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_B69138933B80450EA18D704C54E8913F"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:TRUE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
}
|
||||
"FileType"
|
||||
{
|
||||
@@ -280,15 +332,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Car Manager 3"
|
||||
"ProductCode" = "8:{00455F93-7F99-4B1E-A7CE-0DFE372CB230}"
|
||||
"PackageCode" = "8:{0359946B-F979-4152-867A-D7CF98402C4B}"
|
||||
"ProductCode" = "8:{79688954-DAEC-4255-BF3C-8FD89EEC28AA}"
|
||||
"PackageCode" = "8:{6ED782FF-C62F-45E9-B6A8-756604C01717}"
|
||||
"UpgradeCode" = "8:{6FF57925-465E-4DB9-85DA-CE933191A3DD}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.2.0"
|
||||
"ProductVersion" = "8:1.3.0"
|
||||
"Manufacturer" = "8:Jaro Digital"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
@@ -296,9 +348,9 @@
|
||||
"Subject" = "8:"
|
||||
"ARPCONTACT" = "8:Jaro Kaulmann"
|
||||
"Keywords" = "8:"
|
||||
"ARPCOMMENTS" = "8:"
|
||||
"ARPCOMMENTS" = "8:Car Manager 3 Installer"
|
||||
"ARPURLINFOABOUT" = "8:gital"
|
||||
"ARPPRODUCTICON" = "8:"
|
||||
"ARPPRODUCTICON" = "8:_39292C9AEE694F0B982DDECDC0233E12"
|
||||
"ARPIconIndex" = "3:0"
|
||||
"SearchPath" = "8:"
|
||||
"UseSystemSearchPath" = "11:TRUE"
|
||||
@@ -600,7 +652,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"UpdateText"
|
||||
@@ -644,7 +697,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"CopyrightWarning"
|
||||
@@ -692,7 +746,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
}
|
||||
@@ -714,7 +769,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
}
|
||||
@@ -745,7 +801,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"ShowProgress"
|
||||
@@ -801,7 +858,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
}
|
||||
@@ -817,7 +875,7 @@
|
||||
{
|
||||
"{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_152B71A00E0C40219C498C8AC811C061"
|
||||
{
|
||||
"Sequence" = "3:100"
|
||||
"Sequence" = "3:110"
|
||||
"DisplayName" = "8:Welcome"
|
||||
"UseDynamicProperties" = "11:TRUE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
@@ -832,7 +890,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"CopyrightWarning"
|
||||
@@ -880,7 +939,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"InstallAllUsersVisible"
|
||||
@@ -915,7 +975,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
}
|
||||
@@ -946,7 +1007,8 @@
|
||||
"Type" = "3:8"
|
||||
"ContextData" = "8:Bitmap"
|
||||
"Attributes" = "3:4"
|
||||
"Setting" = "3:1"
|
||||
"Setting" = "3:2"
|
||||
"Value" = "8:_D8CA421409AE44ED9C006015D34EC17B"
|
||||
"UsePlugInResources" = "11:TRUE"
|
||||
}
|
||||
"ShowProgress"
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<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>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<CarManagerV3.Properties.Settings>
|
||||
<setting name="DataLocation" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</CarManagerV3.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@@ -24,9 +24,9 @@
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
|
||||
<AssemblyTitle>Car Manager 3</AssemblyTitle>
|
||||
<Version>1.2</Version>
|
||||
<AssemblyVersion>1.2.0</AssemblyVersion>
|
||||
<FileVersion>1.2.0</FileVersion>
|
||||
<Version>1.3</Version>
|
||||
<AssemblyVersion>1.3.0</AssemblyVersion>
|
||||
<FileVersion>1.3.0</FileVersion>
|
||||
<Product>Car Manager 3</Product>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace CarManagerV3
|
||||
|
||||
public async void LoadImage()
|
||||
{
|
||||
this.CarImage = null; // Clear current image
|
||||
this.CarImage = pbxCar.InitialImage; // Set to loading image
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
17
CarManagerV3/Forms/MainForm.Designer.cs
generated
17
CarManagerV3/Forms/MainForm.Designer.cs
generated
@@ -53,6 +53,7 @@
|
||||
openWelcomeScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
clearRecentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
imageList1 = new System.Windows.Forms.ImageList(components);
|
||||
settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
tlpControls.SuspendLayout();
|
||||
tlpSearch.SuspendLayout();
|
||||
@@ -231,7 +232,7 @@
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { addCarToolStripMenuItem, importToolStripMenuItem, clearSearchToolStripMenuItem });
|
||||
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";
|
||||
@@ -239,21 +240,21 @@
|
||||
// addCarToolStripMenuItem
|
||||
//
|
||||
addCarToolStripMenuItem.Name = "addCarToolStripMenuItem";
|
||||
addCarToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
addCarToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
addCarToolStripMenuItem.Text = "Add Car";
|
||||
addCarToolStripMenuItem.Click += addCarToolStripMenuItem_Click;
|
||||
//
|
||||
// importToolStripMenuItem
|
||||
//
|
||||
importToolStripMenuItem.Name = "importToolStripMenuItem";
|
||||
importToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
importToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
importToolStripMenuItem.Text = "Import";
|
||||
importToolStripMenuItem.Click += importToolStripMenuItem_Click;
|
||||
//
|
||||
// clearSearchToolStripMenuItem
|
||||
//
|
||||
clearSearchToolStripMenuItem.Name = "clearSearchToolStripMenuItem";
|
||||
clearSearchToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
clearSearchToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
clearSearchToolStripMenuItem.Text = "Clear Search";
|
||||
clearSearchToolStripMenuItem.Click += clearSearchToolStripMenuItem_Click;
|
||||
//
|
||||
@@ -289,6 +290,13 @@
|
||||
imageList1.Images.SetKeyName(0, "Icon_Search.png");
|
||||
imageList1.Images.SetKeyName(1, "Icon_Add.png");
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
settingsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
settingsToolStripMenuItem.Text = "Settings";
|
||||
settingsToolStripMenuItem.Click += settingsToolStripMenuItem_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
@@ -339,5 +347,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem clearRecentFilesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,11 @@ namespace CarManagerV3
|
||||
public MainForm(string pathToOpen = "")
|
||||
{
|
||||
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.
|
||||
List<string> recentFiles = SafeManager.GetRecentPaths();
|
||||
@@ -102,7 +107,7 @@ namespace CarManagerV3
|
||||
/// </summary>
|
||||
/// <param name="_cars">The cars.</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);
|
||||
@@ -132,12 +137,12 @@ namespace CarManagerV3
|
||||
}
|
||||
// compare details
|
||||
// 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}");
|
||||
// changes
|
||||
card = existing;
|
||||
|
||||
if(force) card.LoadImage(); // reload image if forced refresh
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -531,5 +536,19 @@ namespace CarManagerV3
|
||||
{
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,15 +150,15 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
||||
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
||||
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAYAQAAAJNU0Z0AUkBTAIBAQIB
|
||||
AAGAAQABgAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/
|
||||
AAGIAQABiAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/
|
||||
AP8AzAADCAEKAyMBMgMuAUYDFgEe/wAtAAMIAQoDIwEyAk8BTgGXAlYBVAGrAy4BRv8ALQADIwEyAk8B
|
||||
TgGXAf8BmQEzAf8DTgGWAyMBMiwAA10BzAT/9AADKAE8Ak8BTgGXAl8BWwHTA04BlgMjATIDCAEKLAAD
|
||||
XQHMBP/UAAMDAQQDDwETA0QBewJPAU4BlwNNAZIDQAFuAwYBBwMpAT0DTgGYAlsBWQHAAk8BTgGXAyMB
|
||||
MgMIAQowAANdAcwE/9AAAxMBGgMxAU0DRAF5AlwBWQHBAmEBXQHPAl0BWwHKAlcBVQG0Az8BbQNSAaMC
|
||||
WwFZAcADTgGYAygBPDgAA10BzAT/zAADAwEEAzEBTQJZAVcBvAJgAV0BzgNLAYwDQAFvA0ABbwNLAYwC
|
||||
YAFdAc4BhgFzAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB
|
||||
YAFdAc4BggFxAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB
|
||||
CAJgAV0BzgM+AWsDBAEFKAADXQHMLP+4AANEAXkDWgG/A0sBjAQCEAAEAgNLAYwCWgFYAbcDQQFxKAAD
|
||||
UgGjA10BzANdAcwDXQHMA10BzAOOAfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D
|
||||
UgGjA10BzANdAcwDXQHMA10BzAOJAfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D
|
||||
QAFvGAADQAFvAl8BXAHLA04BlDwAA10BzAT/zAACTwFOAZcCYAFdAc4DQAFvGAADQAFvAl4BWwHNA04B
|
||||
ljwAA10BzAT/zAADRAF6AlsBWQHAA0sBjAQCEAAEAgNLAYwCWgFYAb0CRAFDAXc8AANdAcwE/8wAAw4B
|
||||
EgNEAXgCYAFdAc4DBgEIBAIIAAQCAwYBCAJgAV0BzgJDAUIBdQMMAQ88AANdAcwE/8wAAwMBBAMxAU0C
|
||||
|
||||
218
CarManagerV3/Forms/SettingsForm.Designer.cs
generated
Normal file
218
CarManagerV3/Forms/SettingsForm.Designer.cs
generated
Normal file
@@ -0,0 +1,218 @@
|
||||
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();
|
||||
lblDataLocation = new System.Windows.Forms.Label();
|
||||
tbxDataLocation = new System.Windows.Forms.TextBox();
|
||||
tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
btnReset = new System.Windows.Forms.Button();
|
||||
flowLayoutPanel1.SuspendLayout();
|
||||
flowLayoutPanel2.SuspendLayout();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
tableLayoutPanel2.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, 0);
|
||||
flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
flowLayoutPanel2.Size = new System.Drawing.Size(240, 64);
|
||||
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(lblDataLocation, 0, 0);
|
||||
tableLayoutPanel1.Controls.Add(tbxDataLocation, 1, 0);
|
||||
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 = 2;
|
||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
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;
|
||||
//
|
||||
// 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(102, 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(121, 3);
|
||||
tbxDataLocation.Name = "tbxDataLocation";
|
||||
tbxDataLocation.Size = new System.Drawing.Size(365, 27);
|
||||
tbxDataLocation.TabIndex = 1;
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
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, 0);
|
||||
tableLayoutPanel2.Controls.Add(btnReset, 0, 0);
|
||||
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
tableLayoutPanel2.Location = new System.Drawing.Point(0, 553);
|
||||
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||
tableLayoutPanel2.RowCount = 1;
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
tableLayoutPanel2.Size = new System.Drawing.Size(499, 64);
|
||||
tableLayoutPanel2.TabIndex = 4;
|
||||
//
|
||||
// btnReset
|
||||
//
|
||||
btnReset.AutoSize = true;
|
||||
btnReset.Location = new System.Drawing.Point(13, 3);
|
||||
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;
|
||||
//
|
||||
// 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();
|
||||
tableLayoutPanel2.ResumeLayout(false);
|
||||
tableLayoutPanel2.PerformLayout();
|
||||
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.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;
|
||||
}
|
||||
}
|
||||
107
CarManagerV3/Forms/SettingsForm.cs
Normal file
107
CarManagerV3/Forms/SettingsForm.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
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 SettingsForm : Form
|
||||
{
|
||||
// Settings map (Maps settings to controls and default values + optional change event handler function that takes previous and new value)
|
||||
private Dictionary<string, (Control control, string defaultValue, Action<string, string> onChange)> settingsMap = new Dictionary<string, (Control control, string defaultValue, Action<string, string> onChange)>();
|
||||
|
||||
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"] = (tbxDataLocation, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3", (string before, string after) =>
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void SettingsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
private void loadSettings()
|
||||
{
|
||||
// with settings map
|
||||
foreach (var setting in settingsMap)
|
||||
{
|
||||
string key = setting.Key;
|
||||
Control control = setting.Value.control;
|
||||
string value = Properties.Settings.Default[key]?.ToString() ?? string.Empty;
|
||||
control.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSettings()
|
||||
{
|
||||
// Save settings using the settings map
|
||||
foreach (var setting in settingsMap)
|
||||
{
|
||||
string key = setting.Key;
|
||||
Control control = setting.Value.control;
|
||||
string value = control.Text;
|
||||
string oldValue = Properties.Settings.Default[key]?.ToString() ?? string.Empty;
|
||||
// Save the value to application settings
|
||||
Properties.Settings.Default[key] = value;
|
||||
// Invoke the change event handler if it exists and the value has changed
|
||||
if (setting.Value.onChange != null && oldValue != value)
|
||||
{
|
||||
setting.Value.onChange(oldValue, value);
|
||||
}
|
||||
}
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
// Reset settings to default values using the settings map
|
||||
foreach (var setting in settingsMap)
|
||||
{
|
||||
string key = setting.Key;
|
||||
string defaultValue = setting.Value.defaultValue;
|
||||
// Reset the value to default in application settings
|
||||
Properties.Settings.Default[key] = defaultValue;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
4636
CarManagerV3/Forms/SettingsForm.resx
Normal file
4636
CarManagerV3/Forms/SettingsForm.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@ namespace CarManagerV3
|
||||
internal class ImageManager
|
||||
{
|
||||
|
||||
private static string _imagePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3\\images";
|
||||
private static string _imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
private static NetworkCredential myNetCred = null;
|
||||
private static bool disableImageFetch = false;
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CarManagerV3
|
||||
/// </summary>
|
||||
public static void InitializeImageFolder()
|
||||
{
|
||||
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
string path = _imagePath;
|
||||
|
||||
if (!System.IO.Directory.Exists(path))
|
||||
@@ -39,6 +40,7 @@ namespace CarManagerV3
|
||||
/// <returns>The image path for this Car.</returns>
|
||||
public static string GetImagePath(Car car)
|
||||
{
|
||||
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
string basePath = $"{_imagePath}/";
|
||||
string fileName = $"{car.Make}_{car.Model}_{car.Year}_{car.Color}.png";
|
||||
return basePath + fileName;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CarManagerV3
|
||||
/// <summary>
|
||||
/// The path of the txt file that contains recently opened file paths.
|
||||
/// </summary>
|
||||
private static readonly string recentPathsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3\\recent_paths.txt";
|
||||
private static string recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -46,16 +46,17 @@ namespace CarManagerV3
|
||||
/// 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)
|
||||
public static void initializeFileAndFolders(string path, bool folderOnly = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
string directory = Path.GetDirectoryName(path);
|
||||
if (!Directory.Exists(directory))
|
||||
//string directory = Path.GetDirectoryName(path);
|
||||
Console.WriteLine($"Initializing file and folders for path: {path}");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
InitializeFile(path);
|
||||
if(!folderOnly) InitializeFile(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -204,6 +205,7 @@ namespace CarManagerV3
|
||||
List<string> paths = new List<string>();
|
||||
try
|
||||
{
|
||||
recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||
initializeFileAndFolders(recentPathsFile);
|
||||
if (File.Exists(recentPathsFile)) //TODO: Remove
|
||||
{
|
||||
|
||||
12
CarManagerV3/Properties/Settings.Designer.cs
generated
12
CarManagerV3/Properties/Settings.Designer.cs
generated
@@ -22,5 +22,17 @@ namespace CarManagerV3.Properties {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CarManagerV3.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="DataLocation" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Reference in New Issue
Block a user