@@ -99,11 +99,9 @@ private void GetInitialValues(out int viewportW, out int viewportH, out int ppi,
99
99
100
100
#region Events
101
101
102
- private async void Dialog_OkClick ( object sender , EventArgs e )
102
+ private void Dialog_OkClick ( object sender , EventArgs e )
103
103
{
104
- pdnDocument = await Task . Run ( DoImport , cts . Token )
105
- . ContinueWith ( AfterImport )
106
- . ConfigureAwait ( false ) ;
104
+ Task . Run ( DoImport , cts . Token ) . ContinueWith ( AfterImport ) ;
107
105
}
108
106
109
107
private void Dialog_FormClosing ( object sender , FormClosingEventArgs e )
@@ -137,7 +135,7 @@ private DialogResult ShowMemoryWarningDialog(int layerCount)
137
135
return dialogResult ;
138
136
}
139
137
140
- private Document DoImport ( )
138
+ private void DoImport ( )
141
139
{
142
140
// set the requested size & resolution for SvgDocument
143
141
width = dialog . CanvasW ;
@@ -160,7 +158,8 @@ private Document DoImport()
160
158
{
161
159
using ( Bitmap bmp = RenderSvgDocument ( ) )
162
160
{
163
- return Document . FromImage ( bmp ) ;
161
+ pdnDocument = Document . FromImage ( bmp ) ;
162
+ return ;
164
163
}
165
164
}
166
165
@@ -184,7 +183,7 @@ private Document DoImport()
184
183
if ( ShowMemoryWarningDialog ( allElements . Count ) != DialogResult . Yes )
185
184
{
186
185
dialog . DialogResult = DialogResult . Cancel ;
187
- return null ;
186
+ return ;
188
187
}
189
188
}
190
189
@@ -248,7 +247,7 @@ private Document DoImport()
248
247
ShowMemoryWarningDialog ( groupsAndElementsWithoutGroup . Count ) != DialogResult . Yes )
249
248
{
250
249
dialog . DialogResult = DialogResult . Cancel ;
251
- return null ;
250
+ return ;
252
251
}
253
252
254
253
// Thread safe
@@ -258,21 +257,19 @@ private Document DoImport()
258
257
pdnDocument = RenderElements ( groupsAndElementsWithoutGroup , setOpacityForLayer , importHiddenLayers ,
259
258
dialog . ReportProgress , ct ) ;
260
259
}
261
-
260
+
262
261
// Fallback. Nothing is added. Render one default layer.
263
262
if ( pdnDocument == null || pdnDocument . Layers . Count == 0 )
264
263
{
265
264
pdnDocument ? . Dispose ( ) ;
266
265
using ( Bitmap bmp = RenderSvgDocument ( ) )
267
266
{
268
- return Document . FromImage ( bmp ) ;
267
+ pdnDocument = Document . FromImage ( bmp ) ;
269
268
}
270
269
}
271
-
272
- return pdnDocument ;
273
270
}
274
271
275
- private Document AfterImport ( Task < Document > p )
272
+ private void AfterImport ( Task p )
276
273
{
277
274
if ( p . Exception != null && ! p . IsCanceled )
278
275
{
@@ -295,15 +292,13 @@ private Document AfterImport(Task<Document> p)
295
292
}
296
293
297
294
dialog . DialogResult = DialogResult . Cancel ;
298
- return null ;
295
+ return ;
299
296
}
300
297
301
298
if ( dialog . DialogResult == DialogResult . None )
302
299
{
303
300
dialog . DialogResult = DialogResult . OK ;
304
301
}
305
-
306
- return p . Result ;
307
302
}
308
303
309
304
#region Render Elements
0 commit comments