@@ -139,6 +139,10 @@ public OptionsForm(UserSettings settings, UpdateManager updateManager, string ba
139139 comboPressureUnit . Text = Settings . PressureUnit ;
140140 comboOtherUnits . Text = settings . Units ;
141141 checkEnableTCSScripts . Checked = ! Settings . DisableTCSScripts ; // Inverted as "Enable scripts" is better UI than "Disable scripts"
142+ checkAutoSaveActive . Checked = Settings . AutoSaveActive ;
143+ ButtonAutoSave15 . Checked = checkAutoSaveActive . Checked & Settings . AutoSaveInterval == 15 ;
144+ ButtonAutoSave30 . Checked = checkAutoSaveActive . Checked & Settings . AutoSaveInterval == 30 ;
145+ ButtonAutoSave60 . Checked = checkAutoSaveActive . Checked & Settings . AutoSaveInterval == 60 ;
142146
143147 // Audio tab
144148 numericSoundVolumePercent . Value = Settings . SoundVolumePercent ;
@@ -415,6 +419,8 @@ void buttonOK_Click(object sender, EventArgs e)
415419 Settings . PressureUnit = comboPressureUnit . SelectedValue . ToString ( ) ;
416420 Settings . Units = comboOtherUnits . SelectedValue . ToString ( ) ;
417421 Settings . DisableTCSScripts = ! checkEnableTCSScripts . Checked ; // Inverted as "Enable scripts" is better UI than "Disable scripts"
422+ Settings . AutoSaveActive = checkAutoSaveActive . Checked ;
423+ Settings . AutoSaveInterval = ButtonAutoSave15 . Checked ? 15 : ButtonAutoSave30 . Checked ? 30 : 60 ;
418424
419425 // Audio tab
420426 Settings . SoundVolumePercent = ( int ) numericSoundVolumePercent . Value ;
@@ -664,6 +670,50 @@ private void checkPerformanceTuner_Click(object sender, EventArgs e)
664670 labelPerformanceTunerTarget . Enabled = checkPerformanceTuner . Checked ;
665671 }
666672
673+ private void checkAutoSave_checkchanged ( object sender , EventArgs e )
674+ {
675+ if ( checkAutoSaveActive . Checked )
676+ {
677+ ButtonAutoSave15 . Enabled = true ;
678+ ButtonAutoSave15 . Checked = Settings . AutoSaveInterval == 15 ;
679+ ButtonAutoSave30 . Enabled = true ;
680+ ButtonAutoSave30 . Checked = Settings . AutoSaveInterval == 30 ;
681+ ButtonAutoSave60 . Enabled = true ;
682+ ButtonAutoSave60 . Checked = Settings . AutoSaveInterval == 60 ;
683+ }
684+ else
685+ {
686+ ButtonAutoSave15 . Checked = false ;
687+ ButtonAutoSave15 . Enabled = false ;
688+ ButtonAutoSave30 . Checked = false ;
689+ ButtonAutoSave30 . Enabled = false ;
690+ ButtonAutoSave60 . Checked = false ;
691+ ButtonAutoSave60 . Enabled = false ;
692+ }
693+ }
694+
695+ private void buttonAutoSaveInterval_checkchanged ( object sender , EventArgs e )
696+ {
697+ if ( ButtonAutoSave15 . Checked )
698+ {
699+ Settings . AutoSaveInterval = 15 ;
700+ ButtonAutoSave30 . Checked = false ;
701+ ButtonAutoSave60 . Checked = false ;
702+ }
703+ else if ( ButtonAutoSave30 . Checked )
704+ {
705+ Settings . AutoSaveInterval = 30 ;
706+ ButtonAutoSave15 . Checked = false ;
707+ ButtonAutoSave60 . Checked = false ;
708+ }
709+ else if ( ButtonAutoSave60 . Checked )
710+ {
711+ Settings . AutoSaveInterval = 60 ;
712+ ButtonAutoSave15 . Checked = false ;
713+ ButtonAutoSave30 . Checked = false ;
714+ }
715+ }
716+
667717 #region Help for Options
668718 // The icons all share the same code which assumes they are named according to a simple scheme as follows:
669719 // 1. To add a new Help Icon, copy an existing one and paste it onto the tab.
@@ -728,6 +778,7 @@ private void InitializeHelpIcons()
728778 ( pbPressureUnit , new Control [ ] { labelPressureUnit , comboPressureUnit } ) ,
729779 ( pbOtherUnits , new Control [ ] { labelOtherUnits , comboOtherUnits } ) ,
730780 ( pbEnableTcsScripts , new [ ] { checkEnableTCSScripts } ) ,
781+ ( pbAutoSave , new [ ] { checkAutoSaveActive } ) ,
731782 ( pbOverspeedMonitor , new [ ] { checkOverspeedMonitor } ) ,
732783
733784 // Audio tab
@@ -782,6 +833,7 @@ private void HelpIcon_Click(object sender, EventArgs _)
782833 {
783834 var urls = new Dictionary < object , string >
784835 {
836+ // General tab
785837 {
786838 pbAlerter ,
787839 BaseDocumentationUrl + "/options.html#alerter-in-cab"
@@ -810,6 +862,10 @@ private void HelpIcon_Click(object sender, EventArgs _)
810862 pbEnableTcsScripts ,
811863 BaseDocumentationUrl + "/options.html#disable-tcs-scripts"
812864 } ,
865+ {
866+ pbAutoSave ,
867+ BaseDocumentationUrl + "/options.html#auto-save"
868+ } ,
813869 {
814870 pbOverspeedMonitor ,
815871 BaseDocumentationUrl + "/options.html#overspeed-monitor"
0 commit comments