|
6 | 6 | using FluentFTP; |
7 | 7 | using Microsoft.UI.Xaml; |
8 | 8 | using Microsoft.UI.Xaml.Media.Imaging; |
9 | | -using System.Drawing; |
10 | 9 | using System.IO; |
11 | 10 | using System.Text; |
12 | 11 | using Windows.Storage; |
@@ -47,8 +46,8 @@ public string ItemTooltipText |
47 | 46 | tooltipBuilder.Append($"{"ToolTipDescriptionDate".GetLocalizedResource()} {ItemDateModified}"); |
48 | 47 | if (!string.IsNullOrWhiteSpace(FileSize)) |
49 | 48 | tooltipBuilder.Append($"{Environment.NewLine}{"SizeLabel".GetLocalizedResource()} {FileSize}"); |
50 | | - if (SyncStatusUI.SyncStatus is not CloudDriveSyncStatus.FileOnline and not CloudDriveSyncStatus.FolderOnline && !string.IsNullOrWhiteSpace(DimensionsDisplay)) |
51 | | - tooltipBuilder.Append($"{Environment.NewLine}{"PropertyDimensionsColon".GetLocalizedResource()} {DimensionsDisplay}"); |
| 49 | + if (!string.IsNullOrWhiteSpace(ImageDimensions)) |
| 50 | + tooltipBuilder.Append($"{Environment.NewLine}{"PropertyDimensionsColon".GetLocalizedResource()} {ImageDimensions}"); |
52 | 51 | if (SyncStatusUI.LoadSyncStatus) |
53 | 52 | tooltipBuilder.Append($"{Environment.NewLine}{"StatusWithColon".GetLocalizedResource()} {syncStatusUI.SyncStatusString}"); |
54 | 53 |
|
@@ -330,57 +329,36 @@ public ObservableCollection<FileProperty> ItemProperties |
330 | 329 | set => SetProperty(ref itemProperties, value); |
331 | 330 | } |
332 | 331 |
|
333 | | - public string DimensionsDisplay |
| 332 | + private string imageDimensions; |
| 333 | + public string ImageDimensions |
334 | 334 | { |
335 | | - get |
336 | | - { |
337 | | - int imageHeight = 0; |
338 | | - int imageWidth = 0; |
339 | | - |
340 | | - var isImageFile = FileExtensionHelpers.IsImageFile(FileExtension); |
341 | | - if (isImageFile) |
342 | | - { |
343 | | - try |
344 | | - { |
345 | | - // TODO: Switch to use 'System.Kind' instead. |
346 | | - using FileStream fileStream = new(ItemPath, FileMode.Open, FileAccess.Read, FileShare.Read); |
347 | | - using Image image = Image.FromStream(fileStream, false, false); |
348 | | - |
349 | | - if (image is not null) |
350 | | - { |
351 | | - imageHeight = image.Height; |
352 | | - imageWidth = image.Width; |
353 | | - } |
354 | | - } |
355 | | - catch { } |
356 | | - } |
| 335 | + get => imageDimensions; |
| 336 | + set => SetProperty(ref imageDimensions, value); |
| 337 | + } |
357 | 338 |
|
| 339 | + private string fileVersion; |
| 340 | + public string FileVersion |
| 341 | + { |
| 342 | + get => fileVersion; |
| 343 | + set => SetProperty(ref fileVersion, value); |
| 344 | + } |
358 | 345 |
|
359 | | - return |
360 | | - isImageFile && |
361 | | - imageWidth > 0 && |
362 | | - imageHeight > 0 |
363 | | - ? $"{imageWidth} \u00D7 {imageHeight}" |
364 | | - : string.Empty; |
365 | | - } |
| 346 | + private string mediaDuration; |
| 347 | + public string MediaDuration |
| 348 | + { |
| 349 | + get => mediaDuration; |
| 350 | + set => SetProperty(ref mediaDuration, value); |
366 | 351 | } |
367 | 352 |
|
368 | 353 | /// <summary> |
369 | | - /// Contextual property that changes based on the item type |
| 354 | + /// Contextual property that changes based on the item type. |
370 | 355 | /// </summary> |
371 | | - public string ContextualPropertyString => FileExtension switch |
372 | | - { |
373 | | - // Image files are on hold until DimensionsDisplay switches to 'System.Kind', otherwise it causes OneDrive files to be downloaded. |
374 | | - // Images |
375 | | - //_ when FileExtensionHelpers.IsImageFile(FileExtension) => !string.IsNullOrEmpty(DimensionsDisplay) |
376 | | - // ? $"{Strings.PropertyDimensions.GetLocalizedResource()}: {DimensionsDisplay}" |
377 | | - // : string.Empty, |
378 | | - |
379 | | - // Other file formats |
380 | | - _ => !string.IsNullOrEmpty(ItemDateModified) |
381 | | - ? $"{Strings.Modified.GetLocalizedResource()}: {ItemDateModified}" |
382 | | - : string.Empty |
383 | | - }; |
| 356 | + private string contextualProperty; |
| 357 | + public string ContextualProperty |
| 358 | + { |
| 359 | + get => contextualProperty; |
| 360 | + set => SetProperty(ref contextualProperty, value); |
| 361 | + } |
384 | 362 |
|
385 | 363 | /// <summary> |
386 | 364 | /// Initializes a new instance of the <see cref="ListedItem" /> class. |
|
0 commit comments