chore: partially document MainForm

This commit is contained in:
2026-01-23 12:46:57 +01:00
parent afa98b2681
commit b20e0a94dd

View File

@@ -19,6 +19,7 @@ namespace CarManagerV3
{ {
InitializeComponent(); InitializeComponent();
// 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(recentFiles.Count > 0)
{ {
@@ -33,6 +34,11 @@ namespace CarManagerV3
} }
/// <summary>
/// Refreshes the cars displayed in the flow layout panel.
/// </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)
{ {
@@ -143,6 +149,13 @@ namespace CarManagerV3
detailsForm.ShowDialog(); detailsForm.ShowDialog();
} }
/// <summary>
/// Filters the cars by a search query.
/// </summary>
/// <param name="query">The search query.</param>
/// <returns>
/// A list of <see cref="Car"/> objects that match the query.
/// </returns>
List<Car> filterCarsByQuery(string query) List<Car> filterCarsByQuery(string query)
{ {
List<Car> results = new List<Car>(); List<Car> results = new List<Car>();
@@ -156,6 +169,10 @@ namespace CarManagerV3
return results; return results;
} }
/// <summary>
/// Searches the list of cars by a query and refreshes the display.
/// </summary>
/// <param name="query">The query.</param>
void searchList(string query) void searchList(string query)
{ {
List<Car> results = filterCarsByQuery(query); List<Car> results = filterCarsByQuery(query);
@@ -327,11 +344,15 @@ namespace CarManagerV3
} }
} }
// TODO: Unbind and remove this.
private void recentFilesToolStripMenuItem_Click(object sender, EventArgs e) private void recentFilesToolStripMenuItem_Click(object sender, EventArgs e)
{ {
} }
/// <summary>
/// Refreshes the recently opened files menu.
/// </summary>
private void refreshRecents() private void refreshRecents()
{ {
recentFilesToolStripMenuItem.DropDownItems.Clear(); recentFilesToolStripMenuItem.DropDownItems.Clear();