Browse Source

Update Google and Bing map links button to only be enabled when there is a valid link available from longitude and latitude values

Ruben 3 months ago
parent
commit
250dd7166e

+ 3 - 5
src/PicView.Avalonia/Views/ImageInfoView.axaml

@@ -1293,9 +1293,8 @@
                             Classes="altHover BorderStyle"
                             Command="{CompiledBinding Exif.OpenGoogleLinkCommand,
                                                       Mode=OneWay}"
-                            IsEnabled="{CompiledBinding Exif.GoogleLink,
-                                                        Converter={x:Static ObjectConverters.IsNotNull}}"
-                            Margin="30,0,15,0">
+                            Margin="30,0,15,0"
+                            x:Name="GoogleLinkButton">
                             <Path
                                 Data="M473.16 221.48l-2.26-9.59H262.46v88.22H387c-12.93 61.4-72.93 93.72-121.94 93.72-35.66 0-73.25-15-98.13-39.11a140.08 140.08 0 01-41.8-98.88c0-37.16 16.7-74.33 41-98.78s61-38.13 97.49-38.13c41.79 0 71.74 22.19 82.94 32.31l62.69-62.36C390.86 72.72 340.34 32 261.6 32c-60.75 0-119 23.27-161.58 65.71C58 139.5 36.25 199.93 36.25 256s20.58 113.48 61.3 155.6c43.51 44.92 105.13 68.4 168.58 68.4 57.73 0 112.45-22.62 151.45-63.66 38.34-40.4 58.17-96.3 58.17-154.9 0-24.67-2.48-39.32-2.59-39.96z"
                                 Fill="{StaticResource SecondaryTextColor}"
@@ -1307,8 +1306,7 @@
                             Classes="altHover BorderStyle"
                             Command="{CompiledBinding Exif.OpenBingLinkCommand,
                                                       Mode=OneWay}"
-                            IsEnabled="{CompiledBinding Exif.BingLink,
-                                                        Converter={x:Static ObjectConverters.IsNotNull}}">
+                            x:Name="BingLinkButton">
                             <Path
                                 Data="M31.87 30.58H244.7v212.81H31.87zM266.89 30.58H479.7v212.81H266.89zM31.87 265.61H244.7v212.8H31.87zM266.89 265.61H479.7v212.8H266.89z"
                                 Fill="{StaticResource SecondaryTextColor}"

+ 2 - 0
src/PicView.Avalonia/Views/ImageInfoView.axaml.cs

@@ -76,6 +76,8 @@ public partial class ImageInfoView : UserControl
                 }
                 FileSizeBox.Text = vm.PicViewer.FileInfo?.CurrentValue?.Length.GetReadableFileSize();
                 ConversionHelper.DetermineIfOptimizeImageShouldBeEnabled(vm);
+                GoogleLinkButton.IsEnabled = !string.IsNullOrWhiteSpace(vm.Exif.GoogleLink.CurrentValue);
+                BingLinkButton.IsEnabled = !string.IsNullOrWhiteSpace(vm.Exif.BingLink.CurrentValue);
             }).AddTo(_disposables);
             
             ResetButton.Click += (_, _) =>