public async void GetOtherProperties(IStorageItemExtraProperties properties) { string dateAccessedProperty = "System.DateAccessed"; List <string> propertiesName = new List <string>(); propertiesName.Add(dateAccessedProperty); IDictionary <string, object> extraProperties = await properties.RetrievePropertiesAsync(propertiesName); // Cannot get date and owner in MTP devices ViewModel.ItemAccessedTimestamp = dateTimeFormatter.ToShortLabel((DateTimeOffset)(extraProperties[dateAccessedProperty] ?? DateTimeOffset.Now)); }
public async void GetOtherProperties(IStorageItemExtraProperties properties) { string dateAccessedProperty = "System.DateAccessed"; List <string> propertiesName = new List <string>(); propertiesName.Add(dateAccessedProperty); IDictionary <string, object> extraProperties = await properties.RetrievePropertiesAsync(propertiesName); ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; string returnformat = Enum.Parse <TimeStyle>(localSettings.Values[Constants.LocalSettings.DateTimeFormat].ToString()) == TimeStyle.Application ? "D" : "g"; // Cannot get date and owner in MTP devices ViewModel.ItemAccessedTimestamp = ((DateTimeOffset)(extraProperties[dateAccessedProperty] ?? DateTimeOffset.Now)).GetFriendlyDateFromFormat(returnformat); }