2828using System . IO ;
2929using System . Linq ;
3030using System . Runtime . CompilerServices ;
31+ using System . Reflection ;
3132using System . Threading ;
3233using System . Threading . Tasks ;
3334using System . Windows ;
@@ -66,6 +67,9 @@ public partial class ImagePanel : UserControl, INotifyPropertyChanged, IDisposab
6667 private Visibility _reverseColorVisibility = Visibility . Collapsed ;
6768 private Visibility _metaIconVisibility = Visibility . Visible ;
6869
70+ public string CopyTooltip { get ; } = GetTranslation ( "IV_Copy" ) ;
71+ public string BackgroundTooltip { get ; } = GetTranslation ( "IV_Background" ) ;
72+
6973 public ImagePanel ( )
7074 {
7175 InitializeComponent ( ) ;
@@ -78,11 +82,6 @@ public ImagePanel()
7882
7983 buttonReverseColor . Click += OnReverseColorOnClick ;
8084
81- buttonMeta . Click += ( sender , e ) =>
82- textMeta . Visibility = textMeta . Visibility == Visibility . Collapsed
83- ? Visibility . Visible
84- : Visibility . Collapsed ;
85-
8685 buttonBackgroundColour . Click += OnBackgroundColourOnClick ;
8786
8887 SizeChanged += ImagePanel_SizeChanged ;
@@ -111,6 +110,15 @@ public ImagePanel()
111110 viewPanel . ManipulationDelta += ViewPanel_ManipulationDelta ;
112111 }
113112
113+ private static string GetTranslation ( string key )
114+ {
115+ var translationFile = Path . Combine (
116+ Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ,
117+ "Translations.config" ) ;
118+
119+ return TranslationHelper . Get ( key , translationFile ) ;
120+ }
121+
114122 internal ImagePanel ( ContextObject context , MetaProvider meta ) : this ( )
115123 {
116124 ContextObject = context ;
@@ -401,19 +409,27 @@ private void OnBackgroundColourOnClick(object sender, RoutedEventArgs e)
401409
402410 private void ShowMeta ( )
403411 {
404- textMeta . Inlines . Clear ( ) ;
405- Meta . GetExif ( ) . Values . ForEach ( m =>
412+ textMetaContent . Inlines . Clear ( ) ;
413+ Meta . GetExif ( )
414+ . OrderBy ( item => item . Key switch
415+ {
416+ "_.Size.Width" => 0 ,
417+ "_.Size.Height" => 1 ,
418+ _ => 2 ,
419+ } )
420+ . Select ( item => item . Value )
421+ . ForEach ( m =>
406422 {
407423 if ( string . IsNullOrWhiteSpace ( m . Item1 ) || string . IsNullOrWhiteSpace ( m . Item2 ) )
408424 return ;
409425
410- textMeta . Inlines . Add ( new Run ( m . Item1 ) { FontWeight = FontWeights . SemiBold } ) ;
411- textMeta . Inlines . Add ( ": " ) ;
412- textMeta . Inlines . Add ( m . Item2 ) ;
413- textMeta . Inlines . Add ( "\r \n " ) ;
426+ textMetaContent . Inlines . Add ( new Run ( m . Item1 ) { FontWeight = FontWeights . SemiBold } ) ;
427+ textMetaContent . Inlines . Add ( ": " ) ;
428+ textMetaContent . Inlines . Add ( m . Item2 ) ;
429+ textMetaContent . Inlines . Add ( "\r \n " ) ;
414430 } ) ;
415- textMeta . Inlines . Remove ( textMeta . Inlines . LastInline ) ;
416- if ( ! textMeta . Inlines . Any ( ) )
431+ textMetaContent . Inlines . Remove ( textMetaContent . Inlines . LastInline ) ;
432+ if ( ! textMetaContent . Inlines . Any ( ) )
417433 MetaIconVisibility = Visibility . Collapsed ;
418434 }
419435
0 commit comments