@@ -283,13 +283,6 @@ private void exportTagsToolStripMenuItem_Click(object sender, EventArgs e)
283283
284284 } ;
285285
286- if ( saveFileDialog1 . ShowDialog ( ) == DialogResult . OK )
287- {
288- Stream myStream = saveFileDialog1 . OpenFile ( ) ;
289- if ( myStream == null ) return ;
290-
291- CnE_Report . CreateReport ( PLC , myStream ) ;
292- myStream . Close ( ) ;
293286 if ( saveFileDialog1 . ShowDialog ( ) == DialogResult . OK )
294287 {
295288 try
@@ -300,13 +293,6 @@ private void exportTagsToolStripMenuItem_Click(object sender, EventArgs e)
300293 CnE_Report . CreateReport ( PLC , myStream ) ;
301294 myStream . Close ( ) ;
302295
303- Process . Start ( new ProcessStartInfo
304- {
305- FileName = saveFileDialog1 . FileName ,
306- UseShellExecute = true
307- } ) ;
308- }
309- }
310296 Process . Start ( new ProcessStartInfo
311297 {
312298 FileName = saveFileDialog1 . FileName ,
@@ -337,17 +323,25 @@ private void aiReportToolStripMenuItem_Click(object sender, EventArgs e)
337323
338324 if ( saveFileDialog1 . ShowDialog ( ) == DialogResult . OK )
339325 {
340- Stream myStream = saveFileDialog1 . OpenFile ( ) ;
341- if ( myStream == null ) return ;
326+ try
327+ {
328+ Stream myStream = saveFileDialog1 . OpenFile ( ) ;
329+ if ( myStream == null ) return ;
342330
343- IO_Report . CreateReport ( PLC , myStream ) ;
344- myStream . Close ( ) ;
331+ IO_Report . CreateReport ( PLC , myStream ) ;
332+ myStream . Close ( ) ;
345333
346- Process . Start ( new ProcessStartInfo
334+ Process . Start ( new ProcessStartInfo
335+ {
336+ FileName = saveFileDialog1 . FileName ,
337+ UseShellExecute = true
338+ } ) ;
339+ }
340+ catch ( Exception ex )
347341 {
348- FileName = saveFileDialog1 . FileName ,
349- UseShellExecute = true
350- } ) ;
342+ LogHelper . DebugPrint ( $ "Error creating IO Report: { ex . Message } " ) ;
343+ MessageBox . Show ( $ "Error creating IO Report: { ex . Message } " , "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
344+ }
351345 }
352346 }
353347
0 commit comments