1- using System ;
1+ using Microsoft . Win32 ;
2+ using System ;
23using System . Windows . Forms ;
3- using Microsoft . Win32 ;
44
55namespace _86boxManager
66{
@@ -44,25 +44,29 @@ private void btnCancel_Click(object sender, EventArgs e)
4444 private void btnApply_Click ( object sender , EventArgs e )
4545 {
4646 SaveSettings ( ) ;
47- btnApply . Enabled = false ;
47+ settingsChanged = CheckForChanges ( ) ;
48+ btnApply . Enabled = settingsChanged ;
4849 }
4950
5051 private void btnOK_Click ( object sender , EventArgs e )
5152 {
52- SaveSettings ( ) ;
53+ if ( settingsChanged )
54+ {
55+ SaveSettings ( ) ;
56+ }
5357 Close ( ) ;
5458 }
5559
5660 private void txt_TextChanged ( object sender , EventArgs e )
5761 {
58- if ( string . IsNullOrWhiteSpace ( txtEXEdir . Text ) || string . IsNullOrWhiteSpace ( txtCFGdir . Text ) )
62+ if ( string . IsNullOrWhiteSpace ( txtEXEdir . Text ) || string . IsNullOrWhiteSpace ( txtCFGdir . Text ) || string . IsNullOrWhiteSpace ( txtLaunchTimeout . Text ) )
5963 {
60- btnOK . Enabled = false ;
64+ btnApply . Enabled = false ;
6165 }
6266 else
6367 {
6468 settingsChanged = CheckForChanges ( ) ;
65- btnOK . Enabled = true ;
69+ btnApply . Enabled = settingsChanged ;
6670 }
6771 }
6872
@@ -87,6 +91,7 @@ private void SaveSettings()
8791 regkey . SetValue ( "ShowConsole" , cbxShowConsole . Checked , RegistryValueKind . DWord ) ;
8892 regkey . SetValue ( "MinimizeToTray" , cbxMinimizeTray . Checked , RegistryValueKind . DWord ) ;
8993 regkey . SetValue ( "CloseToTray" , cbxCloseTray . Checked , RegistryValueKind . DWord ) ;
94+ regkey . SetValue ( "LaunchTimeout" , int . Parse ( txtLaunchTimeout . Text ) , RegistryValueKind . DWord ) ;
9095 regkey . Close ( ) ;
9196
9297 settingsChanged = CheckForChanges ( ) ;
@@ -121,6 +126,7 @@ private void LoadSettings()
121126 cbxShowConsole . Checked = true ;
122127 cbxMinimizeTray . Checked = false ;
123128 cbxCloseTray . Checked = false ;
129+ txtLaunchTimeout . Text = "5000" ;
124130
125131 SaveSettings ( ) ; //This will write the default values to the registry
126132 }
@@ -132,18 +138,20 @@ private void LoadSettings()
132138 cbxShowConsole . Checked = Convert . ToBoolean ( regkey . GetValue ( "ShowConsole" ) ) ;
133139 cbxMinimizeTray . Checked = Convert . ToBoolean ( regkey . GetValue ( "MinimizeToTray" ) ) ;
134140 cbxCloseTray . Checked = Convert . ToBoolean ( regkey . GetValue ( "CloseToTray" ) ) ;
141+ txtLaunchTimeout . Text = Convert . ToString ( regkey . GetValue ( "LaunchTimeout" ) ) ;
135142 }
136143
137144 regkey . Close ( ) ;
138145 }
139146 catch ( Exception ex )
140147 {
141- txtCFGdir . Text = Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) + @"\86Box Virtual Machines " ;
148+ txtCFGdir . Text = Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) + @"\86Box VMs " ;
142149 txtEXEdir . Text = Environment . GetFolderPath ( Environment . SpecialFolder . ProgramFilesX86 ) + @"\86Box" ;
143150 cbxMinimize . Checked = false ;
144151 cbxShowConsole . Checked = true ;
145152 cbxMinimizeTray . Checked = false ;
146153 cbxCloseTray . Checked = false ;
154+ txtLaunchTimeout . Text = "5000" ;
147155 }
148156 }
149157
@@ -216,6 +224,7 @@ private void ResetSettings()
216224 cbxShowConsole . Checked = true ;
217225 cbxMinimizeTray . Checked = false ;
218226 cbxCloseTray . Checked = false ;
227+ txtLaunchTimeout . Text = "5000" ;
219228
220229 SaveSettings ( ) ;
221230 regkey . Close ( ) ;
@@ -243,7 +252,8 @@ private bool CheckForChanges()
243252 cbxMinimize . Checked != Convert . ToBoolean ( regkey . GetValue ( "MinimizeOnVMStart" ) ) ||
244253 cbxShowConsole . Checked != Convert . ToBoolean ( regkey . GetValue ( "ShowConsole" ) ) ||
245254 cbxMinimizeTray . Checked != Convert . ToBoolean ( regkey . GetValue ( "MinimizeToTray" ) ) ||
246- cbxCloseTray . Checked != Convert . ToBoolean ( regkey . GetValue ( "CloseToTray" ) ) ) ;
255+ cbxCloseTray . Checked != Convert . ToBoolean ( regkey . GetValue ( "CloseToTray" ) ) ||
256+ txtLaunchTimeout . Text != Convert . ToString ( regkey . GetValue ( "LaunchTimeout" ) ) ) ;
247257
248258 return btnApply . Enabled ;
249259 }
0 commit comments