@@ -48,6 +48,12 @@ public partial class FrmSettings : Form
4848 "rbt_MapColourModeDarkPale"
4949 ] ;
5050
51+ private readonly List < string > _rbtStartupFolderOptions =
52+ [
53+ "rbt_SetStartup_Folder" ,
54+ "rbt_UseLastUsedFolder"
55+ ] ;
56+
5157 /// <summary>
5258 /// This Form provides an interface for the user to edit various app and file-specific settings.
5359 /// </summary>
@@ -64,6 +70,14 @@ public FrmSettings()
6470 _nowLoadingSettingsData = false ;
6571 }
6672
73+ /// <summary>
74+ /// Initializes and assigns labels and values to controls within the form, including populating language selection
75+ /// ComboBoxes and restoring saved user preferences.
76+ /// </summary>
77+ /// <remarks>This method retrieves all relevant controls from the various tab pages,
78+ /// populates language selection ComboBoxes with both native and English names, and selects the previously saved
79+ /// language if available. It also assigns text values to other controls as needed. This method should be called
80+ /// during form initialization to ensure controls are properly configured for user interaction.</remarks>
6781 private void AssignControlLabelsAndValues ( )
6882 {
6983 HelperNonStatic helperNonstatic = new ( ) ;
@@ -209,10 +223,15 @@ private static string GetParentNameToUse(Control cItem)
209223 }
210224
211225 /// <summary>
212- /// Handles loading the basic values into Settings when the user opens the Form
226+ /// Handles the Load event of the settings form, initializing controls and loading user preferences from application
227+ /// settings.
213228 /// </summary>
214- /// <param name="sender">Unused</param>
215- /// <param name="e">Unused</param>
229+ /// <remarks>This method populates form controls with values from persisted settings, sets up file
230+ /// extension lists, and configures UI elements based on user preferences. It is called automatically when the form
231+ /// is loaded. Changes made during this event ensure that the form reflects the current application state and user
232+ /// configuration.</remarks>
233+ /// <param name="sender">The source of the event, typically the settings form instance.</param>
234+ /// <param name="e">An EventArgs object containing event data.</param>
216235 private void FrmSettings_Load ( object sender ,
217236 EventArgs e )
218237 {
@@ -353,6 +372,13 @@ private void FrmSettings_Load(object sender,
353372 "Normal" ; // technically we could just ignore this
354373 }
355374
375+ // ensure that there _is_ a setting for UserSettingUseLastUsedFolderAsStartup
376+ // this could be a situation when the user updates to the app version newly containing this feature
377+ if ( ! rbt_SetStartup_Folder . Checked && ! rbt_UseLastUsedFolder . Checked )
378+ {
379+ rbt_SetStartup_Folder . Checked = true ;
380+ }
381+
356382 _nowLoadingSettingsData = false ;
357383
358384 LoadCustomRulesDGV ( ) ;
@@ -560,7 +586,6 @@ private void LoadCustomCityLogicDGV()
560586 /// checkbox changes.
561587 /// </summary>
562588 /// <returns>KVP list of country codes and countries</returns>
563-
564589 private static Dictionary < string , string > refreshClh_CountryCodeOptions ( bool ckb_IncludePredeterminedCountries )
565590 {
566591 Dictionary < string , string > clh_CountryCodeOptions = [ ] ;
@@ -780,6 +805,11 @@ private void btn_Generic_OK_Click(object sender,
780805 newValue : "" ) ;
781806 }
782807 }
808+
809+ else if ( _rbtStartupFolderOptions . Contains ( item : rbt . Name ) )
810+ {
811+ HelperVariables . UserSettingUseLastUsedFolderAsStartup = rbt_UseLastUsedFolder . Checked ;
812+ }
783813 }
784814 }
785815 }
@@ -813,6 +843,11 @@ private void btn_Generic_OK_Click(object sender,
813843 private void Pbx_Browse_Startup_Folder_Click ( object sender ,
814844 EventArgs e )
815845 {
846+ fbd_StartupFolder . Description = ReturnControlText (
847+ fakeControlType : FakeControlTypes . RadioButton ,
848+ controlName : "rbt_SetStartup_Folder"
849+ ) ;
850+
816851 if ( fbd_StartupFolder . ShowDialog ( ) == DialogResult . OK )
817852 {
818853 tbx_Startup_Folder . Text = fbd_StartupFolder . SelectedPath ;
@@ -954,6 +989,9 @@ private void Any_rbt_CheckedChanged(object sender,
954989 cbx_TryUseGeoNamesLanguage . Enabled = ! rbt . Checked ;
955990 }
956991
992+ break ;
993+ case "gbx_Startup_Folder" :
994+ pbx_Browse_Startup_Folder . Enabled = rbt_SetStartup_Folder . Checked ;
957995 break ;
958996 case "gbx_MapColourMode" :
959997 // also set the other values to False
@@ -1270,7 +1308,7 @@ private void btn_ExportSettings_Click(object sender,
12701308
12711309 Dictionary < string , string > buttonsDictionary = GetButtonsDictionary ( ) ;
12721310
1273-
1311+
12741312 List < string > ItemsToExport = DialogWithOrWithoutCheckBox . DisplayAndReturnList (
12751313 labelText : ReturnControlText (
12761314 controlName : "mbx_FrmSettings_QuestionWhatToExport" ,
@@ -1339,7 +1377,7 @@ private void btn_ImportSettings_Click(object sender,
13391377
13401378 Dictionary < string , string > buttonsDictionary = GetButtonsDictionary ( ) ;
13411379
1342-
1380+
13431381 List < string > ItemsToImport = DialogWithOrWithoutCheckBox . DisplayAndReturnList (
13441382 labelText : ReturnControlText (
13451383 controlName : "mbx_FrmSettings_QuestionWhatToImport" ,
@@ -1519,4 +1557,5 @@ private static Dictionary<string, string> GetCheckboxDictionary()
15191557 }
15201558
15211559 #endregion
1560+
15221561}
0 commit comments