6
6
using System . Windows ;
7
7
using System . Windows . Input ;
8
8
using System . Windows . Threading ;
9
+ using log4net ;
9
10
using MahApps . Metro . Controls . Dialogs ;
10
11
using NETworkManager . Localization . Resources ;
11
12
using NETworkManager . Models . Export ;
@@ -19,6 +20,7 @@ namespace NETworkManager.ViewModels;
19
20
public class DiscoveryProtocolViewModel : ViewModelBase
20
21
{
21
22
#region Variables
23
+ private static readonly ILog Log = LogManager . GetLogger ( typeof ( DiscoveryProtocolViewModel ) ) ;
22
24
23
25
private readonly IDialogCoordinator _dialogCoordinator ;
24
26
@@ -281,6 +283,8 @@ private async Task CaptureAction()
281
283
}
282
284
catch ( Exception ex )
283
285
{
286
+ Log . Error ( "Error while trying to capture" , ex ) ;
287
+
284
288
await _dialogCoordinator . ShowMessageAsync ( this , Strings . Error , ex . Message ,
285
289
MessageDialogStyle . Affirmative , AppearanceManager . MetroDialog ) ;
286
290
}
@@ -306,6 +310,8 @@ private async Task ExportAction()
306
310
}
307
311
catch ( Exception ex )
308
312
{
313
+ Log . Error ( "Error while exporting data as " + instance . FileType , ex ) ;
314
+
309
315
var settings = AppearanceManager . MetroDialog ;
310
316
settings . AffirmativeButtonText = Strings . OK ;
311
317
@@ -316,7 +322,8 @@ await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,
316
322
317
323
SettingsManager . Current . DiscoveryProtocol_ExportFileType = instance . FileType ;
318
324
SettingsManager . Current . DiscoveryProtocol_ExportFilePath = instance . FilePath ;
319
- } , _ => { _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ; } , [
325
+ } , _ => { _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ; } ,
326
+ [
320
327
ExportFileType . Csv , ExportFileType . Xml , ExportFileType . Json
321
328
] , false , SettingsManager . Current . DiscoveryProtocol_ExportFileType ,
322
329
SettingsManager . Current . DiscoveryProtocol_ExportFilePath ) ;
0 commit comments