@@ -348,7 +348,6 @@ private void ExportLogs(LogType logType)
348348 } ;
349349
350350 if ( sfd . ShowDialog ( ) != true ) return ;
351- _logController . AddLog ( new ApplicationLog ( "Exporting RAM logs" ) ) ;
352351 ExportTypes . ExportType type ;
353352 switch ( sfd . FilterIndex )
354353 {
@@ -371,7 +370,6 @@ private void ExportLogs(LogType logType)
371370 _logController . Export ( sfd . FileName , logType , type ) ;
372371
373372 MessageBox . Show ( "All logs have been exported!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
374- _logController . AddLog ( new ApplicationLog ( "Done exporting RAM logs" ) ) ;
375373 }
376374 catch ( Exception ex )
377375 {
@@ -560,7 +558,38 @@ private void RamAnalyzerMenuItem_OnClick(object sender, RoutedEventArgs e)
560558 /// <param name="e">The RoutedEventArgs</param>
561559 private void ExportRamAnalyzerDataMenuItem_OnClick ( object sender , RoutedEventArgs e )
562560 {
563- throw new NotImplementedException ( ) ;
561+ SaveFileDialog sfd = new SaveFileDialog
562+ {
563+ Filter =
564+ "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
565+ } ;
566+ if ( sfd . ShowDialog ( ) != true ) return ;
567+ try
568+ {
569+ // ReSharper disable once SwitchStatementMissingSomeCases
570+ switch ( sfd . FilterIndex )
571+ {
572+ //Filterindex starts at 1
573+ case 1 :
574+ RamDataExporter . ExportText ( sfd . FileName , RamAnalyzer . GetRamSticks ( ) ) ;
575+ break ;
576+ case 2 :
577+ RamDataExporter . ExportHtml ( sfd . FileName , RamAnalyzer . GetRamSticks ( ) ) ;
578+ break ;
579+ case 3 :
580+ RamDataExporter . ExportCsv ( sfd . FileName , RamAnalyzer . GetRamSticks ( ) ) ;
581+ break ;
582+ case 4 :
583+ RamDataExporter . ExportExcel ( sfd . FileName , RamAnalyzer . GetRamSticks ( ) ) ;
584+ break ;
585+ }
586+ MessageBox . Show ( "Exported all data!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
587+ }
588+ catch ( Exception ex )
589+ {
590+ _logController . AddLog ( new ApplicationLog ( ex . Message ) ) ;
591+ MessageBox . Show ( ex . Message , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
592+ }
564593 }
565594 }
566595}
0 commit comments