File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/Files.App/ViewModels/Properties/Items Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ public CombinedFileProperties(
1717
1818 public async Task GetSystemFilePropertiesAsync ( )
1919 {
20- var queries = await Task . WhenAll ( List . AsParallel ( ) . Select ( async item => {
20+ var queries = await Task . WhenAll ( List . AsParallel ( ) . Select ( async item =>
21+ {
2122 BaseStorageFile file = await FilesystemTasks . Wrap ( ( ) => StorageFileExtensions . DangerousGetFileFromPathAsync ( item . ItemPath ) ) ;
2223 if ( file is null )
2324 {
@@ -27,10 +28,13 @@ public async Task GetSystemFilePropertiesAsync()
2728
2829 var list = await FileProperty . RetrieveAndInitializePropertiesAsync ( file ) ;
2930
30- list . Find ( x => x . ID == "address" ) . Value =
31- await LocationHelpers . GetAddressFromCoordinatesAsync ( ( double ? ) list . Find (
32- x => x . Property == "System.GPS.LatitudeDecimal" ) . Value ,
33- ( double ? ) list . Find ( x => x . Property == "System.GPS.LongitudeDecimal" ) . Value ) ;
31+ var latitude = list . Find ( x => x . Property == "System.GPS.LatitudeDecimal" ) ? . Value as double ? ;
32+ var longitude = list . Find ( x => x . Property == "System.GPS.LongitudeDecimal" ) ? . Value as double ? ;
33+ var addressItem = list . Find ( x => x . ID == "address" ) ;
34+
35+ if ( latitude . HasValue && longitude . HasValue && addressItem != null )
36+ addressItem . Value = await LocationHelpers . GetAddressFromCoordinatesAsync ( latitude . Value , longitude . Value ) ;
37+
3438
3539 return list
3640 . Where ( fileProp => ! ( fileProp . Value is null && fileProp . IsReadOnly ) )
You can’t perform that action at this time.
0 commit comments