feat: settings, installer banner
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user