3
3
4
4
using Files . App . Utils . Shell ;
5
5
using Files . App . UserControls . Widgets ;
6
+ using Files . App . Helpers ;
6
7
7
8
namespace Files . App . Services
8
9
{
@@ -38,7 +39,7 @@ private async Task PinToSidebarAsync(string[] folderPaths, bool doUpdateQuickAcc
38
39
App . QuickAccessManager . UpdateQuickAccessWidget ? . Invoke ( this , new ModifyQuickAccessEventArgs ( folderPaths , true ) ) ;
39
40
}
40
41
41
- public Task UnpinFromSidebarAsync ( string folderPath ) => UnpinFromSidebarAsync ( new [ ] { folderPath } ) ;
42
+ public Task UnpinFromSidebarAsync ( string folderPath ) => UnpinFromSidebarAsync ( new [ ] { folderPath } ) ;
42
43
43
44
public Task UnpinFromSidebarAsync ( string [ ] folderPaths ) => UnpinFromSidebarAsync ( folderPaths , true ) ;
44
45
@@ -55,27 +56,30 @@ private async Task UnpinFromSidebarAsync(string[] folderPaths, bool doUpdateQuic
55
56
56
57
foreach ( dynamic ? fi in f2 . Items ( ) )
57
58
{
58
- if ( ShellStorageFolder . IsShellPath ( ( string ) fi . Path ) )
59
+ string pathStr = ( string ) fi . Path ;
60
+
61
+ if ( ShellStorageFolder . IsShellPath ( pathStr ) )
59
62
{
60
- var folder = await ShellStorageFolder . FromPathAsync ( ( string ) fi . Path ) ;
63
+ var folder = await ShellStorageFolder . FromPathAsync ( pathStr ) ;
61
64
var path = folder ? . Path ;
62
65
63
- if ( path is not null &&
64
- ( folderPaths . Contains ( path ) || ( path . StartsWith ( @"\\SHELL\" ) && folderPaths . Any ( x => x . StartsWith ( @"\\SHELL\" ) ) ) ) ) // Fix for the Linux header
66
+ if ( path is not null &&
67
+ ( folderPaths . Contains ( path ) ||
68
+ ( path . StartsWith ( @"\\SHELL\\" ) && folderPaths . Any ( x => x . StartsWith ( @"\\SHELL\\" ) ) ) ) )
65
69
{
66
- await SafetyExtensions . IgnoreExceptions ( async ( ) =>
70
+ await Win32Helper . StartSTATask ( async ( ) =>
67
71
{
68
- await fi . InvokeVerb ( "unpinfromhome" ) ;
72
+ fi . InvokeVerb ( "unpinfromhome" ) ;
69
73
} ) ;
70
74
continue ;
71
75
}
72
76
}
73
77
74
- if ( folderPaths . Contains ( ( string ) fi . Path ) )
78
+ if ( folderPaths . Contains ( pathStr ) )
75
79
{
76
- await SafetyExtensions . IgnoreExceptions ( async ( ) =>
80
+ await Win32Helper . StartSTATask ( async ( ) =>
77
81
{
78
- await fi . InvokeVerb ( "unpinfromhome" ) ;
82
+ fi . InvokeVerb ( "unpinfromhome" ) ;
79
83
} ) ;
80
84
}
81
85
}
0 commit comments