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/LayoutModes/PropertiesDetailsImage.xaml.cs b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs
new file mode 100644
index 000000000000..b89b29cf16c9
--- /dev/null
+++ b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs
@@ -0,0 +1,85 @@
+using Files.Filesystem;
+using Files.View_Models;
+using Files.View_Models.Properties;
+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;
+
+ if (np.navParameter is ListedItem)
+ {
+ 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);
+ }
+ }
+ else if (np.navParameter is List)
+ {
+ BaseProperties = new CombinedProperties(ViewModel, np.tokenSource, Dispatcher, np.navParameter as List);
+ }
+ else if (np.navParameter is DriveItem)
+ {
+ BaseProperties = new DriveProperties(ViewModel, np.navParameter as DriveItem);
+ }
+
+ base.OnNavigatedTo(e);
+ }
+
+ public string GetCameraName()
+ {
+ return ViewModel.CameraManufacturer + " " + ViewModel.CameraModel;
+ }
+
+ public string GetImageSize()
+ {
+ return ViewModel.ImageWidth + "x" + ViewModel.ImageHeight;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Files/Views/Pages/Properties.xaml b/Files/Views/Pages/Properties.xaml
index 7420e948ba21..1f4b5aa759e4 100644
--- a/Files/Views/Pages/Properties.xaml
+++ b/Files/Views/Pages/Properties.xaml
@@ -60,6 +60,17 @@
+
+
+
+
+
+
diff --git a/Files/Views/Pages/Properties.xaml.cs b/Files/Views/Pages/Properties.xaml.cs
index e4ba444d5cd2..1b507407fd29 100644
--- a/Files/Views/Pages/Properties.xaml.cs
+++ b/Files/Views/Pages/Properties.xaml.cs
@@ -38,6 +38,7 @@ 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.SetBackground();
base.OnNavigatedTo(e);
}
@@ -199,6 +200,12 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
case "Shortcut":
contentFrame.Navigate(typeof(PropertiesShortcut), navParam, args.RecommendedNavigationTransitionInfo);
break;
+
+ case "Image":
+ contentFrame.Navigate(typeof(PropertiesDetailsImage), navParam, args.RecommendedNavigationTransitionInfo);
+ break;
+
+
}
}
diff --git a/Files/Views/Pages/PropertiesDetailsImage.xaml b/Files/Views/Pages/PropertiesDetailsImage.xaml
new file mode 100644
index 000000000000..6f75f160734a
--- /dev/null
+++ b/Files/Views/Pages/PropertiesDetailsImage.xaml
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Files/Views/Pages/PropertiesDetailsImage.xaml.cs b/Files/Views/Pages/PropertiesDetailsImage.xaml.cs
new file mode 100644
index 000000000000..eb1ad08674a0
--- /dev/null
+++ b/Files/Views/Pages/PropertiesDetailsImage.xaml.cs
@@ -0,0 +1,75 @@
+using Files.Filesystem;
+using Files.View_Models;
+using Files.View_Models.Properties;
+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;
+
+ if (np.navParameter is ListedItem)
+ {
+ 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);
+ }
+ }
+ else if (np.navParameter is List)
+ {
+ BaseProperties = new CombinedProperties(ViewModel, np.tokenSource, Dispatcher, np.navParameter as List);
+ }
+ else if (np.navParameter is DriveItem)
+ {
+ BaseProperties = new DriveProperties(ViewModel, np.navParameter as DriveItem);
+ }
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
\ No newline at end of file
From abd36f2f6d36d560e7b3a2d135b2f84126542aaa Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Thu, 20 Aug 2020 18:51:18 -0700
Subject: [PATCH 02/66] Added more properties to image details page
---
Files/Files.csproj | 5 +-
Files/Filesystem/ListedItem.cs | 25 +
Files/Filesystem/PropertiesData.cs | 29 ++
.../View Models/Properties/FileProperties.cs | 88 +++-
.../SelectedItemsPropertiesViewModel.cs | 151 ++++--
.../LayoutModes/PropertiesDetailsImage.xaml | 230 ---------
.../PropertiesDetailsImage.xaml.cs | 85 ----
.../DetailsPages/PropertiesDetailsImage.xaml | 475 ++++++++++++++++++
.../PropertiesDetailsImage.xaml.cs | 86 ++++
Files/Views/Pages/Properties.xaml | 4 +-
Files/Views/Pages/Properties.xaml.cs | 3 +-
Files/Views/Pages/PropertiesDetailsImage.xaml | 208 --------
.../Pages/PropertiesDetailsImage.xaml.cs | 75 ---
13 files changed, 814 insertions(+), 650 deletions(-)
create mode 100644 Files/Filesystem/PropertiesData.cs
delete mode 100644 Files/Views/LayoutModes/PropertiesDetailsImage.xaml
delete mode 100644 Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs
create mode 100644 Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
create mode 100644 Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml.cs
delete mode 100644 Files/Views/Pages/PropertiesDetailsImage.xaml
delete mode 100644 Files/Views/Pages/PropertiesDetailsImage.xaml.cs
diff --git a/Files/Files.csproj b/Files/Files.csproj
index eca21ea0e94b..82afa2acf3e5 100644
--- a/Files/Files.csproj
+++ b/Files/Files.csproj
@@ -167,6 +167,7 @@
ConfirmDeleteDialog.xaml
+
@@ -271,7 +272,7 @@
GridViewBrowser.xaml
-
+
PropertiesDetailsImage.xaml
@@ -517,7 +518,7 @@
Designer
MSBuild:Compile
-
+
MSBuild:Compile
Designer
diff --git a/Files/Filesystem/ListedItem.cs b/Files/Filesystem/ListedItem.cs
index df55d13af364..51f127dc117a 100644
--- a/Files/Filesystem/ListedItem.cs
+++ b/Files/Filesystem/ListedItem.cs
@@ -152,6 +152,22 @@ 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;
@@ -227,4 +243,13 @@ 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/Filesystem/PropertiesData.cs b/Files/Filesystem/PropertiesData.cs
new file mode 100644
index 000000000000..968f7327c149
--- /dev/null
+++ b/Files/Filesystem/PropertiesData.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml;
+
+namespace Files.Filesystem
+{
+ public class PropertiesData
+ {
+ public string Text { get; set; } = "Test:";
+ public string Property { get; set; }
+ public object Data { get; set; }
+ public Visibility Visibility { get; set; } = Visibility.Visible;
+
+ public PropertiesData(string property, string text)
+ {
+ Property = property;
+ Text = text;
+ }
+
+ public PropertiesData(string property, object data)
+ {
+ Property = property;
+ Data = data;
+ }
+ }
+}
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 818b2a761e21..7e9c67a218be 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -2,14 +2,18 @@
using Files.Filesystem;
using Files.Helpers;
using Microsoft.Toolkit.Mvvm.Input;
+using Microsoft.Toolkit.Uwp.UI.Extensions;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
+using Windows.Devices.Geolocation;
using Windows.Foundation.Collections;
using Windows.Security.Cryptography.Core;
+using Windows.Services.Maps;
using Windows.Storage;
using Windows.Storage.FileProperties;
using Windows.UI.Core;
@@ -205,29 +209,107 @@ public override async void GetSpecialProperties()
{
file = await ItemViewModel.GetFileFromPathAsync((Item as ShortcutItem)?.TargetPath ?? Item.ItemPath);
imageProperties = await file.Properties.GetImagePropertiesAsync();
- } catch(Exception ex)
+ }
+ catch (Exception ex)
{
NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
// Could not access file, can't show any other property
return;
}
+ //List of properties to retrieve
+ List moreProperties = new List() {
+ "System.Image.BitDepth",
+ "System.Photo.ExposureTime",
+ "System.Photo.FocalLength",
+ "System.Photo.Aperture",
+ };
+
+ IDictionary extraProperties;
+ List propertiesDatas = new List();
+
+ try
+ {
+ // Get the specified properties through StorageFile.Properties
+ extraProperties = await file.Properties.RetrievePropertiesAsync(moreProperties);
+ }
+ catch (Exception ex)
+ {
+ NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
+ // Well this blew up
+ return;
+ }
+
ViewModel.DateTaken = imageProperties.DateTaken;
ViewModel.CameraModel = imageProperties.CameraModel;
ViewModel.CameraManufacturer = imageProperties.CameraManufacturer;
- ViewModel.ImageWidth = (int) imageProperties.Width;
+ ViewModel.ImageWidth = (int)imageProperties.Width;
ViewModel.ImageHeight = (int)imageProperties.Height;
+ ViewModel.DimensionString = ViewModel.ImageWidth + "x" + ViewModel.ImageHeight;
+ ViewModel.DimensionsTooltip = "Width: " + ViewModel.ImageWidth + "px\nHeight: " + ViewModel.ImageHeight + "px";
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.CameraNameString = string.Format("{0} {1}", ViewModel.CameraManufacturer, ViewModel.CameraModel);
+
+ foreach (string str in ViewModel.ImageKeywords)
+ ViewModel.Tags += str + "; ";
+
+ ViewModel.ShowTitle = ViewModel.ImageTitle.Equals("") ? Visibility.Collapsed : Visibility.Visible;
+
+ ViewModel.RatingReal = ViewModel.Rating / 20.00 == 0.0 ? -1 : ViewModel.Rating / 20.00;
+
//ViewModel.People = (System.Collections.Generic.IList) imageProperties.PeopleNames;
+ if (ViewModel.Longitude != null && ViewModel.Latitude != null)
+ {
+ 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);
+ }
+ }
+ else
+ {
+ ViewModel.ShowGeotag = Visibility.Collapsed;
+ }
+
+
+ var propValue = extraProperties[moreProperties[0]];
+ if (propValue != null)
+ {
+ ViewModel.BitDepth = Convert.ToInt32(propValue);
+ }
+
+ if (extraProperties[moreProperties[1]] != null && extraProperties[moreProperties[2]] != null && extraProperties[moreProperties[3]] != null)
+ {
+ ViewModel.ShotString = string.Format("{0} sec. f/{1} {2}mm", extraProperties[moreProperties[1]], extraProperties[moreProperties[2]], extraProperties[moreProperties[3]]);
+ }
+
}
+
+
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 0b26937a1cb5..ef5cd610e863 100644
--- a/Files/View Models/SelectedItemsPropertiesViewModel.cs
+++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs
@@ -1,4 +1,5 @@
using ByteSizeLib;
+using Files.Filesystem;
using Files.Helpers;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -6,6 +7,8 @@
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.Core;
+using Windows.Devices.Geolocation;
+using Windows.Services.Maps;
using Windows.Storage.FileProperties;
using Windows.UI.Core;
using Windows.UI.Xaml;
@@ -620,23 +623,24 @@ public Uri FolderIconSource
public int ImageWidth
{
get => _ImageWidth;
- set
- {
- SetProperty(ref _ImageWidth, value);
- OnPropertyChanged("GetImageSizeString");
- }
+ set => SetProperty(ref _ImageWidth, value);
+
}
private int _ImageHeight;
public int ImageHeight
{
get => _ImageHeight;
- set
- {
- SetProperty(ref _ImageHeight, value);
- OnPropertyChanged("GetImageSizeString");
- }
+ set => SetProperty(ref _ImageHeight, value);
+ }
+
+ private string _DimensionString;
+ public string DimensionString
+ {
+ get => _DimensionString;
+ set => SetProperty(ref _DimensionString, value);
}
+
private DateTimeOffset _DateTaken;
public DateTimeOffset DateTaken
{
@@ -657,56 +661,49 @@ public string ImageTitle
public System.Nullable Longitude
{
get => _Longitude;
- set
- {
- SetProperty(ref _Longitude, value);
- OnPropertyChanged("ShowCoordinates");
- OnPropertyChanged("GetCoordinatesString");
- }
+ set => SetProperty(ref _Longitude, value);
}
private System.Nullable _Latitude;
public System.Nullable Latitude
{
get => _Latitude;
- set {
- SetProperty(ref _Latitude, value);
- OnPropertyChanged("ShowCoordinates");
- OnPropertyChanged("GetCoordinatesString");
- }
+ set => SetProperty(ref _Latitude, value);
}
private string _CameraModel;
public string CameraModel
{
get => _CameraModel;
- set
- {
- SetProperty(ref _CameraModel, value);
- OnPropertyChanged("GetCameraString");
- }
+ set => SetProperty(ref _CameraModel, value);
}
private string _CameraManufacturer;
public string CameraManufacturer
{
get => _CameraManufacturer;
- set
- {
- SetProperty(ref _CameraManufacturer, value);
- OnPropertyChanged("GetCameraString");
- }
+ set => SetProperty(ref _CameraManufacturer, value);
}
private int _Rating;
public int Rating
{
get => _Rating;
- set
- {
- SetProperty(ref _Rating, value);
- OnPropertyChanged("GetRatingReal");
- }
+ set => SetProperty(ref _Rating, value);
+ }
+
+ private MapLocation _Geopoint;
+ public MapLocation Geopoint
+ {
+ get => _Geopoint;
+ set => SetProperty(ref _Geopoint, value);
+ }
+
+ private string _GeopointString;
+ public string GeopointString
+ {
+ get => _GeopointString;
+ set => SetProperty(ref _GeopointString, value);
}
public Visibility ShowCoordinates
@@ -734,22 +731,88 @@ public string GetImageSizeString()
return ImageWidth + " x " + ImageHeight;
}
- public string GetCameraString()
+ private double _RatingReal;
+ public double RatingReal
+ {
+ get => _RatingReal;
+ set => SetProperty(ref _RatingReal, value);
+ }
+
+ private string _CoordinatesString;
+ public string CoordinatesString
+ {
+ get => _CoordinatesString;
+ set => SetProperty(ref _CoordinatesString, value);
+ }
+
+ private string _CameraNameString;
+ public string CameraNameString
{
- return CameraManufacturer + " " + CameraModel;
+ get => _CameraNameString;
+ set => SetProperty(ref _CameraNameString, value);
}
- public int GetRatingReal()
+ private Visibility _ShowGeotag;
+ public Visibility ShowGeotag
{
- return (_Rating / 20) - 1;
+ get => _ShowGeotag;
+ set => SetProperty(ref _ShowGeotag, value);
}
- public string GetCoordinatesString()
+ private Visibility _ShowTitle;
+ public Visibility ShowTitle
{
- if(Longitude != null && Latitude != null)
- return Longitude + ", " + Latitude;
+ get => _ShowTitle;
+ set => SetProperty(ref _ShowTitle, value);
+ }
+
+ private string _Tags;
+ public string Tags
+ {
+ get => _Tags;
+ set => SetProperty(ref _Tags, value);
+ }
+
+ private string _DimensionsTooltip;
+ public string DimensionsTooltip
+ {
+ get => _DimensionsTooltip;
+ set => SetProperty(ref _DimensionsTooltip, value);
+ }
- return "";
+ private int _BitDepth;
+ public int BitDepth
+ {
+ get => _BitDepth;
+ set => SetProperty(ref _BitDepth, value);
+ }
+
+ private string _ShotString;
+ public string ShotString
+ {
+ get => _ShotString;
+ set => SetProperty(ref _ShotString, value);
+ }
+
+ private List _ImageInformation;
+ public List ImageInformation
+ {
+ get => _ImageInformation;
+ set => SetProperty(ref _ImageInformation, value);
+ }
+
+ private Visibility _BasicDetailsVisibility;
+ public Visibility BasicDetailsVisibility
+ {
+ get => _BasicDetailsVisibility;
+ set => SetProperty(ref _BasicDetailsVisibility, value);
+ }
+
+ private Visibility _AllDetailsVisibility;
+ public Visibility AllDetailsVisibility
+ {
+ get => _AllDetailsVisibility;
+ set => SetProperty(ref _AllDetailsVisibility, value);
}
}
diff --git a/Files/Views/LayoutModes/PropertiesDetailsImage.xaml b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml
deleted file mode 100644
index 8f8df6cb4511..000000000000
--- a/Files/Views/LayoutModes/PropertiesDetailsImage.xaml
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs b/Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs
deleted file mode 100644
index b89b29cf16c9..000000000000
--- a/Files/Views/LayoutModes/PropertiesDetailsImage.xaml.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Files.Filesystem;
-using Files.View_Models;
-using Files.View_Models.Properties;
-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;
-
- if (np.navParameter is ListedItem)
- {
- 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);
- }
- }
- else if (np.navParameter is List)
- {
- BaseProperties = new CombinedProperties(ViewModel, np.tokenSource, Dispatcher, np.navParameter as List);
- }
- else if (np.navParameter is DriveItem)
- {
- BaseProperties = new DriveProperties(ViewModel, np.navParameter as DriveItem);
- }
-
- base.OnNavigatedTo(e);
- }
-
- public string GetCameraName()
- {
- return ViewModel.CameraManufacturer + " " + ViewModel.CameraModel;
- }
-
- public string GetImageSize()
- {
- return ViewModel.ImageWidth + "x" + ViewModel.ImageHeight;
- }
- }
-}
\ No newline at end of file
diff --git a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
new file mode 100644
index 000000000000..9a493e150055
--- /dev/null
+++ b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
@@ -0,0 +1,475 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Files/Views/Pages/PropertiesDetailsImage.xaml.cs b/Files/Views/Pages/PropertiesDetailsImage.xaml.cs
deleted file mode 100644
index eb1ad08674a0..000000000000
--- a/Files/Views/Pages/PropertiesDetailsImage.xaml.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using Files.Filesystem;
-using Files.View_Models;
-using Files.View_Models.Properties;
-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;
-
- if (np.navParameter is ListedItem)
- {
- 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);
- }
- }
- else if (np.navParameter is List)
- {
- BaseProperties = new CombinedProperties(ViewModel, np.tokenSource, Dispatcher, np.navParameter as List);
- }
- else if (np.navParameter is DriveItem)
- {
- BaseProperties = new DriveProperties(ViewModel, np.navParameter as DriveItem);
- }
-
- base.OnNavigatedTo(e);
- }
- }
-}
\ No newline at end of file
From b4793450fa738c4bfc6e10c4050c98028083fbc2 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Sun, 23 Aug 2020 20:57:50 -0700
Subject: [PATCH 03/66] Remade details view
---
.../View Models/Properties/FileProperties.cs | 1 +
.../DetailsPages/PropertiesDetailsImage.xaml | 692 ++++++++++--------
.../PropertiesDetailsImage.xaml.cs | 9 +-
3 files changed, 375 insertions(+), 327 deletions(-)
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 7e9c67a218be..bfa7ef6146bf 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -226,6 +226,7 @@ public override async void GetSpecialProperties()
};
IDictionary extraProperties;
+ IDictionary extraProperties2;
List propertiesDatas = new List();
try
diff --git a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
index 9a493e150055..94b219e525f9 100644
--- a/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
+++ b/Files/Views/Pages/DetailsPages/PropertiesDetailsImage.xaml
@@ -29,17 +29,15 @@
-
-
-
-
-
-
-
-
+
+
+
+
-
@@ -65,13 +63,28 @@
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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 @@
-
\ 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 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 0fb8926c7e55aed148e57dad931d236f787bba00 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Fri, 25 Sep 2020 17:41:49 -0700
Subject: [PATCH 54/66] Added music properties
Note: this code doesn't work properly due to an issue displaying string arrays.
---
.../View Models/Properties/FileProperties.cs | 21 ++++++-
.../SelectedItemsPropertiesViewModel.cs | 7 +++
Files/Views/Pages/PropertiesDetails.xaml | 56 ++++++++++++++++++-
Files/Views/Pages/PropertiesDetails.xaml.cs | 7 ++-
4 files changed, 85 insertions(+), 6 deletions(-)
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index a6d88b3870f1..c4092d0cfb2a 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -30,7 +30,7 @@
namespace Files.View_Models.Properties
{
- internal class FileProperties : BaseProperties
+ public class FileProperties : BaseProperties
{
private ProgressBar ProgressBar;
@@ -75,17 +75,33 @@ internal class FileProperties : BaseProperties
"System.Audio.Format",
"System.Audio.SampleRate",
+ //Music
+ "System.Music.DisplayArtist",
};
private readonly List PropertiesToGet_RW = new List()
{
+ //Core
"System.Title",
"System.Subject",
"System.Comment",
"System.Copyright",
+ //Photo
"System.Photo.CameraManufacturer",
"System.Photo.CameraModel",
+
+ //Music
+ "System.Music.AlbumArtist",
+ "System.Music.AlbumTitle",
+ "System.Music.AlbumID",
+ "System.Music.Artist",
+ "System.Music.BeatsPerMinute",
+ "System.Music.Composer",
+ "System.Music.Conductor",
+ "System.Music.DiscNumber",
+ "System.Music.Genre",
+ "System.Music.TrackNumber",
};
///
@@ -238,8 +254,6 @@ public override async void GetSpecialProperties()
NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
ViewModel.ItemMD5HashCalcError = true;
}
-
- GetSystemFileProperties();
}
public async void GetSystemFileProperties()
@@ -327,6 +341,7 @@ private void SetVisibilities()
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;
+ ViewModel.DetailsSectionVisibility_Audio = GetVisibility("System.Music", 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 dc57b8e7e1e1..4838de8af8fd 100644
--- a/Files/View Models/SelectedItemsPropertiesViewModel.cs
+++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs
@@ -739,5 +739,12 @@ public Visibility DetailsSectionVisibility_Audio
get => _DetailsSectionVisibility_Audio;
set => SetProperty(ref _DetailsSectionVisibility_Audio, value);
}
+
+ private Visibility _DetailsSectionVisibility_Music;
+ public Visibility DetailsSectionVisibility_Music
+ {
+ get => _DetailsSectionVisibility_Music;
+ set => SetProperty(ref _DetailsSectionVisibility_Music, value);
+ }
}
}
\ No newline at end of file
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index 57f47a0f5091..e6953239169e 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -364,8 +364,8 @@
-
-
+
+
@@ -394,6 +394,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs
index 2f7dba33ead9..6e3713fcdd13 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml.cs
+++ b/Files/Views/Pages/PropertiesDetails.xaml.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
@@ -33,7 +34,7 @@ namespace Files
///
public sealed partial class PropertiesDetails : Page
{
- public BaseProperties BaseProperties { get; set; }
+ public FileProperties BaseProperties { get; set; }
public SelectedItemsPropertiesViewModel ViewModel { get; set; }
@@ -47,6 +48,10 @@ private void Properties_Loaded(object sender, RoutedEventArgs e)
if (BaseProperties != null)
{
BaseProperties.GetSpecialProperties();
+ Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew();
+ BaseProperties.GetSystemFileProperties();
+ stopwatch.Stop();
+ Debug.WriteLine(string.Format("System file properties were obtained in {0} milliseconds", stopwatch.ElapsedMilliseconds));
}
}
From a703c14a2a048ebc9b9d23880228fed8c2c833b9 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Fri, 25 Sep 2020 19:41:45 -0700
Subject: [PATCH 55/66] Added converter for string[] to string
This is for certain file properties. Music properties will now work properly.
---
Files/Converters/StringArrayToString.cs | 31 ++++++++++++++++++++
Files/Files.csproj | 1 +
Files/Views/Pages/PropertiesDetails.xaml | 32 +++++++++++++--------
Files/Views/Pages/PropertiesDetails.xaml.cs | 17 +++++++++++
4 files changed, 69 insertions(+), 12 deletions(-)
create mode 100644 Files/Converters/StringArrayToString.cs
diff --git a/Files/Converters/StringArrayToString.cs b/Files/Converters/StringArrayToString.cs
new file mode 100644
index 000000000000..e799184fe47a
--- /dev/null
+++ b/Files/Converters/StringArrayToString.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Data;
+
+namespace Files.Converters
+{
+ class StringArrayToString : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ var array = value as string[];
+
+ if (array == null || !(array is string[]))
+ return "";
+
+ var str = "";
+ foreach (var i in array as string[])
+ str += string.Format("{0}; ", i);
+
+ return str;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ return (value as string).Split("; ");
+ }
+ }
+}
diff --git a/Files/Files.csproj b/Files/Files.csproj
index d497461a490b..e77126daa560 100644
--- a/Files/Files.csproj
+++ b/Files/Files.csproj
@@ -160,6 +160,7 @@
+
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index e6953239169e..1625c8f550ad 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -6,13 +6,17 @@
xmlns:local="using:Files.Views.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:filesystem="using:Files.Filesystem"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
- xmlns:sys="using:System"
+ xmlns:convert="using:System.Convert" xmlns:usercontrols="using:Files.UserControls"
+ xmlns:converters="using:Files.Converters"
Loaded="Properties_Loaded"
mc:Ignorable="d"
Name="Page"
d:DesignHeight="3000">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Files/UserControls/PropertyListItem.xaml.cs b/Files/UserControls/PropertyListItem.xaml.cs
new file mode 100644
index 000000000000..a0c14690ca8e
--- /dev/null
+++ b/Files/UserControls/PropertyListItem.xaml.cs
@@ -0,0 +1,43 @@
+using Files.View_Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+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;
+
+// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
+
+namespace Files.UserControls
+{
+ public sealed partial class PropertyListItem : UserControl
+ {
+ public GridLength ColumnWidth { get; set; }
+
+ public string Text { get; set; }
+
+ public static readonly DependencyProperty ValueTextProperty = DependencyProperty.Register("ValueText", typeof(string), typeof(PropertyListItem), null);
+ public string ValueText
+ {
+ get => GetValue(ValueTextProperty) as string;
+ set => SetValue(ValueTextProperty, value as string);
+ }
+
+ public bool IsReadOnly { get; set; }
+
+ public PropertyListItem()
+ {
+ this.InitializeComponent();
+
+ }
+ }
+}
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 4bb3556e5264..639227046911 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -1,4 +1,5 @@
using ByteSizeLib;
+using Files.Converters;
using Files.Filesystem;
using Files.Helpers;
using Microsoft.Graphics.Canvas.Text;
@@ -79,6 +80,12 @@ public class FileProperties : BaseProperties
//Music
"System.Music.AlbumID",
"System.Music.DisplayArtist",
+
+ //Media
+ "System.Media.AverageLevel",
+ "System.Media.Duration",
+ "System.Media.FrameCount",
+ "System.Media.ProtectionType",
};
private readonly List PropertiesToGet_RW = new List()
@@ -103,6 +110,32 @@ public class FileProperties : BaseProperties
"System.Music.DiscNumber",
"System.Music.Genre",
"System.Music.TrackNumber",
+
+ //Media
+ "System.Media.AuthorUrl",
+ "System.Media.ContentDistributor",
+ "System.Media.CreatorApplication",
+ "System.Media.DateReleased",
+ "System.Media.DlnaProfileID",
+ "System.Media.DVDID",
+ "System.Media.EncodedBy",
+ "System.Media.EncodingSettings",
+ "System.Media.SeriesName",
+ "System.Media.SeasonNumber",
+ "System.Media.EpisodeNumber",
+ "System.Media.MCDI",
+ "System.Media.Producer",
+ "System.Media.PromotionUrl",
+ "System.Media.ProviderStyle",
+ "System.Media.Publisher",
+ "System.Media.ThumbnailLargePath",
+ "System.Media.ThumbnailLargeUri",
+ "System.Media.ThumbnailSmallPath",
+ "System.Media.ThumbnailSmallUri",
+ "System.Media.UniqueFileIdentifier",
+ "System.Media.UserWebUrl",
+ "System.Media.Writer",
+ "System.Media.Year",
};
///
@@ -278,6 +311,7 @@ public async void GetSystemFileProperties()
{
ViewModel.SystemFileProperties_RO = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RO);
ViewModel.SystemFileProperties_RW = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RW);
+ //GetPropertiesAsyncDebug(file);
}
catch (Exception e)
{
@@ -339,14 +373,20 @@ private async void ViewModelProcessing()
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;
- ViewModel.DetailsSectionVisibility_Audio = GetVisibility("System.Music", ViewModel.SystemFileProperties_RO) ? Visibility.Visible : Visibility.Collapsed;
+ ViewModel.DetailsSectionVisibility_GPS = CheckVisibility("System.GPS");
+ ViewModel.DetailsSectionVisibility_Photo = CheckVisibility("System.Photo");
+ ViewModel.DetailsSectionVisibility_Image = CheckVisibility("System.Image");
+ ViewModel.DetailsSectionVisibility_Audio = CheckVisibility("System.Audio");
+ ViewModel.DetailsSectionVisibility_Music = CheckVisibility("System.Music");
+ ViewModel.DetailsSectionVisibility_Media = CheckVisibility("System.Media");
}
- private bool GetVisibility(string endpoint, IDictionary dict)
+ private Visibility CheckVisibility(string endpoint)
+ {
+ return CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RO) && CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RW) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ private bool CheckVisibilityHelper(string endpoint, IDictionary dict)
{
foreach (KeyValuePair pair in dict)
if (pair.Key.Contains(endpoint) && pair.Value != null)
@@ -420,6 +460,53 @@ private async void SavePropertiesAsyncDebug(StorageFile file)
}
}
+ ///
+ /// This function is for debug purposes only.
+ ///
+ ///
+ private async void GetPropertiesAsyncDebug(StorageFile file)
+ {
+ foreach (var item in PropertiesToGet_RW)
+ {
+ IDictionary result;
+ try
+ {
+ var temp = new List()
+ {
+ item
+ };
+ result = (await file.Properties.RetrievePropertiesAsync(temp));
+ var tempDict = ViewModel.SystemFileProperties_RW;
+ tempDict[item] = result[item];
+ ViewModel.SystemFileProperties_RW = tempDict;
+ }
+ catch (Exception reee)
+ {
+ Debug.WriteLine(string.Format("{0}\n{1}", item, reee.ToString()));
+ }
+ }
+
+ foreach (var item in PropertiesToGet_RO)
+ {
+ IDictionary result;
+ try
+ {
+ var temp = new List()
+ {
+ item
+ };
+ result = (await file.Properties.RetrievePropertiesAsync(temp));
+ var tempDict = ViewModel.SystemFileProperties_RO;
+ tempDict[item] = result[item];
+ ViewModel.SystemFileProperties_RO = tempDict;
+ }
+ catch (Exception reee)
+ {
+ Debug.WriteLine(string.Format("{0}\n{1}", item, reee.ToString()));
+ }
+ }
+ }
+
///
/// This function goes through ever read-write property saved, then syncs it
///
diff --git a/Files/View Models/SelectedItemsPropertiesViewModel.cs b/Files/View Models/SelectedItemsPropertiesViewModel.cs
index 4838de8af8fd..754d4b8e6097 100644
--- a/Files/View Models/SelectedItemsPropertiesViewModel.cs
+++ b/Files/View Models/SelectedItemsPropertiesViewModel.cs
@@ -2,6 +2,7 @@
using Files.Filesystem;
using Files.Helpers;
using Files.View_Models.Properties;
+using Files.Views.Pages;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Toolkit.Uwp.Helpers;
@@ -746,5 +747,12 @@ public Visibility DetailsSectionVisibility_Music
get => _DetailsSectionVisibility_Music;
set => SetProperty(ref _DetailsSectionVisibility_Music, value);
}
+
+ private Visibility _DetailsSectionVisibility_Media;
+ public Visibility DetailsSectionVisibility_Media
+ {
+ get => _DetailsSectionVisibility_Media;
+ set => SetProperty(ref _DetailsSectionVisibility_Media, value);
+ }
}
}
\ No newline at end of file
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index 9f57e7f1585b..80255f192159 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -211,7 +211,6 @@
-
@@ -455,6 +454,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Files/Views/Pages/PropertiesDetails.xaml.cs b/Files/Views/Pages/PropertiesDetails.xaml.cs
index 23128def202f..b8411dc7b0fa 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml.cs
+++ b/Files/Views/Pages/PropertiesDetails.xaml.cs
@@ -1,6 +1,7 @@
using Files.Filesystem;
using Files.View_Models;
using Files.View_Models.Properties;
+using Files.Views.Pages;
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.Toolkit.Uwp.UI.Converters;
using System;
@@ -38,6 +39,7 @@ public sealed partial class PropertiesDetails : Page
public SelectedItemsPropertiesViewModel ViewModel { get; set; }
+
public PropertiesDetails()
{
this.InitializeComponent();
From 50b0b338082782c21067dbbba1198635bc890df7 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Tue, 29 Sep 2020 13:29:36 -0700
Subject: [PATCH 59/66] Added Media Properties
---
Files/Converters/UInt32ToString.cs | 6 +-
Files/UserControls/PropertyListItem.xaml.cs | 7 ++-
.../View Models/Properties/FileProperties.cs | 41 ++++++++++++-
Files/Views/Pages/PropertiesDetails.xaml | 60 +++++++++++--------
4 files changed, 84 insertions(+), 30 deletions(-)
diff --git a/Files/Converters/UInt32ToString.cs b/Files/Converters/UInt32ToString.cs
index 67a475734092..6e3f8ff5e8b7 100644
--- a/Files/Converters/UInt32ToString.cs
+++ b/Files/Converters/UInt32ToString.cs
@@ -11,7 +11,9 @@ class UInt32ToString : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
- return value.ToString();
+ if(value != null)
+ return value.ToString();
+ return "";
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
@@ -22,7 +24,7 @@ public object ConvertBack(object value, Type targetType, object parameter, strin
}
catch (FormatException e)
{
- return (UInt32) 0;
+ return null;
}
}
}
diff --git a/Files/UserControls/PropertyListItem.xaml.cs b/Files/UserControls/PropertyListItem.xaml.cs
index a0c14690ca8e..0d8e6a934cc2 100644
--- a/Files/UserControls/PropertyListItem.xaml.cs
+++ b/Files/UserControls/PropertyListItem.xaml.cs
@@ -21,7 +21,12 @@ namespace Files.UserControls
{
public sealed partial class PropertyListItem : UserControl
{
- public GridLength ColumnWidth { get; set; }
+ public static readonly DependencyProperty ColumnWidthProperty = DependencyProperty.Register("ColumnWidth", typeof(GridLength), typeof(PropertyListItem), null);
+ public GridLength ColumnWidth
+ {
+ get => (GridLength)GetValue(ColumnWidthProperty);
+ set => SetValue(ColumnWidthProperty, (GridLength)value);
+ }
public string Text { get; set; }
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 639227046911..510a9196cb13 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -80,6 +80,7 @@ public class FileProperties : BaseProperties
//Music
"System.Music.AlbumID",
"System.Music.DisplayArtist",
+ "System.Media.CreatorApplication",
//Media
"System.Media.AverageLevel",
@@ -114,7 +115,6 @@ public class FileProperties : BaseProperties
//Media
"System.Media.AuthorUrl",
"System.Media.ContentDistributor",
- "System.Media.CreatorApplication",
"System.Media.DateReleased",
"System.Media.DlnaProfileID",
"System.Media.DVDID",
@@ -307,6 +307,7 @@ public async void GetSystemFileProperties()
//IDictionary ViewModel.SystemFileProperties;
+ //GenerateXAMLCode();
try
{
ViewModel.SystemFileProperties_RO = await file.Properties.RetrievePropertiesAsync(PropertiesToGet_RO);
@@ -532,6 +533,44 @@ public async Task ClearPersonalInformation()
GetSpecialProperties();
}
+ private void GenerateXAMLCode()
+ {
+ var PropsToGen = new List()
+ {
+ "System.Media.AuthorUrl",
+ "System.Media.ContentDistributor",
+ "System.Media.CreatorApplication",
+ "System.Media.DateReleased",
+ "System.Media.DlnaProfileID",
+ "System.Media.DVDID",
+ "System.Media.EncodedBy",
+ "System.Media.EncodingSettings",
+ "System.Media.SeriesName",
+ "System.Media.SeasonNumber",
+ "System.Media.EpisodeNumber",
+ "System.Media.MCDI",
+ "System.Media.Producer",
+ "System.Media.PromotionUrl",
+ "System.Media.ProviderStyle",
+ "System.Media.Publisher",
+ "System.Media.ThumbnailLargePath",
+ "System.Media.ThumbnailLargeUri",
+ "System.Media.ThumbnailSmallPath",
+ "System.Media.ThumbnailSmallUri",
+ "System.Media.UniqueFileIdentifier",
+ "System.Media.UserWebUrl",
+ "System.Media.Writer",
+ "System.Media.Year",
+ };
+
+ foreach (var item in PropsToGen)
+ {
+ var array = item.Split(".");
+ var text = array[array.Length - 1];
+ Debug.WriteLine(string.Format("", item, text));
+ }
+ }
+
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 80255f192159..c5e84d98acf7 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -57,6 +57,10 @@
+
+
@@ -456,32 +460,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 228f24867e43e87d95e20d2369cb17dff10a16b1 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Tue, 29 Sep 2020 18:50:30 -0700
Subject: [PATCH 60/66] Changed files to new Properties List system
Also added read-write to more files abilities
---
Files/Converters/DateTimeOffsetToString.cs | 31 ++
Files/Converters/DoubleToString.cs | 31 ++
Files/Files.csproj | 2 +
.../View Models/Properties/FileProperties.cs | 16 +-
Files/Views/Pages/PropertiesDetails.xaml | 309 ++++--------------
5 files changed, 131 insertions(+), 258 deletions(-)
create mode 100644 Files/Converters/DateTimeOffsetToString.cs
create mode 100644 Files/Converters/DoubleToString.cs
diff --git a/Files/Converters/DateTimeOffsetToString.cs b/Files/Converters/DateTimeOffsetToString.cs
new file mode 100644
index 000000000000..d4556c7eeba0
--- /dev/null
+++ b/Files/Converters/DateTimeOffsetToString.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Data;
+
+namespace Files.Converters
+{
+ class DateTimeOffsetToString : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value != null)
+ return ((DateTimeOffset)value).ToLocalTime().ToString();
+ return "";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ try
+ {
+ return DateTimeOffset.Parse(value as string);
+ }
+ catch (FormatException e)
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Files/Converters/DoubleToString.cs b/Files/Converters/DoubleToString.cs
new file mode 100644
index 000000000000..bf996b7a7903
--- /dev/null
+++ b/Files/Converters/DoubleToString.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Data;
+
+namespace Files.Converters
+{
+ class DoubleToString : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ if (value != null)
+ return value.ToString();
+ return "";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ try
+ {
+ return Double.Parse(value as string);
+ }
+ catch (FormatException e)
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Files/Files.csproj b/Files/Files.csproj
index 213c8d178f99..983a33f9a111 100644
--- a/Files/Files.csproj
+++ b/Files/Files.csproj
@@ -158,6 +158,8 @@
+
+
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 510a9196cb13..91cab3ef558b 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -39,20 +39,18 @@ public class FileProperties : BaseProperties
private readonly List PropertiesToGet_RO = new List()
{
//Core
- "System.Rating",
+ "System.RatingText",
"System.ItemFolderPathDisplay",
- "System.DateCreated",
- "System.DateModified",
- "System.Size",
"System.ItemTypeText",
- "System.FileOwner",
//Image
+ "System.Image.ImageID",
+ "System.Image.CompressedBitsPerPixel",
"System.Image.BitDepth",
"System.Image.Dimensions",
"System.Image.HorizontalResolution",
"System.Image.VerticalResolution",
- "System.Image.Compression",
+ "System.Image.CompressionText",
"System.Image.ResolutionUnit",
"System.Image.HorizontalSize",
"System.Image.VerticalSize",
@@ -96,6 +94,8 @@ public class FileProperties : BaseProperties
"System.Subject",
"System.Comment",
"System.Copyright",
+ "System.DateCreated",
+ "System.DateModified",
//Photo
"System.Photo.CameraManufacturer",
@@ -384,7 +384,7 @@ private void SetVisibilities()
private Visibility CheckVisibility(string endpoint)
{
- return CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RO) && CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RW) ? Visibility.Visible : Visibility.Collapsed;
+ return CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RO) || CheckVisibilityHelper(endpoint, ViewModel.SystemFileProperties_RW) ? Visibility.Visible : Visibility.Collapsed;
}
private bool CheckVisibilityHelper(string endpoint, IDictionary dict)
@@ -565,7 +565,7 @@ private void GenerateXAMLCode()
foreach (var item in PropsToGen)
{
- var array = item.Split(".");
+ var array = item.Split('.');
var text = array[array.Length - 1];
Debug.WriteLine(string.Format("", item, text));
}
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index c5e84d98acf7..19a01552f6dc 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -16,7 +16,8 @@
-
+
+
+
@@ -62,6 +61,10 @@
-
+
+
+
+
+
diff --git a/Files/UserControls/PropertyListItem.xaml.cs b/Files/UserControls/PropertyListItem.xaml.cs
index 0d8e6a934cc2..cc6c0684ddf7 100644
--- a/Files/UserControls/PropertyListItem.xaml.cs
+++ b/Files/UserControls/PropertyListItem.xaml.cs
@@ -44,5 +44,10 @@ public PropertyListItem()
this.InitializeComponent();
}
+
+ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+
+ }
}
}
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index 91cab3ef558b..fbd9febaaf18 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -461,53 +461,6 @@ private async void SavePropertiesAsyncDebug(StorageFile file)
}
}
- ///
- /// This function is for debug purposes only.
- ///
- ///
- private async void GetPropertiesAsyncDebug(StorageFile file)
- {
- foreach (var item in PropertiesToGet_RW)
- {
- IDictionary result;
- try
- {
- var temp = new List()
- {
- item
- };
- result = (await file.Properties.RetrievePropertiesAsync(temp));
- var tempDict = ViewModel.SystemFileProperties_RW;
- tempDict[item] = result[item];
- ViewModel.SystemFileProperties_RW = tempDict;
- }
- catch (Exception reee)
- {
- Debug.WriteLine(string.Format("{0}\n{1}", item, reee.ToString()));
- }
- }
-
- foreach (var item in PropertiesToGet_RO)
- {
- IDictionary result;
- try
- {
- var temp = new List()
- {
- item
- };
- result = (await file.Properties.RetrievePropertiesAsync(temp));
- var tempDict = ViewModel.SystemFileProperties_RO;
- tempDict[item] = result[item];
- ViewModel.SystemFileProperties_RO = tempDict;
- }
- catch (Exception reee)
- {
- Debug.WriteLine(string.Format("{0}\n{1}", item, reee.ToString()));
- }
- }
- }
-
///
/// This function goes through ever read-write property saved, then syncs it
///
@@ -533,44 +486,6 @@ public async Task ClearPersonalInformation()
GetSpecialProperties();
}
- private void GenerateXAMLCode()
- {
- var PropsToGen = new List()
- {
- "System.Media.AuthorUrl",
- "System.Media.ContentDistributor",
- "System.Media.CreatorApplication",
- "System.Media.DateReleased",
- "System.Media.DlnaProfileID",
- "System.Media.DVDID",
- "System.Media.EncodedBy",
- "System.Media.EncodingSettings",
- "System.Media.SeriesName",
- "System.Media.SeasonNumber",
- "System.Media.EpisodeNumber",
- "System.Media.MCDI",
- "System.Media.Producer",
- "System.Media.PromotionUrl",
- "System.Media.ProviderStyle",
- "System.Media.Publisher",
- "System.Media.ThumbnailLargePath",
- "System.Media.ThumbnailLargeUri",
- "System.Media.ThumbnailSmallPath",
- "System.Media.ThumbnailSmallUri",
- "System.Media.UniqueFileIdentifier",
- "System.Media.UserWebUrl",
- "System.Media.Writer",
- "System.Media.Year",
- };
-
- foreach (var item in PropsToGen)
- {
- var array = item.Split('.');
- var text = array[array.Length - 1];
- Debug.WriteLine(string.Format("", item, text));
- }
- }
-
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 19a01552f6dc..da6dd6183b6b 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -17,8 +17,8 @@
-
-
+
+
@@ -79,7 +79,7 @@
x:Name="Icon2"
Grid.Row="0"
Grid.Column="0"
- Width="80"
+ Width="110"
Height="80"
Margin="0,7"
HorizontalAlignment="Stretch"
From 1599aaf57e6f9316eaaf988242a787aebbf44c89 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Wed, 30 Sep 2020 16:01:25 -0700
Subject: [PATCH 62/66] Updated themes for transparent text boxes
---
.../PropertiesStyles.xaml | 40 +++++-
Files/UserControls/PropertyListItem.xaml | 53 ++-----
Files/Views/Pages/PropertiesDetails.xaml | 131 ++++++------------
3 files changed, 91 insertions(+), 133 deletions(-)
diff --git a/Files/ResourceDictionaries/PropertiesStyles.xaml b/Files/ResourceDictionaries/PropertiesStyles.xaml
index f1e9a0d3ffb8..dd70657686df 100644
--- a/Files/ResourceDictionaries/PropertiesStyles.xaml
+++ b/Files/ResourceDictionaries/PropertiesStyles.xaml
@@ -1,4 +1,5 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Files/UserControls/PropertyListItem.xaml b/Files/UserControls/PropertyListItem.xaml
index 623122656fb5..0b898e9687cf 100644
--- a/Files/UserControls/PropertyListItem.xaml
+++ b/Files/UserControls/PropertyListItem.xaml
@@ -10,45 +10,11 @@
d:DesignWidth="400">
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -60,11 +26,8 @@
-
-
-
-
-
-
+
+
+
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index da6dd6183b6b..d3103caf8534 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -14,55 +14,11 @@
d:DesignHeight="3000">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -100,21 +56,21 @@
-
+ x:Name="EmptyImageIcon2"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Stretch"
+ x:Load="{x:Bind ViewModel.LoadUnknownTypeGlyph, Mode=OneWay}"
+ FontFamily="{StaticResource FluentUIGlyphs}"
+ FontSize="70"
+ Glyph="" />
+
+ x:Name="itemFileName2"
+ x:Uid="PropertiesItemFileName"
+ Grid.Row="0"
+ Grid.Column="1"
+ Margin="20,0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ BorderThickness="1"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.ItemName, Mode=OneWay}"
+ Style="{StaticResource PropertyValueTextBox}"
+ Visibility="{x:Bind ViewModel.ItemNameVisibility, Mode=OneWay}" />
@@ -158,23 +115,23 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Date: Wed, 30 Sep 2020 17:08:46 -0700
Subject: [PATCH 63/66] Fixed overview item display issue
---
Files/Views/Pages/PropertiesDetails.xaml | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/Files/Views/Pages/PropertiesDetails.xaml b/Files/Views/Pages/PropertiesDetails.xaml
index d3103caf8534..90e62b3f64d1 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -114,24 +114,24 @@
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
Date: Wed, 30 Sep 2020 17:12:21 -0700
Subject: [PATCH 64/66] Fixed display issue for overview
---
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 90e62b3f64d1..0762cb674749 100644
--- a/Files/Views/Pages/PropertiesDetails.xaml
+++ b/Files/Views/Pages/PropertiesDetails.xaml
@@ -127,7 +127,7 @@
-
+
From d59792611105e2a86ad8f2c40e38970d84401d48 Mon Sep 17 00:00:00 2001
From: null-val <59544401+null-val@users.noreply.github.com>
Date: Thu, 1 Oct 2020 19:20:10 -0700
Subject: [PATCH 65/66] Fixed shot display issue and switched to more reliable
sync method
---
Files/View Models/Properties/FileProperties.cs | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/Files/View Models/Properties/FileProperties.cs b/Files/View Models/Properties/FileProperties.cs
index fbd9febaaf18..84977126cb0a 100644
--- a/Files/View Models/Properties/FileProperties.cs
+++ b/Files/View Models/Properties/FileProperties.cs
@@ -368,7 +368,7 @@ private async void ViewModelProcessing()
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"]);
+ ViewModel.ShotString = string.Format("{0} sec. f/{1} {2}mm", ViewModel.SystemFileProperties_RO["System.Photo.ExposureTime"], ViewModel.SystemFileProperties_RO["System.Photo.Aperture"], ViewModel.SystemFileProperties_RO["System.Photo.FocalLength"]);
}
}
@@ -430,8 +430,7 @@ public async void SyncPropertyChanges()
try
{
file = await ItemViewModel.GetFileFromPathAsync(Item.ItemPath);
- //SavePropertiesAsyncDebug(file);
- await file.Properties.SavePropertiesAsync(ViewModel.SystemFileProperties_RW);
+ SavePropertiesAsync(file);
}
catch (Exception e)
{
@@ -439,11 +438,7 @@ public async void SyncPropertyChanges()
}
}
- ///
- /// This function is for debug purposes, use it to debug "incorrect parameter" errors.
- ///
- ///
- private async void SavePropertiesAsyncDebug(StorageFile file)
+ private async void SavePropertiesAsync(StorageFile file)
{
foreach (KeyValuePair valuePair in ViewModel.SystemFileProperties_RW)
{
From d4461084e8e26bbd53fab69c588abe45928d384b Mon Sep 17 00:00:00 2001
From: Winston de Jong <59544401+winiston2212@users.noreply.github.com>
Date: Wed, 7 Oct 2020 14:14:52 -0700
Subject: [PATCH 66/66] Removed duplicate contains statement
---
Files/Filesystem/ListedItem.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Files/Filesystem/ListedItem.cs b/Files/Filesystem/ListedItem.cs
index 8f4e4dd517e3..d46f3f4d2b77 100644
--- a/Files/Filesystem/ListedItem.cs
+++ b/Files/Filesystem/ListedItem.cs
@@ -155,7 +155,7 @@ 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 lower.Contains("png") || lower.Contains("jpg") || lower.Contains("gif") || lower.Contains("jpeg");
}
return false;
}
@@ -235,4 +235,4 @@ public ShortcutItem(string folderRelativeId) : base(folderRelativeId)
public bool RunAsAdmin { get; set; }
public bool IsUrl { get; set; }
}
-}
\ No newline at end of file
+}