diff --git a/Marechai.App/App.xaml b/Marechai.App/App.xaml index 8ba5aa23..e747ee10 100644 --- a/Marechai.App/App.xaml +++ b/Marechai.App/App.xaml @@ -2,29 +2,15 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="using:Prism.DryIoc" + xmlns:utu="using:Uno.Toolkit.UI" xmlns:local="using:Marechai.App.Presentation.Converters"> - - - - + - - - - - - - - - - - - diff --git a/Marechai.App/App.xaml.cs b/Marechai.App/App.xaml.cs index 89c00a0d..123c08e1 100644 --- a/Marechai.App/App.xaml.cs +++ b/Marechai.App/App.xaml.cs @@ -29,6 +29,11 @@ public partial class App : PrismApplication protected override UIElement CreateShell() => Container.Resolve(); + protected override void ConfigureApp(IApplicationBuilder builder) + { + Resources.MergedDictionaries.Add(new AppResources()); + } + protected override void ConfigureHost(IHostBuilder builder) { builder diff --git a/Marechai.App/AppResources.xaml b/Marechai.App/AppResources.xaml new file mode 100644 index 00000000..ad9dbadb --- /dev/null +++ b/Marechai.App/AppResources.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Marechai.App/AppResources.xaml.cs b/Marechai.App/AppResources.xaml.cs new file mode 100644 index 00000000..484eb991 --- /dev/null +++ b/Marechai.App/AppResources.xaml.cs @@ -0,0 +1,11 @@ +using Microsoft.UI.Xaml; + +namespace Marechai.App; + +public partial class AppResources : ResourceDictionary +{ + public AppResources() + { + InitializeComponent(); + } +} diff --git a/Marechai.App/Presentation/Converters/Converters.cs b/Marechai.App/Presentation/Converters/Converters.cs index fa30dce9..53348a7f 100644 --- a/Marechai.App/Presentation/Converters/Converters.cs +++ b/Marechai.App/Presentation/Converters/Converters.cs @@ -71,8 +71,10 @@ public class BoolToVisibilityConverter : IValueConverter /// public class InvertBoolToVisibilityConverter : IValueConverter { - public object Convert(object value, Type targetType, object parameter, string language) => - value is true ? Visibility.Collapsed : Visibility.Visible; + public object Convert(object value, Type targetType, object parameter, string language) + { + return value is true ? Visibility.Collapsed : Visibility.Visible; + } public object ConvertBack(object value, Type targetType, object parameter, string language) => value is Visibility.Collapsed; diff --git a/Marechai.App/Presentation/Converters/LocalizeConverter.cs b/Marechai.App/Presentation/Converters/LocalizeConverter.cs index 72bd5814..90a3cc04 100644 --- a/Marechai.App/Presentation/Converters/LocalizeConverter.cs +++ b/Marechai.App/Presentation/Converters/LocalizeConverter.cs @@ -18,15 +18,11 @@ public sealed class LocalizeConverter : IValueConverter public object Convert(object value, Type targetType, object parameter, string language) { - System.Diagnostics.Debug.WriteLine($"LocalizeConverter.Convert: value={value?.GetType().Name} param={parameter} localizer={_localizer != null}"); - if(parameter is not string key || _localizer is null) return parameter?.ToString() ?? string.Empty; LocalizedString result = _localizer[key]; - System.Diagnostics.Debug.WriteLine($"LocalizeConverter: key='{key}' found={!result.ResourceNotFound} value='{result.Value}'"); - return result.ResourceNotFound ? key : result.Value; } @@ -54,8 +50,6 @@ public static class Loc private static void OnKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - System.Diagnostics.Debug.WriteLine($"Loc.OnKeyChanged: key='{e.NewValue}' localizer={_localizer != null} element={d.GetType().Name}"); - if(e.NewValue is not string key || _localizer is null) return; @@ -68,8 +62,6 @@ public static class Loc { string value = TryGetValue(key); - System.Diagnostics.Debug.WriteLine($"Loc TextBlock key='{key}' value='{value}' localizer={_localizer != null}"); - if(value != null) textBlock.Text = value;