4
4
using System . Linq ;
5
5
using System . Reflection ;
6
6
using System . Windows ;
7
+ using DebitExpress . Controls . Dialogs ;
8
+ using DebitExpress . DialogService ;
7
9
using DebitExpress . VatRelief . Models ;
8
10
using DebitExpress . VatRelief . Utils ;
9
11
using MaterialDesignThemes . Wpf ;
@@ -15,6 +17,7 @@ namespace DebitExpress.VatRelief;
15
17
/// </summary>
16
18
public partial class MainWindow
17
19
{
20
+ private readonly IDialog _dialog = new Dialog ( ) ;
18
21
private string _filePath = string . Empty ;
19
22
private readonly SnackbarMessageQueue _messageQueue ;
20
23
private readonly SnackbarMessageQueue _errorQueue ;
@@ -33,8 +36,8 @@ public MainWindow()
33
36
34
37
GenerateButton . Click += OnGenerate ;
35
38
DownloadButton . Click += OnDownload ;
36
- GithubButton . Click += OnGithub ;
37
- Loaded += OnLoaded ;
39
+ GithubButton . Click += OnGithub ;
40
+ Loaded += OnLoaded ;
38
41
}
39
42
40
43
private void OnLoaded ( object sender , RoutedEventArgs e )
@@ -89,6 +92,7 @@ private void OnDragOver(object sender, DragEventArgs e)
89
92
90
93
private async void OnGenerate ( object sender , RoutedEventArgs e )
91
94
{
95
+ var loader = await _dialog . ShowLoadingAsync ( ) ;
92
96
try
93
97
{
94
98
if ( ! File . Exists ( _filePath ) )
@@ -120,7 +124,7 @@ private async void OnGenerate(object sender, RoutedEventArgs e)
120
124
}
121
125
122
126
var reconWriter = new ExcelReconWriter ( ) ;
123
- var writeResult = reconWriter . WriteReconciliationReport ( data , path ) ;
127
+ var writeResult = await reconWriter . WriteReconciliationReportAsync ( data , path ) ;
124
128
125
129
if ( writeResult . IsFaulted )
126
130
{
@@ -135,6 +139,7 @@ private async void OnGenerate(object sender, RoutedEventArgs e)
135
139
finally
136
140
{
137
141
GenerateButton . IsEnabled = true ;
142
+ await _dialog . CloseLoadingAsync ( loader ) ;
138
143
}
139
144
}
140
145
0 commit comments