mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Fix showing enumerations in photo details page.
This commit is contained in:
@@ -255,71 +255,73 @@ public partial class PhotoDetailViewModel : ObservableObject
|
|||||||
PhotoAperture = photo.Aperture != null ? $"f/{photo.Aperture}" : string.Empty;
|
PhotoAperture = photo.Aperture != null ? $"f/{photo.Aperture}" : string.Empty;
|
||||||
PhotoExposureTime = photo.Exposure != null ? $"{photo.Exposure}s" : string.Empty;
|
PhotoExposureTime = photo.Exposure != null ? $"{photo.Exposure}s" : string.Empty;
|
||||||
|
|
||||||
PhotoExposureMode =
|
// Extract ExposureMode - simple nullable integer now
|
||||||
ExtractAndHumanizeEnum(photo.ExposureMethod?.MachinePhotoDtoExposureMethodMember1?.AdditionalData,
|
PhotoExposureMode = photo.ExposureMethod.HasValue
|
||||||
typeof(ExposureMode));
|
? ((ExposureMode)photo.ExposureMethod.Value).Humanize()
|
||||||
|
: string.Empty;
|
||||||
|
|
||||||
PhotoExposureProgram = photo.ExposureProgram?.ExposureProgram != null
|
// Extract ExposureProgram - simple nullable integer now
|
||||||
? ((ExposureProgram)ExtractInt(photo.ExposureProgram.ExposureProgram
|
PhotoExposureProgram = photo.ExposureProgram.HasValue
|
||||||
.AdditionalData)).Humanize()
|
? ((ExposureProgram)photo.ExposureProgram.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoFocalLength = photo.FocalLength != null ? $"{photo.FocalLength}mm" : string.Empty;
|
PhotoFocalLength = photo.FocalLength != null ? $"{photo.FocalLength}mm" : string.Empty;
|
||||||
PhotoFocalLengthEquivalent = photo.FocalEquivalent != null ? $"{photo.FocalEquivalent}mm" : string.Empty;
|
PhotoFocalLengthEquivalent = photo.FocalEquivalent != null ? $"{photo.FocalEquivalent}mm" : string.Empty;
|
||||||
PhotoIsoRating = photo.Iso != null ? photo.Iso.ToString() : string.Empty;
|
PhotoIsoRating = photo.Iso != null ? photo.Iso.ToString() : string.Empty;
|
||||||
|
|
||||||
PhotoFlash = photo.Flash?.Flash != null
|
// Extract Flash - simple nullable integer now
|
||||||
? ((Flash)ExtractInt(photo.Flash.Flash.AdditionalData)).Humanize()
|
PhotoFlash = photo.Flash.HasValue ? ((Flash)photo.Flash.Value).Humanize() : string.Empty;
|
||||||
: string.Empty;
|
|
||||||
|
|
||||||
PhotoLightSource = photo.LightSource?.LightSource != null
|
// Extract LightSource - simple nullable integer now
|
||||||
? ((LightSource)ExtractInt(photo.LightSource.LightSource.AdditionalData)).Humanize()
|
PhotoLightSource = photo.LightSource.HasValue
|
||||||
|
? ((LightSource)photo.LightSource.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoMeteringMode = photo.MeteringMode?.MeteringMode != null
|
// Extract MeteringMode - simple nullable integer now
|
||||||
? ((MeteringMode)ExtractInt(photo.MeteringMode.MeteringMode.AdditionalData))
|
PhotoMeteringMode = photo.MeteringMode.HasValue
|
||||||
.Humanize()
|
? ((MeteringMode)photo.MeteringMode.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoWhiteBalance = photo.WhiteBalance?.WhiteBalance != null
|
// Extract WhiteBalance - simple nullable integer now
|
||||||
? ((WhiteBalance)ExtractInt(photo.WhiteBalance.WhiteBalance.AdditionalData))
|
PhotoWhiteBalance = photo.WhiteBalance.HasValue
|
||||||
.Humanize()
|
? ((WhiteBalance)photo.WhiteBalance.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
// Photo Properties
|
// Photo Properties
|
||||||
PhotoColorSpace = ExtractAndHumanizeEnum(photo.Colorspace?.MachinePhotoDtoColorspaceMember1?.AdditionalData,
|
// Extract ColorSpace - simple nullable integer now
|
||||||
typeof(ColorSpace));
|
PhotoColorSpace = photo.Colorspace.HasValue
|
||||||
|
? ((ColorSpace)photo.Colorspace.Value).Humanize()
|
||||||
PhotoContrast = photo.Contrast?.Contrast != null
|
|
||||||
? ((Contrast)ExtractInt(photo.Contrast.Contrast.AdditionalData)).Humanize()
|
|
||||||
: string.Empty;
|
|
||||||
|
|
||||||
PhotoSaturation = photo.Saturation?.Saturation != null
|
|
||||||
? ((Saturation)ExtractInt(photo.Saturation.Saturation.AdditionalData)).Humanize()
|
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoSharpness = photo.Sharpness?.Sharpness != null
|
// Extract Contrast - simple nullable integer now
|
||||||
? ((Sharpness)ExtractInt(photo.Sharpness.Sharpness.AdditionalData)).Humanize()
|
PhotoContrast = photo.Contrast.HasValue ? ((Contrast)photo.Contrast.Value).Humanize() : string.Empty;
|
||||||
: string.Empty;
|
|
||||||
|
|
||||||
PhotoOrientation = photo.Orientation?.Orientation != null
|
// Extract Saturation - simple nullable integer now
|
||||||
? ((Orientation)ExtractInt(photo.Orientation.Orientation.AdditionalData)).Humanize()
|
PhotoSaturation = photo.Saturation.HasValue
|
||||||
|
? ((Saturation)photo.Saturation.Value).Humanize()
|
||||||
|
: string.Empty;
|
||||||
|
|
||||||
|
// Extract Sharpness - simple nullable integer now
|
||||||
|
PhotoSharpness = photo.Sharpness.HasValue ? ((Sharpness)photo.Sharpness.Value).Humanize() : string.Empty;
|
||||||
|
|
||||||
|
// Extract Orientation - simple nullable integer now
|
||||||
|
PhotoOrientation = photo.Orientation.HasValue
|
||||||
|
? ((Orientation)photo.Orientation.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoSceneCaptureType = photo.SceneCaptureType?.SceneCaptureType != null
|
// Extract SceneCaptureType - simple nullable integer now
|
||||||
? ((SceneCaptureType)ExtractInt(photo.SceneCaptureType.SceneCaptureType
|
PhotoSceneCaptureType = photo.SceneCaptureType.HasValue
|
||||||
.AdditionalData)).Humanize()
|
? ((SceneCaptureType)photo.SceneCaptureType.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoSensingMethod = photo.SensingMethod?.SensingMethod != null
|
// Extract SensingMethod - simple nullable integer now
|
||||||
? ((SensingMethod)ExtractInt(photo.SensingMethod.SensingMethod.AdditionalData))
|
PhotoSensingMethod = photo.SensingMethod.HasValue
|
||||||
.Humanize()
|
? ((SensingMethod)photo.SensingMethod.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoSubjectDistanceRange = photo.SubjectDistanceRange?.SubjectDistanceRange != null
|
// Extract SubjectDistanceRange - simple nullable integer now
|
||||||
? ((SubjectDistanceRange)ExtractInt(photo.SubjectDistanceRange
|
PhotoSubjectDistanceRange = photo.SubjectDistanceRange.HasValue
|
||||||
.SubjectDistanceRange
|
? ((SubjectDistanceRange)photo.SubjectDistanceRange.Value).Humanize()
|
||||||
.AdditionalData)).Humanize()
|
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
// Resolution and Other
|
// Resolution and Other
|
||||||
@@ -329,9 +331,9 @@ public partial class PhotoDetailViewModel : ObservableObject
|
|||||||
PhotoVerticalResolution =
|
PhotoVerticalResolution =
|
||||||
photo.VerticalResolution != null ? $"{photo.VerticalResolution} DPI" : string.Empty;
|
photo.VerticalResolution != null ? $"{photo.VerticalResolution} DPI" : string.Empty;
|
||||||
|
|
||||||
PhotoResolutionUnit = photo.ResolutionUnit?.ResolutionUnit != null
|
// Extract ResolutionUnit - simple nullable integer now
|
||||||
? ((ResolutionUnit)ExtractInt(photo.ResolutionUnit.ResolutionUnit.AdditionalData))
|
PhotoResolutionUnit = photo.ResolutionUnit.HasValue
|
||||||
.Humanize()
|
? ((ResolutionUnit)photo.ResolutionUnit.Value).Humanize()
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
PhotoDigitalZoomRatio = photo.DigitalZoom != null ? $"{photo.DigitalZoom}x" : string.Empty;
|
PhotoDigitalZoomRatio = photo.DigitalZoom != null ? $"{photo.DigitalZoom}x" : string.Empty;
|
||||||
|
|||||||
@@ -80,14 +80,14 @@
|
|||||||
|
|
||||||
<!-- Responsive Layout -->
|
<!-- Responsive Layout -->
|
||||||
<utu:ResponsiveView Visibility="{Binding PhotoImageSource, Converter={StaticResource ObjectToVisibilityConverter}}">
|
<utu:ResponsiveView Visibility="{Binding PhotoImageSource, Converter={StaticResource ObjectToVisibilityConverter}}">
|
||||||
|
|
||||||
<!-- Narrow Template -->
|
<!-- Narrow Template -->
|
||||||
<utu:ResponsiveView.NarrowTemplate>
|
<utu:ResponsiveView.NarrowTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||||
HorizontalScrollBarVisibility="Disabled">
|
HorizontalScrollBarVisibility="Disabled">
|
||||||
<StackPanel Padding="16" Spacing="24">
|
<StackPanel Padding="16" Spacing="24">
|
||||||
|
|
||||||
<!-- Photo -->
|
<!-- Photo -->
|
||||||
<Border Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
<Border Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||||
@@ -98,7 +98,9 @@
|
|||||||
MinHeight="250">
|
MinHeight="250">
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto"
|
VerticalScrollBarVisibility="Auto"
|
||||||
ZoomMode="Enabled">
|
ZoomMode="Enabled"
|
||||||
|
MinZoomFactor="1.0"
|
||||||
|
MaxZoomFactor="5.0">
|
||||||
<Image Source="{Binding PhotoImageSource}"
|
<Image Source="{Binding PhotoImageSource}"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
@@ -325,11 +327,13 @@
|
|||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="8"
|
CornerRadius="8"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
VerticalAlignment="Top">
|
VerticalAlignment="Top"
|
||||||
|
MaxHeight="500">
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto"
|
VerticalScrollBarVisibility="Auto"
|
||||||
ZoomMode="Enabled"
|
ZoomMode="Enabled"
|
||||||
MaxHeight="500">
|
MinZoomFactor="1.0"
|
||||||
|
MaxZoomFactor="5.0">
|
||||||
<Image Source="{Binding PhotoImageSource}"
|
<Image Source="{Binding PhotoImageSource}"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|||||||
@@ -38,4 +38,10 @@ public sealed partial class PhotoDetailPage : Page
|
|||||||
if(DataContext is PhotoDetailViewModel viewModel && _pendingPhotoId.HasValue)
|
if(DataContext is PhotoDetailViewModel viewModel && _pendingPhotoId.HasValue)
|
||||||
_ = viewModel.LoadPhotoCommand.ExecuteAsync(_pendingPhotoId.Value);
|
_ = viewModel.LoadPhotoCommand.ExecuteAsync(_pendingPhotoId.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnNavigatingFrom(e);
|
||||||
|
_pendingPhotoId = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user