feature: welcome screen, toolbar & chore: more docs
This commit is contained in:
@@ -15,8 +15,7 @@ namespace CarManagerV3
|
||||
// Initialize global static list of cars
|
||||
static List<Car> cars = new List<Car>();
|
||||
// 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 = "cars.csv";
|
||||
static string filePath = "";
|
||||
|
||||
static bool hasConfirmedMigration = false;
|
||||
|
||||
@@ -46,7 +45,7 @@ namespace CarManagerV3
|
||||
/// <summary>
|
||||
/// Adds a car to the collection.
|
||||
/// </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)
|
||||
{
|
||||
cars = SafeManager.ReadCars(filePath);
|
||||
@@ -57,7 +56,7 @@ namespace CarManagerV3
|
||||
/// <summary>
|
||||
/// Removes a car from the collection.
|
||||
/// </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)
|
||||
{
|
||||
cars = SafeManager.ReadCars(filePath);
|
||||
@@ -73,7 +72,7 @@ namespace CarManagerV3
|
||||
/// <remarks>
|
||||
/// If the car's Id has changed during editing, this will not work correctly. Keep Id immutable!
|
||||
/// </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)
|
||||
{
|
||||
Car existingCar = GetCarById(car.Id);
|
||||
@@ -119,6 +118,11 @@ namespace CarManagerV3
|
||||
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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// <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()
|
||||
{
|
||||
if (hasConfirmedMigration)
|
||||
|
||||
Reference in New Issue
Block a user