@@ -243,14 +243,12 @@ private void CheckStatus()
243243 }
244244 catch ( IOException ex )
245245 {
246- MessageBox . Show ( $ "An I/O error occurred while parsing { ConfigureNode . AdcCalibrationFile } . Check the error log below." +
247- $ "\n \n " + ex . Message ) ;
246+ MessageBox . Show ( ex . Message , "I/O error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
248247 return ;
249248 }
250249 catch ( UnauthorizedAccessException ex )
251250 {
252- MessageBox . Show ( $ "An unauthorized access error occurred while parsing { ConfigureNode . AdcCalibrationFile } . Check the error log below." +
253- $ "\n \n " + ex . Message ) ;
251+ MessageBox . Show ( ex . Message , "Unauthorized access error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
254252 return ;
255253 }
256254
@@ -275,14 +273,12 @@ private void CheckStatus()
275273 }
276274 catch ( IOException ex )
277275 {
278- MessageBox . Show ( $ "An I/O error occurred while parsing { ConfigureNode . GainCalibrationFile } . Check the error log below." +
279- $ "\n \n " + ex . Message ) ;
276+ MessageBox . Show ( ex . Message , "I/O error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
280277 return ;
281278 }
282279 catch ( UnauthorizedAccessException ex )
283280 {
284- MessageBox . Show ( $ "An unauthorized access error occurred while parsing { ConfigureNode . GainCalibrationFile } . Check the error log below." +
285- $ "\n \n " + ex . Message ) ;
281+ MessageBox . Show ( ex . Message , "Unauthorized access error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
286282 return ;
287283 }
288284
@@ -330,7 +326,11 @@ private void ChooseGainCalibrationFile_Click(object sender, EventArgs e)
330326 {
331327 CheckFileExists = true ,
332328 Filter = "Gain calibration files (*_gainCalValues.csv)|*_gainCalValues.csv|All Files|*.*" ,
333- FilterIndex = 0
329+ FilterIndex = 0 ,
330+ InitialDirectory = File . Exists ( textBoxGainCalibrationFile . Text ) ?
331+ Path . GetDirectoryName ( textBoxGainCalibrationFile . Text ) :
332+ ""
333+
334334 } ;
335335
336336 if ( ofd . ShowDialog ( ) == DialogResult . OK )
@@ -347,7 +347,10 @@ private void ChooseAdcCalibrationFile_Click(object sender, EventArgs e)
347347 {
348348 CheckFileExists = true ,
349349 Filter = "ADC calibration files (*_ADCCalibration.csv)|*_ADCCalibration.csv|All Files|*.*" ,
350- FilterIndex = 0
350+ FilterIndex = 0 ,
351+ InitialDirectory = File . Exists ( textBoxAdcCalibrationFile . Text ) ?
352+ Path . GetDirectoryName ( textBoxAdcCalibrationFile . Text ) :
353+ ""
351354 } ;
352355
353356 if ( ofd . ShowDialog ( ) == DialogResult . OK )
0 commit comments