@@ -576,25 +576,41 @@ public async Task<IStorageHistory> DeleteAsync(IStorageItemWithPath source,
576
576
577
577
if ( fsResult == FileSystemStatusCode . Unauthorized )
578
578
{
579
- // Try again with fulltrust process
580
- var elevateConfirmDialog = new Files . Dialogs . ElevateConfirmDialog ( ) ;
581
- var elevateConfirmResult = await elevateConfirmDialog . ShowAsync ( ) ;
582
- if ( elevateConfirmResult == ContentDialogResult . Primary )
579
+ // Try again with fulltrust process (non admin: for shortcuts and hidden files)
580
+ if ( associatedInstance . ServiceConnection != null )
583
581
{
584
- //await associatedInstance.ServiceConnection?.Elevate();
585
- App . InteractionViewModel . IsFullTrustElevated = true ;
586
-
587
- if ( associatedInstance . ServiceConnection != null )
582
+ var ( status , response ) = await associatedInstance . ServiceConnection . SendMessageForResponseAsync ( new ValueSet ( )
583
+ {
584
+ { "Arguments" , "FileOperation" } ,
585
+ { "fileop" , "DeleteItem" } ,
586
+ { "filepath" , source . Path } ,
587
+ { "permanently" , permanently }
588
+ } ) ;
589
+ fsResult = ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
590
+ && response . Get ( "Success" , false ) ) ;
591
+ }
592
+ if ( ! fsResult )
593
+ {
594
+ var elevateConfirmDialog = new Files . Dialogs . ElevateConfirmDialog ( ) ;
595
+ var elevateConfirmResult = await elevateConfirmDialog . ShowAsync ( ) ;
596
+ if ( elevateConfirmResult == ContentDialogResult . Primary )
588
597
{
589
- var ( status , response ) = await associatedInstance . ServiceConnection . SendMessageForResponseAsync ( new ValueSet ( )
598
+ if ( await associatedInstance . ServiceConnection ? . Elevate ( ) ) // TODO: enable this
590
599
{
591
- { "Arguments" , "FileOperation" } ,
592
- { "fileop" , "DeleteItem" } ,
593
- { "filepath" , source . Path } ,
594
- { "permanently" , permanently }
595
- } ) ;
596
- fsResult = ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
597
- && response . Get ( "Success" , false ) ) ;
600
+ // Try again with fulltrust process (admin)
601
+ if ( associatedInstance . ServiceConnection != null )
602
+ {
603
+ var ( status , response ) = await associatedInstance . ServiceConnection . SendMessageForResponseAsync ( new ValueSet ( )
604
+ {
605
+ { "Arguments" , "FileOperation" } ,
606
+ { "fileop" , "DeleteItem" } ,
607
+ { "filepath" , source . Path } ,
608
+ { "permanently" , permanently }
609
+ } ) ;
610
+ fsResult = ( FilesystemResult ) ( status == AppServiceResponseStatus . Success
611
+ && response . Get ( "Success" , false ) ) ;
612
+ }
613
+ }
598
614
}
599
615
}
600
616
}
0 commit comments