@@ -213,43 +213,56 @@ private void UploadQueuedSnapshots()
213
213
while ( _QueuedSnapshots . Count > 0 )
214
214
{
215
215
var snap = _QueuedSnapshots . First ( ) ;
216
- _QueuedSnapshots . Remove ( snap . Key ) ;
216
+ var ImageFileName = snap . Key ;
217
217
218
- ViewModelLocator . Logger . Info ( $ "Uploading snapshot { snap . Key } ") ;
219
- ViewModelLocator . DataService . UploadSnapshot ( _DownloadId . Value , snap . Value . ToUniversalTime ( ) , snap . Key ) . ContinueWith ( t =>
218
+ _QueuedSnapshots . Remove ( ImageFileName ) ;
219
+
220
+ if ( System . IO . File . Exists ( ImageFileName ) )
220
221
{
221
- if ( t . IsCompleted && ! t . IsFaulted )
222
+ ViewModelLocator . Logger . Info ( $ "Uploading snapshot { ImageFileName } ") ;
223
+ ViewModelLocator . DataService . UploadSnapshot ( _DownloadId . Value , snap . Value . ToUniversalTime ( ) , ImageFileName ) . ContinueWith ( t =>
222
224
{
223
- if ( t . Result )
225
+ if ( t . IsCompleted && ! t . IsFaulted )
224
226
{
225
- try
227
+ if ( t . Result )
226
228
{
227
- ViewModelLocator . Logger . Info ( "Upload success. Deleting local snapshot file." ) ;
229
+ try
230
+ {
231
+ ViewModelLocator . Logger . Info ( "Upload success. Deleting local snapshot file." ) ;
228
232
229
- //and remove the image file from the disk
230
- File . Delete ( snap . Key ) ;
233
+ //and remove the image file from the disk
234
+ File . Delete ( ImageFileName ) ;
231
235
232
- WriteToCache ( ) ;
233
- }
234
- catch ( Exception ee )
235
- {
236
- ViewModelLocator . Logger . Warn ( ee , "Could not delete snapshot from local cache." ) ;
236
+ WriteToCache ( ) ;
237
+ }
238
+ catch ( Exception ee )
239
+ {
240
+ ViewModelLocator . Logger . Warn ( ee , "Could not delete snapshot from local cache." ) ;
241
+ }
237
242
}
238
243
}
239
- }
240
- else
241
- {
242
- if ( t . Exception == null )
243
- ViewModelLocator . Logger . Error ( $ "Snapshot upload failed. Download Id: { _DownloadId } , Image File: { snap . Key } ") ;
244
244
else
245
- ViewModelLocator . Logger . Error ( t . Exception , $ "Snapshot upload failed. Download Id: { _DownloadId } , Image File: { snap . Key } ") ;
245
+ {
246
+ if ( t . Exception == null )
247
+ ViewModelLocator . Logger . Error ( $ "Snapshot upload failed. Download Id: { _DownloadId } , Image File: { ImageFileName } ") ;
248
+ else
249
+ {
250
+ ViewModelLocator . Logger . Error ( t . Exception , $ "Snapshot upload failed. Download Id: { _DownloadId } , Image File: { ImageFileName } ") ;
251
+ }
246
252
247
- //if a snapshot fails, add it back to the queue.
248
- FailedToUploadSnapshots . Add ( snap . Key , snap . Value ) ;
253
+ //if a snapshot fails, add it back to the queue.
254
+ FailedToUploadSnapshots . Add ( ImageFileName , snap . Value ) ;
249
255
250
- WriteToCache ( ) ;
251
- }
252
- } ) . Wait ( ) ;
256
+ WriteToCache ( ) ;
257
+ }
258
+ } ) . Wait ( ) ;
259
+ }
260
+ else
261
+ {
262
+ //Image file no longer exists on the disk. We'll ignore it and proceed to update our local cache. This will remove the image file entry from cache.
263
+ ViewModelLocator . Logger . Error ( $ "Snapshot file does not exist on disk. Download Id: { _DownloadId } , Image File: { ImageFileName } ") ;
264
+ WriteToCache ( ) ;
265
+ }
253
266
}
254
267
}
255
268
@@ -265,8 +278,6 @@ private void UploadQueuedSnapshots()
265
278
266
279
foreach ( var failed in FailedToUploadSnapshots )
267
280
_QueuedSnapshots . Add ( failed . Key , failed . Value ) ;
268
-
269
- ViewModelLocator . DialogService . ShowMessage ( "Some snapshots could not be uploaded. HFQApp will try to upload them again shortly. See your HFQ log file for details." , true ) ;
270
281
}
271
282
}
272
283
}
@@ -473,7 +484,7 @@ public RelayCommand OpenExamCommand
473
484
474
485
ViewModelLocator . Auth . IsCommunicating = true ;
475
486
476
- ViewModelLocator . Logger . Error ( $ "Downloading Exam for Access ID: '{ _SelectedAccess . access_id } ") ;
487
+ ViewModelLocator . Logger . Info ( $ "Downloading Exam for Access ID: '{ _SelectedAccess . access_id } ") ;
477
488
478
489
MasterFile MF = null ;
479
490
@@ -573,7 +584,7 @@ public RelayCommand OpenLogFileCommand
573
584
{
574
585
Process . Start ( new ProcessStartInfo ( )
575
586
{
576
- FileName = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) , @"HFQApp\activity.log " ) ,
587
+ FileName = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) , @"HFQApp\" ) ,
577
588
UseShellExecute = true
578
589
} ) ;
579
590
} ,
0 commit comments