From de4595fca45e0c76fb638fcdb7be294742714388 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Tue, 18 Aug 2020 13:25:15 -0700 Subject: [PATCH 01/66] Added details page for Images This commit adds a details page for image files that shows -Rating -Camera -Title -Coordinates -Dimensions --- Files/Files.csproj | 7 + Files/Filesystem/ListedItem.cs | 10 + .../View Models/Properties/FileProperties.cs | 77 ++++++ .../SelectedItemsPropertiesViewModel.cs | 140 +++++++++++ .../LayoutModes/PropertiesDetailsImage.xaml | 230 ++++++++++++++++++ .../PropertiesDetailsImage.xaml.cs | 85 +++++++ Files/Views/Pages/Properties.xaml | 11 + Files/Views/Pages/Properties.xaml.cs | 7 + Files/Views/Pages/PropertiesDetailsImage.xaml | 208 ++++++++++++++++ .../Pages/PropertiesDetailsImage.xaml.cs | 75 ++++++ 10 files changed, 850 insertions(+) create mode 100644 Files/Views/LayoutModes/PropertiesDetailsImage.xaml create mode 100644 Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs create mode 100644 Files/Views/Pages/PropertiesDetailsImage.xaml create mode 100644 Files/Views/Pages/PropertiesDetailsImage.xaml.cs diff --git a/Files/Files.csproj b/Files/Files.csproj index 36c20743ecf7..eca21ea0e94b 100644 --- a/Files/Files.csproj +++ b/Files/Files.csproj @@ -271,6 +271,9 @@ GridViewBrowser.xaml + + PropertiesDetailsImage.xaml + MainPage.xaml @@ -514,6 +517,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/Files/Filesystem/ListedItem.cs b/Files/Filesystem/ListedItem.cs index 78f657e31020..df55d13af364 100644 --- a/Files/Filesystem/ListedItem.cs +++ b/Files/Filesystem/ListedItem.cs @@ -142,6 +142,16 @@ public DateTimeOffset ItemDateAccessedReal private DateTimeOffset _itemDateAccessedReal; + public bool IsImage() + { + if (FileExtension != null) + { + string lower = FileExtension.ToLower(); + return lower.Contains("png") || lower.Contains("jpg") || lower.Contains("png") || lower.Contains("gif") || lower.Contains("jpeg"); + } + return false; + } + public ListedItem(string folderRelativeId) { FolderRelativeId = folderRelativeId; diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 3e43bba1136f..818b2a761e21 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -4,6 +4,8 @@ using Microsoft.Toolkit.Mvvm.Input; using Microsoft.UI.Xaml.Controls; using System; +using System.Collections; +using System.Diagnostics; using System.IO; using System.Threading; using Windows.Foundation.Collections; @@ -151,6 +153,81 @@ public override async void GetSpecialProperties() } } + private async void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + switch (e.PropertyName) + { + case "ShortcutItemPath": + case "ShortcutItemWorkingDir": + case "ShortcutItemArguments": + var tmpItem = (ShortcutItem)Item; + if (string.IsNullOrWhiteSpace(ViewModel.ShortcutItemPath)) + return; + if (App.Connection != null) + { + var value = new ValueSet() + { + { "Arguments", "FileOperation" }, + { "fileop", "UpdateLink" }, + { "filepath", Item.ItemPath }, + { "targetpath", ViewModel.ShortcutItemPath }, + { "arguments", ViewModel.ShortcutItemArguments }, + { "workingdir", ViewModel.ShortcutItemWorkingDir }, + { "runasadmin", tmpItem.RunAsAdmin }, + }; + await App.Connection.SendMessageAsync(value); + } + break; + } + } + + } + + internal class ImageFileProperties : FileProperties + { + private ProgressBar ProgressBar; + + public ImageFileProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, CoreDispatcher coreDispatcher, ProgressBar progressBar, ListedItem item) : base(viewModel, tokenSource, coreDispatcher, progressBar, item) + { + ProgressBar = progressBar; + + GetBaseProperties(); + ViewModel.PropertyChanged += ViewModel_PropertyChanged; + } + + public override async void GetSpecialProperties() + { + base.GetSpecialProperties(); + + StorageFile file = null; + ImageProperties imageProperties; + try + { + file = await ItemViewModel.GetFileFromPathAsync((Item as ShortcutItem)?.TargetPath ?? Item.ItemPath); + imageProperties = await file.Properties.GetImagePropertiesAsync(); + } catch(Exception ex) + { + NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); + // Could not access file, can't show any other property + return; + } + + ViewModel.DateTaken = imageProperties.DateTaken; + ViewModel.CameraModel = imageProperties.CameraModel; + ViewModel.CameraManufacturer = imageProperties.CameraManufacturer; + ViewModel.ImageWidth = (int) imageProperties.Width; + ViewModel.ImageHeight = (int)imageProperties.Height; + ViewModel.ImageTitle = imageProperties.Title; + ViewModel.Longitude = imageProperties.Longitude; + ViewModel.Latitude = imageProperties.Latitude; + ViewModel.ImageKeywords = imageProperties.Keywords; + ViewModel.Rating = (int)imageProperties.Rating; + ViewModel.ImageOrientation = imageProperties.Orientation; + + //ViewModel.People = (System.Collections.Generic.IList) imageProperties.PeopleNames; + + } + private async void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs index 1fed7e60616c..0b26937a1cb5 100644 --- a/Files/View Models/SelectedItemsPropertiesViewModel.cs +++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs @@ -4,7 +4,10 @@ using Microsoft.Toolkit.Mvvm.Input; using Microsoft.Toolkit.Uwp.Helpers; using System; +using System.Collections.Generic; using Windows.ApplicationModel.Core; +using Windows.Storage.FileProperties; +using Windows.UI.Core; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; @@ -612,5 +615,142 @@ public Uri FolderIconSource return ContainsFilesOrFolders ? new Uri("ms-appx:///Assets/FolderIcon2.svg") : new Uri("ms-appx:///Assets/FolderIcon.svg"); } } + + private int _ImageWidth; + public int ImageWidth + { + get => _ImageWidth; + set + { + SetProperty(ref _ImageWidth, value); + OnPropertyChanged("GetImageSizeString"); + } + } + + private int _ImageHeight; + public int ImageHeight + { + get => _ImageHeight; + set + { + SetProperty(ref _ImageHeight, value); + OnPropertyChanged("GetImageSizeString"); + } + } + private DateTimeOffset _DateTaken; + public DateTimeOffset DateTaken + { + get => _DateTaken; + set => SetProperty(ref _DateTaken, value); + } + + private string _ImageTitle; + public string ImageTitle + { + get => _ImageTitle; + set => SetProperty(ref _ImageTitle, value); + } + + public IList People { get; set; } + + private System.Nullable _Longitude; + public System.Nullable Longitude + { + get => _Longitude; + set + { + SetProperty(ref _Longitude, value); + OnPropertyChanged("ShowCoordinates"); + OnPropertyChanged("GetCoordinatesString"); + } + } + + private System.Nullable _Latitude; + public System.Nullable Latitude + { + get => _Latitude; + set { + SetProperty(ref _Latitude, value); + OnPropertyChanged("ShowCoordinates"); + OnPropertyChanged("GetCoordinatesString"); + } + } + + private string _CameraModel; + public string CameraModel + { + get => _CameraModel; + set + { + SetProperty(ref _CameraModel, value); + OnPropertyChanged("GetCameraString"); + } + } + + private string _CameraManufacturer; + public string CameraManufacturer + { + get => _CameraManufacturer; + set + { + SetProperty(ref _CameraManufacturer, value); + OnPropertyChanged("GetCameraString"); + } + } + + private int _Rating; + public int Rating + { + get => _Rating; + set + { + SetProperty(ref _Rating, value); + OnPropertyChanged("GetRatingReal"); + } + } + + public Visibility ShowCoordinates + { + get + { + return (Longitude == null || Latitude == null) ? Visibility.Collapsed : Visibility.Visible; + } + } + + public Visibility ShowRating + { + get + { + return Rating == 0 ? Visibility.Collapsed : Visibility.Visible; + } + } + + public IList ImageKeywords { get; set; } + public PhotoOrientation ImageOrientation { get; set; } + + + public string GetImageSizeString() + { + return ImageWidth + " x " + ImageHeight; + } + + public string GetCameraString() + { + return CameraManufacturer + " " + CameraModel; + } + + public int GetRatingReal() + { + return (_Rating / 20) - 1; + } + + public string GetCoordinatesString() + { + if(Longitude != null && Latitude != null) + return Longitude + ", " + Latitude; + + return ""; + } + } } \ No newline at end of file diff --git a/Files/Views/LayoutModes/PropertiesDetailsImage.xaml b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml new file mode 100644 index 000000000000..8f8df6cb4511 --- /dev/null +++ b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs new file mode 100644 index 000000000000..98320c3effff --- /dev/null +++ b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs @@ -0,0 +1,86 @@ +using Files.Filesystem; +using Files.View_Models; +using Files.View_Models.Properties; +using Microsoft.Toolkit.Uwp.UI.Converters; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.Storage; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// Il modello di elemento Pagina vuota è documentato all'indirizzo https://go.microsoft.com/fwlink/?LinkId=234238 + +namespace Files +{ + /// + /// Pagina vuota che può essere usata autonomamente oppure per l'esplorazione all'interno di un frame. + /// + public sealed partial class PropertiesDetailsImage : Page + { + public BaseProperties BaseProperties { get; set; } + + public SelectedItemsPropertiesViewModel ViewModel { get; set; } + + public PropertiesDetailsImage() + { + this.InitializeComponent(); + } + + private void Properties_Loaded(object sender, RoutedEventArgs e) + { + if (BaseProperties != null) + { + BaseProperties.GetSpecialProperties(); + } + } + + protected override void OnNavigatedTo(NavigationEventArgs e) + { + ViewModel = new SelectedItemsPropertiesViewModel(); + var np = e.Parameter as Properties.PropertyNavParam; + + var listedItem = np.navParameter as ListedItem; + if (listedItem.PrimaryItemAttribute == StorageItemTypes.File) + { + BaseProperties = new ImageFileProperties(ViewModel, np.tokenSource, Dispatcher, null, listedItem); + } + else if (listedItem.PrimaryItemAttribute == StorageItemTypes.Folder) + { + BaseProperties = new FolderProperties(ViewModel, np.tokenSource, Dispatcher, listedItem); + } + + ViewModel.AllDetailsVisibility = ViewModel.BasicDetailsVisibility.Equals(Visibility.Visible)? Visibility.Collapsed : Visibility.Visible; + ShowMore.IsChecked = ViewModel.AllDetailsVisibility.Equals(Visibility.Visible); + + base.OnNavigatedTo(e); + } + + private async void Button_Click(object sender, RoutedEventArgs e) + { + // Center on New York City + //var mapUri = new Uri(String.Format(@"bingmaps:?cp={0:g}~{1:g}", Math.Truncate((decimal) ViewModel.Latitude*10000000)/10000000, Math.Truncate((decimal) ViewModel.Longitude * 10000000)/10000000)); + var mapUri = new Uri(String.Format(@"bingmaps:?where={0}", ViewModel.Geopoint.Address.FormattedAddress)); + + // Launch the Windows Maps app + var launcherOptions = new Windows.System.LauncherOptions(); + launcherOptions.TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe"; + var success = await Windows.System.Launcher.LaunchUriAsync(mapUri, launcherOptions); + } + + private void ShowMore_Click(object sender, RoutedEventArgs e) + { + ViewModel.BasicDetailsVisibility = (bool)ShowMore.IsChecked ? Visibility.Collapsed : Visibility.Visible; + ViewModel.AllDetailsVisibility = (bool)!ShowMore.IsChecked ? Visibility.Collapsed : Visibility.Visible; + } + } +} \ No newline at end of file diff --git a/Files/Views/Pages/Properties.xaml b/Files/Views/Pages/Properties.xaml index 1f4b5aa759e4..2dfa0ba1087c 100644 --- a/Files/Views/Pages/Properties.xaml +++ b/Files/Views/Pages/Properties.xaml @@ -62,13 +62,13 @@ - + diff --git a/Files/Views/Pages/Properties.xaml.cs b/Files/Views/Pages/Properties.xaml.cs index 1b507407fd29..77143450d7ed 100644 --- a/Files/Views/Pages/Properties.xaml.cs +++ b/Files/Views/Pages/Properties.xaml.cs @@ -38,7 +38,8 @@ protected override void OnNavigatedTo(NavigationEventArgs e) { this.navParameter = e.Parameter; this.TabShorcut.Visibility = e.Parameter is ShortcutItem ? Visibility.Visible : Visibility.Collapsed; - this.TabImageDetails.Visibility = (e.Parameter as ListedItem).IsImage() ? Visibility.Visible : Visibility.Collapsed; + //this.TabImageDetails.Visibility = (e.Parameter as ListedItem).IsImage() ? Visibility.Visible : Visibility.Collapsed; + this.TabDetails.Visibility = Visibility.Visible; this.SetBackground(); base.OnNavigatedTo(e); } diff --git a/Files/Views/Pages/PropertiesDetailsImage.xaml b/Files/Views/Pages/PropertiesDetailsImage.xaml deleted file mode 100644 index 6f75f160734a..000000000000 --- a/Files/Views/Pages/PropertiesDetailsImage.xaml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -342,6 +357,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -352,124 +395,133 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs index 98320c3effff..795788218f56 100644 --- a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs +++ b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs @@ -60,7 +60,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) } ViewModel.AllDetailsVisibility = ViewModel.BasicDetailsVisibility.Equals(Visibility.Visible)? Visibility.Collapsed : Visibility.Visible; - ShowMore.IsChecked = ViewModel.AllDetailsVisibility.Equals(Visibility.Visible); + //ShowMore.IsChecked = ViewModel.AllDetailsVisibility.Equals(Visibility.Visible); base.OnNavigatedTo(e); } @@ -75,12 +75,7 @@ private async void Button_Click(object sender, RoutedEventArgs e) var launcherOptions = new Windows.System.LauncherOptions(); launcherOptions.TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe"; var success = await Windows.System.Launcher.LaunchUriAsync(mapUri, launcherOptions); - } - - private void ShowMore_Click(object sender, RoutedEventArgs e) - { - ViewModel.BasicDetailsVisibility = (bool)ShowMore.IsChecked ? Visibility.Collapsed : Visibility.Visible; - ViewModel.AllDetailsVisibility = (bool)!ShowMore.IsChecked ? Visibility.Collapsed : Visibility.Visible; + } } } \ No newline at end of file From 12812687e57f9389d08de06db784b7ba30867737 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 3 Sep 2020 21:00:46 -0700 Subject: [PATCH 04/66] Improved readability --- Files/Files.csproj | 6 +- .../View Models/Properties/FileProperties.cs | 28 +++++++- ...tailsImage.xaml => PropertiesDetails.xaml} | 72 ++++++++++++------- ...mage.xaml.cs => PropertiesDetails.xaml.cs} | 4 +- Files/Views/Pages/Properties.xaml.cs | 2 +- 5 files changed, 80 insertions(+), 32 deletions(-) rename Files/Views/Pages/DetailsPages/{PropertiesDetailsImage.xaml => PropertiesDetails.xaml} (90%) rename Files/Views/Pages/DetailsPages/{PropertiesDetailsImage.xaml.cs => PropertiesDetails.xaml.cs} (96%) diff --git a/Files/Files.csproj b/Files/Files.csproj index 82afa2acf3e5..760dadb8b227 100644 --- a/Files/Files.csproj +++ b/Files/Files.csproj @@ -272,8 +272,8 @@ GridViewBrowser.xaml - - PropertiesDetailsImage.xaml + + PropertiesDetails.xaml MainPage.xaml @@ -518,7 +518,7 @@ Designer MSBuild:Compile - + MSBuild:Compile Designer diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index bfa7ef6146bf..fdfeb206bab5 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -157,6 +157,33 @@ public override async void GetSpecialProperties() } } + public async void GetAddressFromCoordinates() + { + //lol please don't steal this + MapService.ServiceToken = "S7IF7M4Zxe9of0hbatDv~byc7WbHGg1rNYUqk4bL8Zw~Ar_Ap1WxoB_qnXme_hErpFhs74E8qKzCOXugSrankFJgJe9_D4l09O3TNj3WN2f2"; + // The location to reverse geocode. + BasicGeoposition location = new BasicGeoposition(); + location.Latitude = (double)ViewModel.Latitude; + location.Longitude = (double)ViewModel.Longitude; + Geopoint pointToReverseGeocode = new Geopoint(location); + + // Reverse geocode the specified geographic location. + MapLocationFinderResult result = + await MapLocationFinder.FindLocationsAtAsync(pointToReverseGeocode); + + // If the query returns results, display the name of the town + // contained in the address of the first result. + if (result.Status == MapLocationFinderStatus.Success) + { + ViewModel.Geopoint = result.Locations[0]; + ViewModel.GeopointString = string.Format("{0}, {1}", result.Locations[0].Address.Town.ToString(), result.Locations[0].Address.Region.ToString()); + } + else + { + ViewModel.GeopointString = string.Format("{0:g}, {1:g}", Math.Truncate((decimal)ViewModel.Latitude * 10000000) / 10000000, Math.Truncate((decimal)ViewModel.Longitude * 10000000) / 10000000); + } + } + private async void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) @@ -184,7 +211,6 @@ private async void ViewModel_PropertyChanged(object sender, System.ComponentMode break; } } - } internal class ImageFileProperties : FileProperties diff --git a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml b/Files/Views/Pages/DetailsPages/PropertiesDetails.xaml similarity index 90% rename from Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml rename to Files/Views/Pages/DetailsPages/PropertiesDetails.xaml index 94b219e525f9..7e0f6d6c910d 100644 --- a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml +++ b/Files/Views/Pages/DetailsPages/PropertiesDetails.xaml @@ -1,5 +1,5 @@  + Name="Page" + d:DesignHeight="5000"> + + + + + @@ -176,96 +185,21 @@ - - - - - - - - - - - - + + + - - + + + + + + + + + + + - - - - - + + From 97a7b4582110d793a033def49388caa64e1bd4b7 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Fri, 18 Sep 2020 21:40:13 -0700 Subject: [PATCH 09/66] Added "clear personal properties" functionality --- .../View Models/Properties/FileProperties.cs | 38 ++++++++++++++----- Files/Views/Pages/PropertiesDetails.xaml | 7 ++-- Files/Views/Pages/PropertiesDetails.xaml.cs | 4 ++ 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 2dc4513fa73a..26486ab70025 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -1,6 +1,7 @@ using ByteSizeLib; using Files.Filesystem; using Files.Helpers; +using Microsoft.Graphics.Canvas.Text; using Microsoft.Toolkit.Mvvm.Input; using Microsoft.Toolkit.Uwp.UI.Extensions; using Microsoft.UI.Xaml.Controls; @@ -239,19 +240,17 @@ public async void GetSystemFileProperties() try { - ViewModel.SystemFileProperties_Image_RO = await RetrieveProperties(file, PropertiesToGet["Image_RO"]); ViewModel.SystemFileProperties_Photo_RO = await RetrieveProperties(file, PropertiesToGet["Photo_RO"]); ViewModel.SystemFileProperties_Photo_RW = await RetrieveProperties(file, PropertiesToGet["Photo_RW"]); ViewModel.SystemFileProperties_Description_RO = await RetrieveProperties(file, PropertiesToGet["Description_RO"]); ViewModel.SystemFileProperties_GPS_RO = await RetrieveProperties(file, PropertiesToGet["GPS_RO"]); ViewModel.SystemFileProperties_Description_RW = await RetrieveProperties(file, PropertiesToGet["Description_RW"]); - - } - catch (Exception ex) + } catch (Exception e) { - Debug.WriteLine(ex.ToString()); + Debug.WriteLine(e.ToString()); } + SetVisibilities(); ViewModelProcessing(); } @@ -361,13 +360,12 @@ public async void SyncPropertyChanges() //IEnumerable> param = keyValues; try { - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Description_RO); + //await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Description_RO); await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Description_RW); - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_GPS_RO); - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Image_RO); - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Image_RW); - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Photo_RO); await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Photo_RW); + await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_GPS_RO); + //await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Image_RO); + //await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Photo_RO); } catch (Exception e) { @@ -375,6 +373,26 @@ public async void SyncPropertyChanges() } } + /// + /// This function goes through ever read-write property saved, then syncs it + /// + /// + public async Task ClearPersonalInformation() + { + ViewModel.SystemFileProperties_Photo_RW = ClearPropertyList(ViewModel.SystemFileProperties_Photo_RW); + ViewModel.SystemFileProperties_Description_RW = ClearPropertyList(ViewModel.SystemFileProperties_Description_RW); + ViewModel.SystemFileProperties_GPS_RO = ClearPropertyList(ViewModel.SystemFileProperties_GPS_RO); + SyncPropertyChanges(); + } + + private IDictionary ClearPropertyList(IDictionary keyValuePairs) + { + foreach (KeyValuePair keyValuePair in keyValuePairs) + keyValuePairs[keyValuePair.Key] = null; + + return keyValuePairs; + } + private async void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 63baf777c71f..0d2d00aa2aff 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -434,7 +434,7 @@ - + @@ -464,14 +464,13 @@ - - - - - + @@ -231,6 +193,14 @@ + + + + + + + + @@ -238,58 +208,38 @@ - + - + - + - + - + - + + - - + + - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - @@ -369,47 +319,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - + + @@ -434,36 +357,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + + - + \ No newline at end of file From c40e6a9e1f955c94d0038ceb19a6b3065493772e Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Sat, 19 Sep 2020 15:59:59 -0700 Subject: [PATCH 13/66] Details tab is now hidden for folders and when multiple items are selected --- Files/Views/Pages/Properties.xaml.cs | 3 +-- Files/Views/Pages/PropertiesDetails.xaml.cs | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Files/Views/Pages/Properties.xaml.cs b/Files/Views/Pages/Properties.xaml.cs index 7eb68ad231c9..ea55c6e9203a 100644 --- a/Files/Views/Pages/Properties.xaml.cs +++ b/Files/Views/Pages/Properties.xaml.cs @@ -42,8 +42,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) this.navParameter = e.Parameter; this.TabShorcut.Visibility = e.Parameter is ShortcutItem ? Visibility.Visible : Visibility.Collapsed; this.listedItem = e.Parameter as ListedItem; - //this.TabImageDetails.Visibility = (e.Parameter as ListedItem).IsImage() ? Visibility.Visible : Visibility.Collapsed; - this.TabDetails.Visibility = Visibility.Visible; + this.TabDetails.Visibility = listedItem != null && listedItem.FileExtension != null ? Visibility.Visible : Visibility.Collapsed; this.SetBackground(); base.OnNavigatedTo(e); } diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs index 274c85753699..ef354ec49fac 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml.cs +++ b/Files/Views/Pages/PropertiesDetails.xaml.cs @@ -37,8 +37,6 @@ public sealed partial class PropertiesDetails : Page public SelectedItemsPropertiesViewModel ViewModel { get; set; } - public TimeSpan FallbackTime= new TimeSpan(0, 0, 0); - public PropertiesDetails() { this.InitializeComponent(); From d19782585ccc267a15bf4bee4f16a1524dda5c24 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Mon, 21 Sep 2020 17:29:54 -0700 Subject: [PATCH 14/66] Improved open map button code --- Files/Views/Pages/PropertiesDetails.xaml.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs index ef354ec49fac..6bf556f7d9cf 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml.cs +++ b/Files/Views/Pages/PropertiesDetails.xaml.cs @@ -60,22 +60,14 @@ protected override void OnNavigatedTo(NavigationEventArgs e) { BaseProperties = new FileProperties(ViewModel, np.tokenSource, Dispatcher, null, listedItem); } - - - //ViewModel.AllDetailsVisibility = ViewModel.BasicDetailsVisibility.Equals(Visibility.Visible)? Visibility.Collapsed : Visibility.Visible; - //ShowMore.IsChecked = ViewModel.AllDetailsVisibility.Equals(Visibility.Visible); base.OnNavigatedTo(e); } private async void Button_Click(object sender, RoutedEventArgs e) { - var mapUri = new Uri(String.Format(@"bingmaps:?where={0}", ViewModel.Geopoint.Address.FormattedAddress)); - - // Launch the Windows Maps app - var launcherOptions = new Windows.System.LauncherOptions(); - launcherOptions.TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe"; - var success = await Windows.System.Launcher.LaunchUriAsync(mapUri, launcherOptions); + await Windows.System.Launcher.LaunchUriAsync(ViewModel.Geopoint.Address != null ? new Uri(String.Format(@"bingmaps:?where={0}", ViewModel.Geopoint.Address.FormattedAddress)) : new Uri(String.Format(@"bingmaps:?cp={0}~{1}", ViewModel.Latitude, ViewModel.Longitude)), + new Windows.System.LauncherOptions() { TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe" }); } From 5a73d0781787936f984e0252402639a64b6c4b49 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Mon, 21 Sep 2020 18:00:40 -0700 Subject: [PATCH 15/66] Overview page is now hidden for non-image files --- Files/Filesystem/ListedItem.cs | 25 --------------------- Files/Views/Pages/PropertiesDetails.xaml | 12 +++++----- Files/Views/Pages/PropertiesDetails.xaml.cs | 10 +++++++++ 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/Files/Filesystem/ListedItem.cs b/Files/Filesystem/ListedItem.cs index 2f1e008369c3..8f4e4dd517e3 100644 --- a/Files/Filesystem/ListedItem.cs +++ b/Files/Filesystem/ListedItem.cs @@ -160,22 +160,6 @@ public bool IsImage() return false; } - public FileType GetFileType() - { - if (FileExtension != null) - { - string lower = FileExtension.ToLower(); - - if (lower.Contains("png") || lower.Contains("jpg") || lower.Contains("png") || lower.Contains("gif") || lower.Contains("jpeg")) - return FileType.Image; - - if (lower.Contains("png") || lower.Contains("jpg") || lower.Contains("png") || lower.Contains("gif") || lower.Contains("jpeg")) - return FileType.Image; - - } - return FileType.Folder; - } - public ListedItem(string folderRelativeId) { FolderRelativeId = folderRelativeId; @@ -251,13 +235,4 @@ public ShortcutItem(string folderRelativeId) : base(folderRelativeId) public bool RunAsAdmin { get; set; } public bool IsUrl { get; set; } } - - public enum FileType - { - Document, - Image, - Music, - Video, - Folder, - } } \ No newline at end of file diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 758ef1f99133..93d8fdc36f9d 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -126,10 +126,10 @@ Visibility="{x:Bind ViewModel.ItemNameVisibility, Mode=OneWay}" /> - - + + - + @@ -144,7 +144,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -203,7 +203,7 @@ - + diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs index 6bf556f7d9cf..cca550389ff0 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml.cs +++ b/Files/Views/Pages/PropertiesDetails.xaml.cs @@ -50,6 +50,15 @@ private void Properties_Loaded(object sender, RoutedEventArgs e) } } + private void SetOverviewVisibilities() + { + var name = ViewModel.ItemName.Split("."); + var extension = name[name.Length -1].ToLower(); + + if (extension.Contains("png") || extension.Contains("jpg") || extension.Contains("png") || extension.Contains("gif") || extension.Contains("jpeg")) + OverviewImage.Visibility = Visibility.Visible; + } + protected override void OnNavigatedTo(NavigationEventArgs e) { ViewModel = new SelectedItemsPropertiesViewModel(); @@ -61,6 +70,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) BaseProperties = new FileProperties(ViewModel, np.tokenSource, Dispatcher, null, listedItem); } + SetOverviewVisibilities(); base.OnNavigatedTo(e); } From 7559fbf566d1d3967d8f0dcacd4a6c2bd2b4b534 Mon Sep 17 00:00:00 2001 From: Winston de Jong <59544401+winiston2212@users.noreply.github.com> Date: Tue, 22 Sep 2020 12:51:13 -0700 Subject: [PATCH 16/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index e488086930fc..29c0fc138d39 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -21,6 +21,11 @@ steps: $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files UWP - Preview" $xmlDoc.Save('$(Build.SourcesDirectory)\Files.Package\Package.appxmanifest') failOnStderr: true + + - task: DownloadDevKeyFile@1 + displayName: mySecureFile # The name with which to reference the secure file's path on the agent, like $(mySecureFile.secureFilePath) + inputs: + secureFile: 'BingMapsKey.json' - task: NuGetToolInstaller@1 @@ -45,4 +50,4 @@ steps: - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: drop' inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' \ No newline at end of file + PathtoPublish: '$(build.artifactstagingdirectory)' From 0ae723354f1ffd3162f1fc02b691e26c0b85656e Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Tue, 22 Sep 2020 15:53:46 -0400 Subject: [PATCH 17/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index 29c0fc138d39..a28b21536d77 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -22,10 +22,11 @@ steps: $xmlDoc.Save('$(Build.SourcesDirectory)\Files.Package\Package.appxmanifest') failOnStderr: true - - task: DownloadDevKeyFile@1 - displayName: mySecureFile # The name with which to reference the secure file's path on the agent, like $(mySecureFile.secureFilePath) - inputs: - secureFile: 'BingMapsKey.json' +- task: DownloadSecureFile@1 + name: mapsDevKey + displayName: 'Download Bing Maps Dev Key' + inputs: + secureFile: 'BingMapsKey.json' - task: NuGetToolInstaller@1 From b963384df07a3da77d0c9f9330f6cfb0608cda37 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Tue, 22 Sep 2020 13:07:39 -0700 Subject: [PATCH 18/66] Code will be parsed from json file --- Files/View Models/Properties/FileProperties.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index f78917808e65..c9aaa13778a9 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -5,6 +5,7 @@ using Microsoft.Toolkit.Mvvm.Input; using Microsoft.Toolkit.Uwp.UI.Extensions; using Microsoft.UI.Xaml.Controls; +using Newtonsoft.Json.Linq; using SQLitePCL; using System; using System.Collections; @@ -346,9 +347,15 @@ private bool GetVisibility(IDictionary dict) private async Task GetAddressFromCoordinates(double Lat, double Lon) { - //lol please don't steal this - MapService.ServiceToken = "S7IF7M4Zxe9of0hbatDv~byc7WbHGg1rNYUqk4bL8Zw~Ar_Ap1WxoB_qnXme_hErpFhs74E8qKzCOXugSrankFJgJe9_D4l09O3TNj3WN2f2"; - // The location to reverse geocode. + JObject obj; + try { + obj = JObject.Parse(File.ReadAllText(@"ms-appx:///bingmapskey.json")); + } catch + { + return null; + } + MapService.ServiceToken = (string)obj.SelectToken("key"); + BasicGeoposition location = new BasicGeoposition(); location.Latitude = Lat; location.Longitude = Lon; From bd0d64091ad106c45dd5697742e5fcd8a386f228 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Tue, 22 Sep 2020 16:09:52 -0400 Subject: [PATCH 19/66] Update builds/azure-pipelines.yml --- builds/azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index a28b21536d77..7fd914004d53 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -27,6 +27,12 @@ steps: displayName: 'Download Bing Maps Dev Key' inputs: secureFile: 'BingMapsKey.json' + +- task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + Copy-Item -Path $(mapsDevKey.secureFilePath) -Destination $(Build.SourcesDirectory)\Files - task: NuGetToolInstaller@1 From e628822bd1b7202fe13568c3fb5eca2e550400f3 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Tue, 22 Sep 2020 16:36:12 -0400 Subject: [PATCH 20/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index 7fd914004d53..4ef5ad7fde8e 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -27,13 +27,13 @@ steps: displayName: 'Download Bing Maps Dev Key' inputs: secureFile: 'BingMapsKey.json' - -- task: PowerShell@2 + +- task: CopyFiles@2 inputs: - targetType: 'inline' - script: | - Copy-Item -Path $(mapsDevKey.secureFilePath) -Destination $(Build.SourcesDirectory)\Files - + SourceFolder: '$(Agent.TempDirectory)' + Contents: '$(mapsDevKey.secureFilePath)' + TargetFolder: '$(Build.SourcesDirectory)\Files' + - task: NuGetToolInstaller@1 - task: NuGetCommand@2 From b0884db0b759ae04f709d48c30083cc306bc06bc Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Tue, 22 Sep 2020 16:39:18 -0400 Subject: [PATCH 21/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index d33f4c09b4b1..bde373948990 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -22,6 +22,18 @@ steps: $xmlDoc.Save('$(Build.SourcesDirectory)\Files.Package\Package.appxmanifest') failOnStderr: true +- task: DownloadSecureFile@1 + name: mapsDevKey + displayName: 'Download Bing Maps Dev Key' + inputs: + secureFile: 'BingMapsKey.json' + +- task: CopyFiles@2 + inputs: + SourceFolder: '$(Agent.TempDirectory)' + Contents: '$(mapsDevKey.secureFilePath)' + TargetFolder: '$(Build.SourcesDirectory)\Files' + - task: NuGetToolInstaller@1 - task: NuGetCommand@2 @@ -43,4 +55,4 @@ steps: flightName: 'Files UWP Fast Ring' packagePath: '$(appxPackageDir)\**\*.msixupload' force: false - skipPolling: false \ No newline at end of file + skipPolling: false From e6d3a9c155fd93d1608efe6a587d8eaf3d57c642 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Wed, 23 Sep 2020 17:46:41 -0700 Subject: [PATCH 22/66] Moved some code to a try-catch so that it doesn't crash --- Files/View Models/Properties/FileProperties.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index c9aaa13778a9..3da6cce57ce9 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -309,14 +309,13 @@ private async void ViewModelProcessing() try { result = await GetAddressFromCoordinates((double)ViewModel.Latitude, (double)ViewModel.Longitude); + ViewModel.Geopoint = result.Locations[0]; + ViewModel.GeopointString = string.Format("{0}, {1}", result.Locations[0].Address.Town.ToString(), result.Locations[0].Address.Region.ToString()); } catch { - + } - - ViewModel.Geopoint = result.Locations[0]; - ViewModel.GeopointString = string.Format("{0}, {1}", result.Locations[0].Address.Town.ToString(), result.Locations[0].Address.Region.ToString()); } else { From 47e9e6247f3e336613373a2327ab703d5d440410 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 20:49:05 -0400 Subject: [PATCH 23/66] Update Package.appxmanifest --- Files.Package/Package.appxmanifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Files.Package/Package.appxmanifest b/Files.Package/Package.appxmanifest index adb9695ce163..3c06854ec29a 100644 --- a/Files.Package/Package.appxmanifest +++ b/Files.Package/Package.appxmanifest @@ -9,7 +9,7 @@ xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop"> - + Files UWP - Dev Yair A @@ -66,4 +66,4 @@ - \ No newline at end of file + From 80f512923a048532fd6d89bb3e3cbde779dd59df Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:33:17 -0400 Subject: [PATCH 24/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 4eed346fa240..944f3128fb54 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -32,7 +32,7 @@ steps: inputs: SourceFolder: '$(Agent.TempDirectory)' Contents: '$(mapsDevKey.secureFilePath)' - TargetFolder: '$(Build.SourcesDirectory)\Files' + TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' - task: NuGetToolInstaller@1 From 0506950cf20bfae88a0f6d994386a7c5944ba67e Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:33:25 -0400 Subject: [PATCH 25/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index a4b04dc3ed1b..b924b4a483e4 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -32,7 +32,7 @@ steps: inputs: SourceFolder: '$(Agent.TempDirectory)' Contents: '$(mapsDevKey.secureFilePath)' - TargetFolder: '$(Build.SourcesDirectory)\Files' + TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' - task: NuGetToolInstaller@1 From 2068ad52887c0a50098a30a6287e9d6f2edaa8f3 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:34:12 -0400 Subject: [PATCH 26/66] Updated paths --- Files/Files.csproj | 1 + Files/Resources/BingMapsKey.json | 3 +++ Files/View Models/Properties/FileProperties.cs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Files/Resources/BingMapsKey.json diff --git a/Files/Files.csproj b/Files/Files.csproj index 4dc10270e5dc..7965c0fdea94 100644 --- a/Files/Files.csproj +++ b/Files/Files.csproj @@ -350,6 +350,7 @@ PreserveNewest + Always diff --git a/Files/Resources/BingMapsKey.json b/Files/Resources/BingMapsKey.json new file mode 100644 index 000000000000..d61275382941 --- /dev/null +++ b/Files/Resources/BingMapsKey.json @@ -0,0 +1,3 @@ +{ + "key": "" +} \ No newline at end of file diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index c9aaa13778a9..50e0487a2279 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -349,7 +349,7 @@ private async Task GetAddressFromCoordinates(double Lat { JObject obj; try { - obj = JObject.Parse(File.ReadAllText(@"ms-appx:///bingmapskey.json")); + obj = JObject.Parse(File.ReadAllText(@"ms-appx:///Resources/BingMapsKey.json")); } catch { return null; From cf39c6a98a1cde8b6b1cc813356d296ef5f3e87f Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:42:25 -0400 Subject: [PATCH 27/66] Updated file path --- Files/Files.csproj | 2 +- Files/Resources/{BingMapsKey.json => BingMapsKey.txt} | 0 Files/View Models/Properties/FileProperties.cs | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) rename Files/Resources/{BingMapsKey.json => BingMapsKey.txt} (100%) diff --git a/Files/Files.csproj b/Files/Files.csproj index 20e2c58906d7..d497461a490b 100644 --- a/Files/Files.csproj +++ b/Files/Files.csproj @@ -360,7 +360,7 @@ PreserveNewest - + Always diff --git a/Files/Resources/BingMapsKey.json b/Files/Resources/BingMapsKey.txt similarity index 100% rename from Files/Resources/BingMapsKey.json rename to Files/Resources/BingMapsKey.txt diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index e6bdae9bc63f..c0bcf24093b5 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -348,7 +348,9 @@ private async Task GetAddressFromCoordinates(double Lat { JObject obj; try { - obj = JObject.Parse(File.ReadAllText(@"ms-appx:///Resources/BingMapsKey.json")); + StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/BingMapsKey.txt")); + var lines = await FileIO.ReadTextAsync(file); + obj = JObject.Parse(lines); } catch { return null; From 613807dd85a464757c10dc4f9f9fb8ebdcdf2ba6 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:44:46 -0400 Subject: [PATCH 28/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 944f3128fb54..6c8b512e669c 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -26,7 +26,7 @@ steps: name: mapsDevKey displayName: 'Download Bing Maps Dev Key' inputs: - secureFile: 'BingMapsKey.json' + secureFile: 'BingMapsKey.txt' - task: CopyFiles@2 inputs: From 38c6232d15376024af9fee55d4fd9e4f3e36fa0c Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:44:52 -0400 Subject: [PATCH 29/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index b924b4a483e4..080ec3083d96 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -26,7 +26,7 @@ steps: name: mapsDevKey displayName: 'Download Bing Maps Dev Key' inputs: - secureFile: 'BingMapsKey.json' + secureFile: 'BingMapsKey.txt' - task: CopyFiles@2 inputs: From f074aaca215d7596d7d919c61404ae9dbd9723dc Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 09:03:54 -0400 Subject: [PATCH 30/66] Update Package.appxmanifest --- Files.Package/Package.appxmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Files.Package/Package.appxmanifest b/Files.Package/Package.appxmanifest index 2cbfcbf52915..12efb5d3cacc 100644 --- a/Files.Package/Package.appxmanifest +++ b/Files.Package/Package.appxmanifest @@ -9,7 +9,7 @@ xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop"> - + Files - Dev Yair A From 2acf92ef7d508b5ecccea015a4d459aa7055377e Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 13:19:49 -0400 Subject: [PATCH 31/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 6c8b512e669c..8da7aad7d1a2 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -33,6 +33,7 @@ steps: SourceFolder: '$(Agent.TempDirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' + overWrite: true - task: NuGetToolInstaller@1 From 427735da49b211a0498528a932f7027869f4b213 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 13:21:09 -0400 Subject: [PATCH 32/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index 080ec3083d96..e00ddecafcbf 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -33,6 +33,7 @@ steps: SourceFolder: '$(Agent.TempDirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' + overWrite: true - task: NuGetToolInstaller@1 From e5e9efc6c0bfa8f704fd62083a19e230f489aaf5 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 13:23:34 -0400 Subject: [PATCH 33/66] Update Package.appxmanifest --- Files.Package/Package.appxmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Files.Package/Package.appxmanifest b/Files.Package/Package.appxmanifest index 12efb5d3cacc..d7990fd02bf4 100644 --- a/Files.Package/Package.appxmanifest +++ b/Files.Package/Package.appxmanifest @@ -9,7 +9,7 @@ xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop"> - + Files - Dev Yair A From 98140df42f7fd4d34589bb611c8e141033723528 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 10:40:16 -0700 Subject: [PATCH 34/66] Details tab is now hidden for shortcut items The details code doesn't work for shortcut items, so the tab is hidden for them --- Files/Views/Pages/Properties.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Files/Views/Pages/Properties.xaml.cs b/Files/Views/Pages/Properties.xaml.cs index ea55c6e9203a..2a1e9a8910d8 100644 --- a/Files/Views/Pages/Properties.xaml.cs +++ b/Files/Views/Pages/Properties.xaml.cs @@ -42,7 +42,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) this.navParameter = e.Parameter; this.TabShorcut.Visibility = e.Parameter is ShortcutItem ? Visibility.Visible : Visibility.Collapsed; this.listedItem = e.Parameter as ListedItem; - this.TabDetails.Visibility = listedItem != null && listedItem.FileExtension != null ? Visibility.Visible : Visibility.Collapsed; + this.TabDetails.Visibility = listedItem != null && listedItem.FileExtension != null && !listedItem.IsShortcutItem ? Visibility.Visible : Visibility.Collapsed; this.SetBackground(); base.OnNavigatedTo(e); } From d8abf6239a3c87a85f989821168166f8db7f39a8 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 12:49:17 -0700 Subject: [PATCH 35/66] Fixed a bug where the 'comment' box was getting the wrong property --- Files/Views/Pages/PropertiesDetails.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 93d8fdc36f9d..ad255c76fcf2 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -217,7 +217,7 @@ - + From 6f8435730bd2c2db615ab0786549c18fbe137ae0 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 13:48:03 -0700 Subject: [PATCH 36/66] Consolidated SystemFileProperties into a two seperate lists/dictionaries This is to reduce the amount of requests to the RetrievePropertiesAsync and SavePropertiesAsync functions. --- .../View Models/Properties/FileProperties.cs | 171 +++++++----------- .../SelectedItemsPropertiesViewModel.cs | 60 +----- Files/Views/Pages/PropertiesDetails.xaml | 52 +++--- 3 files changed, 104 insertions(+), 179 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index c0bcf24093b5..f722e79d8b1d 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -34,64 +34,47 @@ internal class FileProperties : BaseProperties { private ProgressBar ProgressBar; - private readonly IDictionary> PropertiesToGet = new Dictionary>() + private readonly List PropertiesToGet_RO = new List() { - {"Image_RO", new List - { - //Image - "System.Image.BitDepth", - "System.Image.Dimensions", - "System.Image.HorizontalResolution", - "System.Image.VerticalResolution", - "System.Image.Compression", - "System.Image.ResolutionUnit", - "System.Image.HorizontalSize", - "System.Image.VerticalSize" - } - }, - {"GPS_RO", new List() - { - "System.GPS.Latitude", - "System.GPS.LatitudeRef", - "System.GPS.Longitude", - "System.GPS.LongitudeRef", - "System.GPS.Altitude", - } - }, - {"Photo_RO", new List() - { - "System.Photo.ExposureTime", - "System.Photo.FocalLength", - "System.Photo.Aperture", - "System.Photo.DateTaken", - } + "System.Image.BitDepth", + "System.Image.Dimensions", + "System.Image.HorizontalResolution", + "System.Image.VerticalResolution", + "System.Image.Compression", + "System.Image.ResolutionUnit", + "System.Image.HorizontalSize", + "System.Image.VerticalSize", + + "System.GPS.Latitude", + "System.GPS.LatitudeRef", + "System.GPS.Longitude", + "System.GPS.LongitudeRef", + "System.GPS.Altitude", + + "System.Photo.ExposureTime", + "System.Photo.FocalLength", + "System.Photo.Aperture", + "System.Photo.DateTaken", + + "System.Rating", + "System.ItemFolderPathDisplay", + "System.DateCreated", + "System.DateModified", + "System.Size", + "System.ItemTypeText", + "System.FileOwner", - }, - { "Core_RO", new List() - { - "System.Rating", - "System.ItemFolderPathDisplay", - "System.DateCreated", - "System.DateModified", - "System.Size", - "System.ItemTypeText", - "System.FileOwner", - } - }, - {"Core_RW", new List() - { - "System.Title", - "System.Subject", - "System.Comment", - "System.Copyright", - } - }, - {"Photo_RW", new List() - { - "System.Photo.CameraManufacturer", - "System.Photo.CameraModel", - } - } + }; + + private readonly List PropertiesToGet_RW = new List() + { + "System.Title", + "System.Subject", + "System.Comment", + "System.Copyright", + + "System.Photo.CameraManufacturer", + "System.Photo.CameraModel", }; /// @@ -267,19 +250,22 @@ public async void GetSystemFileProperties() try { - ViewModel.SystemFileProperties_Image_RO = await RetrieveProperties(file, PropertiesToGet["Image_RO"]); - ViewModel.SystemFileProperties_Photo_RO = await RetrieveProperties(file, PropertiesToGet["Photo_RO"]); - ViewModel.SystemFileProperties_Photo_RW = await RetrieveProperties(file, PropertiesToGet["Photo_RW"]); - ViewModel.SystemFileProperties_Core_RO = await RetrieveProperties(file, PropertiesToGet["Core_RO"]); - ViewModel.SystemFileProperties_GPS_RO = await RetrieveProperties(file, PropertiesToGet["GPS_RO"]); - ViewModel.SystemFileProperties_Core_RW = await RetrieveProperties(file, PropertiesToGet["Core_RW"]); + //ViewModel.SystemFileProperties_Image_RO = await RetrieveProperties(file, PropertiesToGet["Image_RO"]); + //ViewModel.SystemFileProperties_Photo_RO = await RetrieveProperties(file, PropertiesToGet["Photo_RO"]); + //ViewModel.SystemFileProperties_Photo_RW = await RetrieveProperties(file, PropertiesToGet["Photo_RW"]); + //ViewModel.SystemFileProperties_Core_RO = await RetrieveProperties(file, PropertiesToGet["Core_RO"]); + //ViewModel.SystemFileProperties_GPS_RO = await RetrieveProperties(file, PropertiesToGet["GPS_RO"]); + //ViewModel.SystemFileProperties_Core_RW = await RetrieveProperties(file, PropertiesToGet["Core_RW"]); + + ViewModel.SystemFileProperties_RO = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RO); + ViewModel.SystemFileProperties_RW = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RW); } catch (Exception e) { Debug.WriteLine(e.ToString()); } SetVisibilities(); - if(ViewModel.DetailsSectionVisibility_GPS == Visibility.Visible) + if (ViewModel.DetailsSectionVisibility_GPS == Visibility.Visible) SetLocationInformation(); ViewModelProcessing(); @@ -287,12 +273,12 @@ public async void GetSystemFileProperties() private void SetLocationInformation() { - double[] latitude = ViewModel.SystemFileProperties_GPS_RO["System.GPS.Latitude"] as double[]; - double[] longitude = ViewModel.SystemFileProperties_GPS_RO["System.GPS.Longitude"] as double[]; + double[] latitude = ViewModel.SystemFileProperties_RO["System.GPS.Latitude"] as double[]; + double[] longitude = ViewModel.SystemFileProperties_RO["System.GPS.Longitude"] as double[]; ViewModel.Latitude = (latitude[0] + (latitude[1] / 60) + (latitude[2] / 3600)); ViewModel.Longitude = longitude[0] + (longitude[1] / 60) + (longitude[2] / 3600); - ViewModel.Latitude *= (ViewModel.SystemFileProperties_GPS_RO["System.GPS.LatitudeRef"] as string).ToLower().Equals("s") ? -1 : 1; - ViewModel.Longitude *= (ViewModel.SystemFileProperties_GPS_RO["System.GPS.LongitudeRef"] as string).ToLower().Equals("w") ? -1 : 1; + ViewModel.Latitude *= (ViewModel.SystemFileProperties_RO["System.GPS.LatitudeRef"] as string).ToLower().Equals("s") ? -1 : 1; + ViewModel.Longitude *= (ViewModel.SystemFileProperties_RO["System.GPS.LongitudeRef"] as string).ToLower().Equals("w") ? -1 : 1; } /// @@ -300,10 +286,10 @@ private void SetLocationInformation() /// private async void ViewModelProcessing() { - if (ViewModel.SystemFileProperties_Photo_RW["System.Photo.CameraManufacturer"] != null && ViewModel.SystemFileProperties_Photo_RW["System.Photo.CameraModel"] != null) - ViewModel.CameraNameString = string.Format("{0} {1}", ViewModel.SystemFileProperties_Photo_RW["System.Photo.CameraManufacturer"], ViewModel.SystemFileProperties_Photo_RW["System.Photo.CameraModel"]); + if (ViewModel.SystemFileProperties_RW["System.Photo.CameraManufacturer"] != null && ViewModel.SystemFileProperties_RW["System.Photo.CameraModel"] != null) + ViewModel.CameraNameString = string.Format("{0} {1}", ViewModel.SystemFileProperties_RW["System.Photo.CameraManufacturer"], ViewModel.SystemFileProperties_RW["System.Photo.CameraModel"]); - if (ViewModel.SystemFileProperties_GPS_RO["System.GPS.Longitude"] != null && ViewModel.SystemFileProperties_GPS_RO["System.GPS.Longitude"] != null) + if (ViewModel.SystemFileProperties_RO["System.GPS.Longitude"] != null && ViewModel.SystemFileProperties_RO["System.GPS.Longitude"] != null) { MapLocationFinderResult result = null; try @@ -314,7 +300,7 @@ private async void ViewModelProcessing() } catch { - + } } else @@ -322,23 +308,23 @@ private async void ViewModelProcessing() //ViewModel.DetailsSectionVisibility.Add("GPS", Visibility.Collapsed); } - if (ViewModel.SystemFileProperties_Photo_RO["System.Photo.ExposureTime"] != null && ViewModel.SystemFileProperties_Photo_RO["System.Photo.FocalLength"] != null && ViewModel.SystemFileProperties_Photo_RO["System.Photo.Aperture"] != null) + if (ViewModel.SystemFileProperties_RO["System.Photo.ExposureTime"] != null && ViewModel.SystemFileProperties_RO["System.Photo.FocalLength"] != null && ViewModel.SystemFileProperties_RO["System.Photo.Aperture"] != null) { - ViewModel.ShotString = string.Format("{0} sec. f/{1} {2}mm", ViewModel.SystemFileProperties_Photo_RO["System.Photo.ExposureTime"], ViewModel.SystemFileProperties_Photo_RO["System.Photo.FocalLength"], ViewModel.SystemFileProperties_Photo_RO["System.Photo.Aperture"]); + ViewModel.ShotString = string.Format("{0} sec. f/{1} {2}mm", ViewModel.SystemFileProperties_RO["System.Photo.ExposureTime"], ViewModel.SystemFileProperties_RO["System.Photo.FocalLength"], ViewModel.SystemFileProperties_RO["System.Photo.Aperture"]); } } private void SetVisibilities() { - ViewModel.DetailsSectionVisibility_GPS = GetVisibility(ViewModel.SystemFileProperties_GPS_RO) ? Visibility.Visible : Visibility.Collapsed; - ViewModel.DetailsSectionVisibility_Photo = GetVisibility(ViewModel.SystemFileProperties_Photo_RO) && GetVisibility(ViewModel.SystemFileProperties_Photo_RW) ? Visibility.Visible : Visibility.Collapsed; - ViewModel.DetailsSectionVisibility_Image = GetVisibility(ViewModel.SystemFileProperties_Image_RO) ? Visibility.Visible : Visibility.Collapsed; + ViewModel.DetailsSectionVisibility_GPS = GetVisibility("System.GPS", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed; + ViewModel.DetailsSectionVisibility_Photo = GetVisibility("System.Photo", ViewModel.SystemFileProperties_RO) && GetVisibility("System.Photo", ViewModel.SystemFileProperties_RW) ? Visibility.Visible : Visibility.Collapsed; + ViewModel.DetailsSectionVisibility_Image = GetVisibility("System.Image", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed; } - private bool GetVisibility(IDictionary dict) + private bool GetVisibility(string endpoint, IDictionary dict) { foreach (KeyValuePair pair in dict) - if (pair.Value != null) + if (pair.Key.Contains(endpoint) && pair.Value != null) return true; return false; @@ -347,11 +333,13 @@ private bool GetVisibility(IDictionary dict) private async Task GetAddressFromCoordinates(double Lat, double Lon) { JObject obj; - try { + try + { StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/BingMapsKey.txt")); var lines = await FileIO.ReadTextAsync(file); obj = JObject.Parse(lines); - } catch + } + catch { return null; } @@ -368,40 +356,21 @@ private async Task GetAddressFromCoordinates(double Lat // contained in the address of the first result. } - private async Task> RetrieveProperties(StorageFile file, List props) - { - try - { - return await file.Properties.RetrievePropertiesAsync(props); - } - catch (Exception e) - { - Debug.WriteLine(e.ToString()); - return new Dictionary(); - } - } - public async void SyncPropertyChanges() { StorageFile file = null; try { - file = await ItemViewModel.GetFileFromPathAsync(Item.ItemPath); } catch { return; } - //Dictionary keyValues = new Dictionary(); - //foreach(KeyValuePair o in ViewModel.SystemFileProperties_RW) - // keyValues.Add(o.Key, o.Value); - //IEnumerable> param = ViewModel.SystemFileProperties_RW; - //IEnumerable> param = keyValues; try { - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Core_RW); - await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_Photo_RW); + file = await ItemViewModel.GetFileFromPathAsync(Item.ItemPath); + await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_RW); } catch (Exception e) { diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs index 98a8fc9405d5..fdd4ef81a14e 100644 --- a/Files/View Models/SelectedItemsPropertiesViewModel.cs +++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs @@ -698,62 +698,18 @@ public string ShotString set => SetProperty(ref _ShotString, value); } - ////This is the dictionary of dictionaries for file properties - //private IDictionary> _SystemFileProperties; - //public IDictionary> SystemFileProperties - //{ - // get => _SystemFileProperties; - // set => SetProperty(ref _SystemFileProperties, value); - //} - - private IDictionary _SystemFileProperties_Image_RO; - public IDictionary SystemFileProperties_Image_RO + private IDictionary _SystemFileProperties_RO; + public IDictionary SystemFileProperties_RO { - get => _SystemFileProperties_Image_RO; - set => SetProperty(ref _SystemFileProperties_Image_RO, value); + get => _SystemFileProperties_RO; + set => SetProperty(ref _SystemFileProperties_RO, value); } - private IDictionary _SystemFileProperties_GPS_RO; - public IDictionary SystemFileProperties_GPS_RO - { - get => _SystemFileProperties_GPS_RO; - set => SetProperty(ref _SystemFileProperties_GPS_RO, value); - } - - private IDictionary _SystemFileProperties_Photo_RO; - public IDictionary SystemFileProperties_Photo_RO - { - get => _SystemFileProperties_Photo_RO; - set => SetProperty(ref _SystemFileProperties_Photo_RO, value); - } - - private IDictionary _SystemFileProperties_Core_RO; - public IDictionary SystemFileProperties_Core_RO - { - get => _SystemFileProperties_Core_RO; - set => SetProperty(ref _SystemFileProperties_Core_RO, value); - } - - private IDictionary _SystemFileProperties_Core_RW; - public IDictionary SystemFileProperties_Core_RW - { - get => _SystemFileProperties_Core_RW; - set => SetProperty(ref _SystemFileProperties_Core_RW, value); - } - - private IDictionary _SystemFileProperties_Image_RW; - public IDictionary SystemFileProperties_Image_RW - { - get => _SystemFileProperties_Image_RW; - set => SetProperty(ref _SystemFileProperties_Image_RW, value); - } - - - private IDictionary _SystemFileProperties_Photo_RW; - public IDictionary SystemFileProperties_Photo_RW + private IDictionary _SystemFileProperties_RW; + public IDictionary SystemFileProperties_RW { - get => _SystemFileProperties_Photo_RW; - set => SetProperty(ref _SystemFileProperties_Photo_RW, value); + get => _SystemFileProperties_RW; + set => SetProperty(ref _SystemFileProperties_RW, value); } private Visibility _DetailsSectionVisibility_Image; diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index ad255c76fcf2..7cbc87f269ad 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -152,10 +152,10 @@ - + - + @@ -208,37 +208,37 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -276,22 +276,22 @@ - + - + - + - + - + - + @@ -314,22 +314,22 @@ - + - + - + - + - + - + @@ -357,7 +357,7 @@ - + From 3e87721520f3387c5612df72397d650d4799b1e8 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 14:01:32 -0700 Subject: [PATCH 37/66] Added code to display the devkey and error --- Files/View Models/Properties/FileProperties.cs | 6 +++++- .../SelectedItemsPropertiesViewModel.cs | 14 ++++++++++++++ Files/Views/Pages/PropertiesDetails.xaml | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index f722e79d8b1d..5bfc21347afa 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -335,12 +335,16 @@ private async Task GetAddressFromCoordinates(double Lat JObject obj; try { + StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/BingMapsKey.txt")); var lines = await FileIO.ReadTextAsync(file); + ViewModel.DevKey = lines; obj = JObject.Parse(lines); + ViewModel.DevKey = obj.ToString(); } - catch + catch (Exception e) { + ViewModel.DevKeyError = e.ToString(); return null; } MapService.ServiceToken = (string)obj.SelectToken("key"); diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs index fdd4ef81a14e..a8a80fed536c 100644 --- a/Files/View Models/SelectedItemsPropertiesViewModel.cs +++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs @@ -732,5 +732,19 @@ public Visibility DetailsSectionVisibility_Photo get => _DetailsSectionVisibility_Photo; set => SetProperty(ref _DetailsSectionVisibility_Photo, value); } + + private string _DevKey; + public string DevKey + { + get => _DevKey; + set => SetProperty(ref _DevKey, value); + } + + private string _DevKeyError; + public string DevKeyError + { + get => _DevKeyError; + set => SetProperty(ref _DevKeyError, value); + } } } \ No newline at end of file diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 7cbc87f269ad..9e182c6395e3 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -207,11 +207,11 @@ - - + + - - + + From 3060c8505ac05cee6f68a6fa5204c81c0139bb13 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 14:16:30 -0700 Subject: [PATCH 38/66] Key will now put in single line --- Files/View Models/Properties/FileProperties.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 5bfc21347afa..32244d216e9f 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -338,9 +338,8 @@ private async Task GetAddressFromCoordinates(double Lat StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/BingMapsKey.txt")); var lines = await FileIO.ReadTextAsync(file); - ViewModel.DevKey = lines; + ViewModel.DevKey = lines.Replace('\n', ' '); obj = JObject.Parse(lines); - ViewModel.DevKey = obj.ToString(); } catch (Exception e) { From 8f8a19230a67d2a5e2bb4e4cf46ad84b4e4a5ad3 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 17:16:41 -0400 Subject: [PATCH 39/66] Update Package.appxmanifest --- Files.Package/Package.appxmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Files.Package/Package.appxmanifest b/Files.Package/Package.appxmanifest index d7990fd02bf4..caa35adadb8a 100644 --- a/Files.Package/Package.appxmanifest +++ b/Files.Package/Package.appxmanifest @@ -9,7 +9,7 @@ xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop"> - + Files - Dev Yair A From 07712cafe6bdea5d2260f319aab9962e8c9275d4 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 19:15:32 -0400 Subject: [PATCH 40/66] Removed blank key for testing --- Files/Resources/BingMapsKey.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Files/Resources/BingMapsKey.txt b/Files/Resources/BingMapsKey.txt index d61275382941..5f282702bb03 100644 --- a/Files/Resources/BingMapsKey.txt +++ b/Files/Resources/BingMapsKey.txt @@ -1,3 +1 @@ -{ - "key": "" -} \ No newline at end of file + \ No newline at end of file From 00d36739197cbb24500ea91d8833c1b1fe9ce0c8 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:02:13 -0400 Subject: [PATCH 41/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index e00ddecafcbf..b7ca0b7161e5 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(Agent.TempDirectory)' + SourceFolder: '$(system.defaultworkingdirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 0b275037b6271d3faff71dfacbbccc468a0a3ede Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:05:28 -0400 Subject: [PATCH 42/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 8da7aad7d1a2..2c865530de68 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -30,7 +30,7 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(Agent.TempDirectory)' + SourceFolder: '$(system.defaultworkingdirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 24564b1ac7c6d9abd007b3df209178a121f2caed Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:09:46 -0400 Subject: [PATCH 43/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index b7ca0b7161e5..d625d10b25ba 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -30,7 +30,6 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(system.defaultworkingdirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 4671592622149ea51260c9d75579bc7da67ac201 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:10:04 -0400 Subject: [PATCH 44/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 2c865530de68..835264c05714 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -30,7 +30,6 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(system.defaultworkingdirectory)' Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 2c6c887f7066ef47256d653b840d24122327b222 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:19:18 -0400 Subject: [PATCH 45/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index d625d10b25ba..601d7ddae70f 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -30,7 +30,8 @@ steps: - task: CopyFiles@2 inputs: - Contents: '$(mapsDevKey.secureFilePath)' + SourceFolder: '$(mapsDevKey.secureFilePath)' + Contents: 'BingMapsKey.txt' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From f0131e7ab410b0763f1926c4ffd139a8a8539f12 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:19:59 -0400 Subject: [PATCH 46/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 835264c05714..b997db432743 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -30,7 +30,8 @@ steps: - task: CopyFiles@2 inputs: - Contents: '$(mapsDevKey.secureFilePath)' + SourceFolder: '$(mapsDevKey.secureFilePath)' + Contents: 'BingMapsKey.txt' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 1b18130054d94d4f34ea0b2a7cd2be3f7ec82146 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:24:33 -0400 Subject: [PATCH 47/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index 601d7ddae70f..ab56bbbffc6b 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(mapsDevKey.secureFilePath)' + SourceFolder: 'D:\a\1\s\' Contents: 'BingMapsKey.txt' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From ca5b1e8ad6a0f88e195848921cc89d46fe983674 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:34:40 -0400 Subject: [PATCH 48/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index ab56bbbffc6b..b629901363b6 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -28,12 +28,13 @@ steps: inputs: secureFile: 'BingMapsKey.txt' -- task: CopyFiles@2 +- task: PowerShell@2 inputs: - SourceFolder: 'D:\a\1\s\' - Contents: 'BingMapsKey.txt' - TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' - overWrite: true + targetType: 'inline' + script: | + Copy-Item $(mapsDevKey.secureFilePath) + -Destination $(Build.SourcesDirectory)\Files\Resources + failOnStderr: true - task: NuGetToolInstaller@1 From 172bf49d40eb7ee6355fd7d08cd026b89ffb7352 Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 21:47:38 -0400 Subject: [PATCH 49/66] Update azure-pipelines.yml --- builds/azure-pipelines.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/builds/azure-pipelines.yml b/builds/azure-pipelines.yml index b629901363b6..e00ddecafcbf 100644 --- a/builds/azure-pipelines.yml +++ b/builds/azure-pipelines.yml @@ -28,13 +28,12 @@ steps: inputs: secureFile: 'BingMapsKey.txt' -- task: PowerShell@2 +- task: CopyFiles@2 inputs: - targetType: 'inline' - script: | - Copy-Item $(mapsDevKey.secureFilePath) - -Destination $(Build.SourcesDirectory)\Files\Resources - failOnStderr: true + SourceFolder: '$(Agent.TempDirectory)' + Contents: '$(mapsDevKey.secureFilePath)' + TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' + overWrite: true - task: NuGetToolInstaller@1 From 4a932bcf3cff419917422c3cd4778aceb87b1f4e Mon Sep 17 00:00:00 2001 From: Yair Aichenbaum <39923744+yaichenbaum@users.noreply.github.com> Date: Thu, 24 Sep 2020 21:49:59 -0400 Subject: [PATCH 50/66] Update azure-pipelines-release.yml --- builds/azure-pipelines-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index b997db432743..8da7aad7d1a2 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -30,8 +30,8 @@ steps: - task: CopyFiles@2 inputs: - SourceFolder: '$(mapsDevKey.secureFilePath)' - Contents: 'BingMapsKey.txt' + SourceFolder: '$(Agent.TempDirectory)' + Contents: '$(mapsDevKey.secureFilePath)' TargetFolder: '$(Build.SourcesDirectory)\Files\Resources' overWrite: true From 4d71d3577b6dffc54f4a63b773fc180bce99fc33 Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Thu, 24 Sep 2020 18:53:01 -0700 Subject: [PATCH 51/66] Replaced the error and dev key display code --- Files/View Models/Properties/FileProperties.cs | 2 -- .../SelectedItemsPropertiesViewModel.cs | 14 -------------- Files/Views/Pages/PropertiesDetails.xaml | 8 ++++---- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 32244d216e9f..25f4c87fb8b8 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -338,12 +338,10 @@ private async Task GetAddressFromCoordinates(double Lat StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/BingMapsKey.txt")); var lines = await FileIO.ReadTextAsync(file); - ViewModel.DevKey = lines.Replace('\n', ' '); obj = JObject.Parse(lines); } catch (Exception e) { - ViewModel.DevKeyError = e.ToString(); return null; } MapService.ServiceToken = (string)obj.SelectToken("key"); diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs index a8a80fed536c..fdd4ef81a14e 100644 --- a/Files/View Models/SelectedItemsPropertiesViewModel.cs +++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs @@ -732,19 +732,5 @@ public Visibility DetailsSectionVisibility_Photo get => _DetailsSectionVisibility_Photo; set => SetProperty(ref _DetailsSectionVisibility_Photo, value); } - - private string _DevKey; - public string DevKey - { - get => _DevKey; - set => SetProperty(ref _DevKey, value); - } - - private string _DevKeyError; - public string DevKeyError - { - get => _DevKeyError; - set => SetProperty(ref _DevKeyError, value); - } } } \ No newline at end of file diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 9e182c6395e3..7cbc87f269ad 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -207,11 +207,11 @@ - - + + - - + + From 784df81e99272f7b2b09748d33bb7d8b026c89fb Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Fri, 25 Sep 2020 15:24:11 -0700 Subject: [PATCH 52/66] Better handling of errors for location finder --- .../View Models/Properties/FileProperties.cs | 32 ++++++++----------- Files/Views/Pages/PropertiesDetails.xaml.cs | 2 +- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 25f4c87fb8b8..1ff55e27b528 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -250,13 +250,6 @@ public async void GetSystemFileProperties() try { - //ViewModel.SystemFileProperties_Image_RO = await RetrieveProperties(file, PropertiesToGet["Image_RO"]); - //ViewModel.SystemFileProperties_Photo_RO = await RetrieveProperties(file, PropertiesToGet["Photo_RO"]); - //ViewModel.SystemFileProperties_Photo_RW = await RetrieveProperties(file, PropertiesToGet["Photo_RW"]); - //ViewModel.SystemFileProperties_Core_RO = await RetrieveProperties(file, PropertiesToGet["Core_RO"]); - //ViewModel.SystemFileProperties_GPS_RO = await RetrieveProperties(file, PropertiesToGet["GPS_RO"]); - //ViewModel.SystemFileProperties_Core_RW = await RetrieveProperties(file, PropertiesToGet["Core_RW"]); - ViewModel.SystemFileProperties_RO = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RO); ViewModel.SystemFileProperties_RW = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RW); } @@ -265,8 +258,6 @@ public async void GetSystemFileProperties() Debug.WriteLine(e.ToString()); } SetVisibilities(); - if (ViewModel.DetailsSectionVisibility_GPS == Visibility.Visible) - SetLocationInformation(); ViewModelProcessing(); } @@ -286,29 +277,34 @@ private void SetLocationInformation() /// private async void ViewModelProcessing() { - if (ViewModel.SystemFileProperties_RW["System.Photo.CameraManufacturer"] != null && ViewModel.SystemFileProperties_RW["System.Photo.CameraModel"] != null) + if (ViewModel.DetailsSectionVisibility_Photo.Equals(Visibility.Visible)) ViewModel.CameraNameString = string.Format("{0} {1}", ViewModel.SystemFileProperties_RW["System.Photo.CameraManufacturer"], ViewModel.SystemFileProperties_RW["System.Photo.CameraModel"]); - if (ViewModel.SystemFileProperties_RO["System.GPS.Longitude"] != null && ViewModel.SystemFileProperties_RO["System.GPS.Longitude"] != null) + if (ViewModel.DetailsSectionVisibility_GPS == Visibility.Visible) + SetLocationInformation(); + + if (ViewModel.DetailsSectionVisibility_GPS.Equals(Visibility.Visible)) { MapLocationFinderResult result = null; try { result = await GetAddressFromCoordinates((double)ViewModel.Latitude, (double)ViewModel.Longitude); - ViewModel.Geopoint = result.Locations[0]; - ViewModel.GeopointString = string.Format("{0}, {1}", result.Locations[0].Address.Town.ToString(), result.Locations[0].Address.Region.ToString()); + if(result != null) + { + ViewModel.Geopoint = result.Locations[0]; + ViewModel.GeopointString = string.Format("{0}, {1}", result.Locations[0].Address.Town.ToString(), result.Locations[0].Address.Region.ToString()); + } else + { + ViewModel.GeopointString = string.Format("{0}, {1}", ViewModel.Latitude, ViewModel.Longitude); + } } catch { } } - else - { - //ViewModel.DetailsSectionVisibility.Add("GPS", Visibility.Collapsed); - } - if (ViewModel.SystemFileProperties_RO["System.Photo.ExposureTime"] != null && ViewModel.SystemFileProperties_RO["System.Photo.FocalLength"] != null && ViewModel.SystemFileProperties_RO["System.Photo.Aperture"] != null) + if (ViewModel.DetailsSectionVisibility_Photo.Equals(Visibility.Visible)) { ViewModel.ShotString = string.Format("{0} sec. f/{1} {2}mm", ViewModel.SystemFileProperties_RO["System.Photo.ExposureTime"], ViewModel.SystemFileProperties_RO["System.Photo.FocalLength"], ViewModel.SystemFileProperties_RO["System.Photo.Aperture"]); } diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs index cca550389ff0..2f7dba33ead9 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml.cs +++ b/Files/Views/Pages/PropertiesDetails.xaml.cs @@ -76,7 +76,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) private async void Button_Click(object sender, RoutedEventArgs e) { - await Windows.System.Launcher.LaunchUriAsync(ViewModel.Geopoint.Address != null ? new Uri(String.Format(@"bingmaps:?where={0}", ViewModel.Geopoint.Address.FormattedAddress)) : new Uri(String.Format(@"bingmaps:?cp={0}~{1}", ViewModel.Latitude, ViewModel.Longitude)), + await Windows.System.Launcher.LaunchUriAsync(ViewModel.Geopoint != null ? new Uri(String.Format(@"bingmaps:?where={0}", ViewModel.Geopoint.Address.FormattedAddress)) : new Uri(String.Format(@"bingmaps:?cp={0}~{1}", ViewModel.Latitude, ViewModel.Longitude)), new Windows.System.LauncherOptions() { TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe" }); } From 576b2c91f6f71439520734aeecfba69acde79c9f Mon Sep 17 00:00:00 2001 From: null-val <59544401+null-val@users.noreply.github.com> Date: Fri, 25 Sep 2020 16:35:37 -0700 Subject: [PATCH 53/66] Added audio properties --- .../View Models/Properties/FileProperties.cs | 26 +++++++++++---- .../SelectedItemsPropertiesViewModel.cs | 7 ++++ Files/Views/Pages/PropertiesDetails.xaml | 33 ++++++++++++++++++- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs index 1ff55e27b528..a6d88b3870f1 100644 --- a/Files/View Models/Properties/FileProperties.cs +++ b/Files/View Models/Properties/FileProperties.cs @@ -36,6 +36,16 @@ internal class FileProperties : BaseProperties private readonly List PropertiesToGet_RO = new List() { + //Core + "System.Rating", + "System.ItemFolderPathDisplay", + "System.DateCreated", + "System.DateModified", + "System.Size", + "System.ItemTypeText", + "System.FileOwner", + + //Image "System.Image.BitDepth", "System.Image.Dimensions", "System.Image.HorizontalResolution", @@ -45,24 +55,25 @@ internal class FileProperties : BaseProperties "System.Image.HorizontalSize", "System.Image.VerticalSize", + //GPS "System.GPS.Latitude", "System.GPS.LatitudeRef", "System.GPS.Longitude", "System.GPS.LongitudeRef", "System.GPS.Altitude", + //Photo "System.Photo.ExposureTime", "System.Photo.FocalLength", "System.Photo.Aperture", "System.Photo.DateTaken", - "System.Rating", - "System.ItemFolderPathDisplay", - "System.DateCreated", - "System.DateModified", - "System.Size", - "System.ItemTypeText", - "System.FileOwner", + //Audio + "System.Audio.ChannelCount", + "System.Audio.EncodingBitrate", + "System.Audio.Compression", + "System.Audio.Format", + "System.Audio.SampleRate", }; @@ -315,6 +326,7 @@ private void SetVisibilities() ViewModel.DetailsSectionVisibility_GPS = GetVisibility("System.GPS", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed; ViewModel.DetailsSectionVisibility_Photo = GetVisibility("System.Photo", ViewModel.SystemFileProperties_RO) && GetVisibility("System.Photo", ViewModel.SystemFileProperties_RW) ? Visibility.Visible : Visibility.Collapsed; ViewModel.DetailsSectionVisibility_Image = GetVisibility("System.Image", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed; + ViewModel.DetailsSectionVisibility_Audio = GetVisibility("System.Audio", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed; } private bool GetVisibility(string endpoint, IDictionary dict) diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs index fdd4ef81a14e..dc57b8e7e1e1 100644 --- a/Files/View Models/SelectedItemsPropertiesViewModel.cs +++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs @@ -732,5 +732,12 @@ public Visibility DetailsSectionVisibility_Photo get => _DetailsSectionVisibility_Photo; set => SetProperty(ref _DetailsSectionVisibility_Photo, value); } + + private Visibility _DetailsSectionVisibility_Audio; + public Visibility DetailsSectionVisibility_Audio + { + get => _DetailsSectionVisibility_Audio; + set => SetProperty(ref _DetailsSectionVisibility_Audio, value); + } } } \ No newline at end of file diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml index 7cbc87f269ad..57f47a0f5091 100644 --- a/Files/Views/Pages/PropertiesDetails.xaml +++ b/Files/Views/Pages/PropertiesDetails.xaml @@ -362,7 +362,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +