@@ -104,16 +104,16 @@ internal static List<RamStick> GetRamSticks()
104104 /// Export all RamStick objects
105105 /// </summary>
106106 /// <param name="logController">The LogController object that can be used to add logs</param>
107- internal static void ExportRamSticks ( LogController logController )
107+ internal static bool ExportRamSticks ( LogController logController )
108108 {
109109 List < RamStick > ramSticks = GetRamSticks ( ) ;
110- if ( ramSticks == null || ramSticks . Count == 0 ) return ;
110+ if ( ramSticks == null || ramSticks . Count == 0 ) return false ;
111111
112112 SaveFileDialog sfd = new SaveFileDialog
113113 {
114114 Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
115115 } ;
116- if ( sfd . ShowDialog ( ) != true ) return ;
116+ if ( sfd . ShowDialog ( ) != true ) return false ;
117117 try
118118 {
119119 // ReSharper disable once SwitchStatementMissingSomeCases
@@ -133,33 +133,36 @@ internal static void ExportRamSticks(LogController logController)
133133 RamDataExporter . ExportExcel ( sfd . FileName , ramSticks ) ;
134134 break ;
135135 }
136- MessageBox . Show ( "Exported all data!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
136+
137+ return true ;
137138 }
138139 catch ( Exception ex )
139140 {
140141 logController . AddLog ( new ApplicationLog ( ex . Message ) ) ;
141142 MessageBox . Show ( ex . Message , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
142143 }
144+
145+ return false ;
143146 }
144147
145148 /// <summary>
146149 /// Export logs to the disk
147150 /// </summary>
148151 /// <param name="logType">The LogType that should be exported (can be null to export all logs)</param>
149152 /// <param name="logController">The LogController object that can be used to export logs</param>
150- internal static void ExportLogs ( LogType ? logType , LogController logController )
153+ internal static bool ExportLogs ( LogType ? logType , LogController logController )
151154 {
152155 if ( logType != null )
153156 {
154- if ( logController . GetLogs ( logType ) . Count == 0 ) return ;
157+ if ( logController . GetLogs ( logType ) . Count == 0 ) return false ;
155158 }
156159
157160 SaveFileDialog sfd = new SaveFileDialog
158161 {
159162 Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
160163 } ;
161164
162- if ( sfd . ShowDialog ( ) != true ) return ;
165+ if ( sfd . ShowDialog ( ) != true ) return false ;
163166 ExportTypes . ExportType type ;
164167 switch ( sfd . FilterIndex )
165168 {
@@ -180,26 +183,27 @@ internal static void ExportLogs(LogType? logType, LogController logController)
180183 try
181184 {
182185 logController . Export ( sfd . FileName , logType , type ) ;
183- MessageBox . Show ( "All logs have been exported!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
186+ return true ;
184187 }
185188 catch ( Exception ex )
186189 {
187190 logController . AddLog ( new ApplicationLog ( ex . Message ) ) ;
188191 MessageBox . Show ( ex . Message , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
189192 }
193+ return false ;
190194 }
191195
192196 /// <summary>
193197 /// Export all ProcessDetail objects
194198 /// </summary>
195199 /// <param name="logController">The LogController object that can be used to add logs</param>
196- internal static async void ExportProcessDetails ( LogController logController )
200+ internal static async Task < bool > ExportProcessDetails ( LogController logController )
197201 {
198202 SaveFileDialog sfd = new SaveFileDialog
199203 {
200204 Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
201205 } ;
202- if ( sfd . ShowDialog ( ) != true ) return ;
206+ if ( sfd . ShowDialog ( ) != true ) return false ;
203207 try
204208 {
205209 // ReSharper disable once SwitchStatementMissingSomeCases
@@ -219,13 +223,16 @@ internal static async void ExportProcessDetails(LogController logController)
219223 ProcessDetailExporter . ExportExcel ( sfd . FileName , await GetProcessDetails ( logController ) ) ;
220224 break ;
221225 }
222- MessageBox . Show ( "All data has been exported!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
226+
227+ return true ;
223228 }
224229 catch ( Exception ex )
225230 {
226231 logController . AddLog ( new ApplicationLog ( ex . Message ) ) ;
227232 MessageBox . Show ( ex . Message , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
228233 }
234+
235+ return false ;
229236 }
230237
231238 /// <summary>
0 commit comments