From 1680858455b72c95766f644c1e2cb36c7eefa575 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sat, 18 Apr 2020 16:42:02 +0800 Subject: [PATCH] lang support for binding --- .../Properties/Langs/LangDecorator.cs | 9 + .../Properties/Langs/LangDecorator.tt | 9 + .../Service/Data/DataService.cs | 23 +-- .../Tools/Extension/LangExtension.cs | 5 +- .../Controls/OutlineTextDemoCtl.xaml | 14 +- .../Controls/RunningBlockDemoCtl.xaml | 16 +- .../UserControl/Controls/StepBarDemoCtl.xaml | 14 +- .../UserControl/Controls/TagDemoCtl.xaml | 20 +-- .../UserControl/Controls/TagDemoCtl.xaml.cs | 8 +- .../UserControl/Main/LeftMainContent.xaml | 4 +- .../UserControl/Main/NoUserContent.xaml.cs | 21 +-- .../UserControl/Styles/LabelDemoCtl.xaml | 12 +- .../Styles/RichTextBoxDemoCtl.xaml | 4 +- .../UserControl/Styles/TextBlockDemoCtl.xaml | 32 ++-- .../UserControl/Styles/ToolBarDemoCtl.xaml | 2 +- .../Controls/Growl/Growl.cs | 8 +- .../Properties/Langs/LangDecorator.cs | 11 +- .../Properties/Langs/LangDecorator.tt | 11 +- .../Tools/Extension/LangExtension.cs | 161 +++++++++++++++--- .../Tools/Helper/ConfigHelper.cs | 7 +- 20 files changed, 274 insertions(+), 117 deletions(-) diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.cs index 01a43e96..d01cf951 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.cs @@ -1,5 +1,7 @@ using System.ComponentModel; using System.Globalization; +using System.Windows; +using System.Windows.Data; using HandyControl.Tools; namespace HandyControlDemo.Properties.Langs @@ -24,6 +26,13 @@ namespace HandyControlDemo.Properties.Langs } } + public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) => + BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key) + { + Source = Instance, + Mode = BindingMode.OneWay + }); + private void UpdateLangs() { OnPropertyChanged(nameof(About)); diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.tt b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.tt index e71c221a..65a2cb07 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.tt +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangDecorator.tt @@ -19,6 +19,8 @@ #> using System.ComponentModel; using System.Globalization; +using System.Windows; +using System.Windows.Data; using HandyControl.Tools; namespace HandyControlDemo.Properties.Langs @@ -43,6 +45,13 @@ namespace HandyControlDemo.Properties.Langs } } + public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) => + BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key) + { + Source = Instance, + Mode = BindingMode.OneWay + }); + private void UpdateLangs() { <#foreach(var item in propertyNameList){#> diff --git a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs index c3517b70..ec054b1d 100644 --- a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs +++ b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs @@ -8,6 +8,7 @@ using System.Net; using System.Windows; using HandyControl.Data; using HandyControlDemo.Data; +using HandyControlDemo.Properties.Langs; using HandyControlDemo.Tools.Converter; using Newtonsoft.Json; @@ -106,7 +107,7 @@ namespace HandyControlDemo.Service var list = new List(); for (var i = 1; i <= 9; i++) { - list.Add($"{converter.Convert(Properties.Langs.Lang.Text, null, i, CultureInfo.CurrentCulture)}{i}"); + list.Add($"{converter.Convert(Lang.Text, null, i, CultureInfo.CurrentCulture)}{i}"); } return list; @@ -279,23 +280,23 @@ namespace HandyControlDemo.Service { new StepBarDemoModel { - Header = $"{Properties.Langs.Lang.Step}1", - Content = Properties.Langs.Lang.Register + Header = LangKeys.Step, + Content = LangKeys.Register }, new StepBarDemoModel { - Header = $"{Properties.Langs.Lang.Step}2", - Content = Properties.Langs.Lang.BasicInfo + Header = LangKeys.Step, + Content = LangKeys.BasicInfo }, new StepBarDemoModel { - Header = $"{Properties.Langs.Lang.Step}3", - Content = Properties.Langs.Lang.UploadFile + Header = LangKeys.Step, + Content = LangKeys.UploadFile }, new StepBarDemoModel { - Header = $"{Properties.Langs.Lang.Step}4", - Content = Properties.Langs.Lang.Complete + Header = LangKeys.Step, + Content = LangKeys.Complete } }; } @@ -374,7 +375,7 @@ namespace HandyControlDemo.Service foreach (var item in jsonObj) { var titleKey = (string) item.title; - var title = Properties.Langs.Lang.ResourceManager.GetString(titleKey); + var title = titleKey; var list = Convert2DemoItemList(item.demoItemList); infoList.Add(new DemoInfoModel { @@ -393,7 +394,7 @@ namespace HandyControlDemo.Service foreach (var item in list) { - var name = Properties.Langs.Lang.ResourceManager.GetString((string)item[0]); + var name = (string)item[0]; string targetCtlName = item[1]; string imageName = item[2]; var isNew = !string.IsNullOrEmpty((string)item[3]); diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Extension/LangExtension.cs b/src/Shared/HandyControlDemo_Shared/Tools/Extension/LangExtension.cs index ff2be48c..1e7553cc 100644 --- a/src/Shared/HandyControlDemo_Shared/Tools/Extension/LangExtension.cs +++ b/src/Shared/HandyControlDemo_Shared/Tools/Extension/LangExtension.cs @@ -4,6 +4,9 @@ namespace HandyControlDemo.Tools.Extension { public class LangExtension : HandyControl.Tools.Extension.LangExtension { - public override object LangSource => LangDecorator.Instance; + public LangExtension() + { + Source = LangDecorator.Instance; + } } } diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml index 01507ebc..44967833 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml @@ -7,13 +7,13 @@ Background="{DynamicResource RegionBrush}"> - - - - - - - + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml index faab513a..d3f362e3 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml @@ -7,14 +7,14 @@ xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"> - - - - - - - - + + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml index 08d58768..8c79461d 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml @@ -39,8 +39,11 @@ - - + + + + + @@ -49,8 +52,11 @@ - - + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml index 216b9e47..e6cb2880 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml @@ -7,16 +7,16 @@ xmlns:hc="https://handyorg.github.io/handycontrol"> - - - - - - - - - - + + + + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml.cs index 08630f47..c7a15300 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TagDemoCtl.xaml.cs @@ -1,5 +1,6 @@ using System; using HandyControl.Controls; +using HandyControlDemo.Properties.Langs; namespace HandyControlDemo.UserControl { @@ -14,10 +15,9 @@ namespace HandyControlDemo.UserControl { if (sender is TagPanel panel) { - panel.Children.Add(new Tag - { - Content = Properties.Langs.Lang.SubTitle - }); + var tag = new Tag(); + LangDecorator.SetLang(tag, ContentProperty, LangKeys.SubTitle); + panel.Children.Add(tag); } } } diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml index 3d4ca182..c684b4d8 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml @@ -30,7 +30,7 @@ - + @@ -51,7 +51,7 @@ - + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml.cs index 20e28e45..08682ac7 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml.cs @@ -1,9 +1,8 @@ -using System.Diagnostics; -using System.Globalization; +using System.Globalization; using System.Windows; using System.Windows.Controls; -using HandyControl.Controls; using HandyControl.Data; +using HandyControl.Tools; using HandyControlDemo.Data; using HandyControlDemo.Properties.Langs; using HandyControlDemo.Window; @@ -23,19 +22,11 @@ namespace HandyControlDemo.UserControl { PopupConfig.IsOpen = false; if (tag.Equals(GlobalData.Config.Lang)) return; - Growl.Ask(Properties.Langs.Lang.ChangeLangAsk, b => - { - if (!b) return true; - GlobalData.Config.Lang = tag; - GlobalData.Save(); + ConfigHelper.Instance.SetLang(tag); + LangDecorator.Culture = new CultureInfo(tag); - LangDecorator.Culture = new CultureInfo(tag); - //var processModule = Process.GetCurrentProcess().MainModule; - //if (processModule != null) - // Process.Start(processModule.FileName); - //Application.Current.Shutdown(); - return true; - }); + GlobalData.Config.Lang = tag; + GlobalData.Save(); } } diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/LabelDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/LabelDemoCtl.xaml index b0bf9b35..626212b2 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/LabelDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/LabelDemoCtl.xaml @@ -7,12 +7,12 @@ Background="{DynamicResource RegionBrush}"> - diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RichTextBoxDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RichTextBoxDemoCtl.xaml index 38858947..7ba5abdf 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RichTextBoxDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RichTextBoxDemoCtl.xaml @@ -9,10 +9,10 @@ - + - + https://github.com/NaBian/HandyControl diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml index b4bf29a2..04a1138d 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml @@ -27,23 +27,23 @@ - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToolBarDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToolBarDemoCtl.xaml index 2f46719d..ddb4a029 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToolBarDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToolBarDemoCtl.xaml @@ -21,7 +21,7 @@ - + diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 678dc5be..7a3e5eeb 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -8,6 +8,7 @@ using System.Windows.Media; using System.Windows.Threading; using HandyControl.Data; using HandyControl.Interactivity; +using HandyControl.Properties.Langs; using HandyControl.Tools; using HandyControl.Tools.Extension; @@ -297,10 +298,9 @@ namespace HandyControl.Controls { if (panel == null) return; - var menuItem = new MenuItem - { - Header = Properties.Langs.Lang.Clear - }; + var menuItem = new MenuItem(); + LangDecorator.SetLang(menuItem, HeaderedItemsControl.HeaderProperty, LangKeys.Clear); + menuItem.Click += (s, e) => { foreach (var item in panel.Children.OfType()) diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.cs b/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.cs index a3de32d0..3208ab42 100644 --- a/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.cs +++ b/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.cs @@ -1,5 +1,7 @@ using System.ComponentModel; using System.Globalization; +using System.Windows; +using System.Windows.Data; using HandyControl.Tools; namespace HandyControl.Properties.Langs @@ -10,7 +12,7 @@ namespace HandyControl.Properties.Langs private static string CultureInfoStr; - public static CultureInfo Culture + internal static CultureInfo Culture { get => Lang.Culture; set @@ -24,6 +26,13 @@ namespace HandyControl.Properties.Langs } } + public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) => + BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key) + { + Source = Instance, + Mode = BindingMode.OneWay + }); + private void UpdateLangs() { OnPropertyChanged(nameof(Am)); diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.tt b/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.tt index 7ac22288..c4d1fb1d 100644 --- a/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.tt +++ b/src/Shared/HandyControl_Shared/Properties/Langs/LangDecorator.tt @@ -19,6 +19,8 @@ #> using System.ComponentModel; using System.Globalization; +using System.Windows; +using System.Windows.Data; using HandyControl.Tools; namespace HandyControl.Properties.Langs @@ -29,7 +31,7 @@ namespace HandyControl.Properties.Langs private static string CultureInfoStr; - public static CultureInfo Culture + internal static CultureInfo Culture { get => Lang.Culture; set @@ -43,6 +45,13 @@ namespace HandyControl.Properties.Langs } } + public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) => + BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key) + { + Source = Instance, + Mode = BindingMode.OneWay + }); + private void UpdateLangs() { <#foreach(var item in propertyNameList){#> diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/LangExtension.cs b/src/Shared/HandyControl_Shared/Tools/Extension/LangExtension.cs index d7a6570a..03c02655 100644 --- a/src/Shared/HandyControl_Shared/Tools/Extension/LangExtension.cs +++ b/src/Shared/HandyControl_Shared/Tools/Extension/LangExtension.cs @@ -1,42 +1,163 @@ -using HandyControl.Properties.Langs; -using System; +using System; using System.Windows; using System.Windows.Data; using System.Windows.Markup; +using HandyControl.Properties.Langs; namespace HandyControl.Tools.Extension { public class LangExtension : MarkupExtension { + private readonly DependencyObject _proxy; + + private bool _isInternalAction; + public LangExtension() { - + _proxy = new DependencyObject(); + Source = LangDecorator.Instance; } - public LangExtension(string key) => Key = key; + public LangExtension(string key) : this() + { + Key = key; + } + public static readonly DependencyProperty KeyProperty = DependencyProperty.RegisterAttached( + "Key", typeof(object), typeof(LangExtension), new PropertyMetadata(default)); + + public object Key + { + get => _proxy.GetValue(KeyProperty); + set => _proxy.SetValue(KeyProperty, value); + } + + private static readonly DependencyProperty TargetPropertyProperty = DependencyProperty.RegisterAttached( + "TargetProperty", typeof(DependencyProperty), typeof(LangExtension), new PropertyMetadata(default(DependencyProperty))); + + private static void SetTargetProperty(DependencyObject element, DependencyProperty value) + => element.SetValue(TargetPropertyProperty, value); + + private static DependencyProperty GetTargetProperty(DependencyObject element) + => (DependencyProperty) element.GetValue(TargetPropertyProperty); + + public BindingMode Mode { get; set; } + + public IValueConverter Converter { get; set; } + + public object ConverterParameter { get; set; } + + public object Source { get; set; } + public override object ProvideValue(IServiceProvider serviceProvider) { - if (!(serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget pvt)) - return null; + if (_isInternalAction) return this; + if (!(serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget provideValueTarget)) return this; + if (provideValueTarget.TargetObject.GetType().FullName == "System.Windows.SharedDp") return this; + if (!(provideValueTarget.TargetObject is DependencyObject targetObject)) return this; + if (!(provideValueTarget.TargetProperty is DependencyProperty targetProperty)) return this; - if (!(pvt.TargetObject is DependencyObject targetObject)) - return null; - - if (!(pvt.TargetProperty is DependencyProperty targetProperty)) - return null; - - var binding = new Binding(Key) + switch (Key) { - Source = LangSource, - Mode = BindingMode.OneWay - }; - BindingOperations.SetBinding(targetObject, targetProperty, binding); - return binding.ProvideValue(serviceProvider); + case string key: + { + var binding = new Binding(key) + { + Converter = Converter, + ConverterParameter = ConverterParameter, + UpdateSourceTrigger = UpdateSourceTrigger.Explicit, + Source = Source, + Mode = BindingMode.OneWay + }; + BindingOperations.SetBinding(targetObject, targetProperty, binding); + return binding.ProvideValue(serviceProvider); + } + case Binding keyBinding when targetObject is FrameworkElement element: + { + if (element.DataContext != null) + { + _isInternalAction = true; + SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); + _isInternalAction = false; + } + else + { + SetTargetProperty(element, targetProperty); + element.DataContextChanged += LangExtension_DataContextChanged; + } + + break; + } + case Binding keyBinding when targetObject is FrameworkContentElement element: + { + if (element.DataContext != null) + { + _isInternalAction = true; + SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); + _isInternalAction = false; + } + else + { + SetTargetProperty(element, targetProperty); + element.DataContextChanged += LangExtension_DataContextChanged; + } + + break; + } + } + + return string.Empty; } - public string Key { get; set; } + private void LangExtension_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + switch (sender) + { + case FrameworkElement element: + { + element.DataContextChanged -= LangExtension_DataContextChanged; + if (!(Key is Binding keyBinding)) return; - public virtual object LangSource => LangDecorator.Instance; + var targetProperty = GetTargetProperty(element); + SetTargetProperty(element, null); + SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); + break; + } + case FrameworkContentElement element: + { + element.DataContextChanged -= LangExtension_DataContextChanged; + if (!(Key is Binding keyBinding)) return; + + var targetProperty = GetTargetProperty(element); + SetTargetProperty(element, null); + SetLangBinding(element, targetProperty, keyBinding.Path, element.DataContext); + break; + } + } + } + + private void SetLangBinding(DependencyObject targetObject, DependencyProperty targetProperty, PropertyPath path, object dataContext) + { + if (targetProperty == null) return; + + BindingOperations.SetBinding(targetObject, targetProperty, new Binding + { + Path = path, + Source = dataContext, + Mode = BindingMode.OneWay + }); + + var key = targetObject.GetValue(targetProperty) as string; + if (string.IsNullOrEmpty(key)) return; + + BindingOperations.SetBinding(targetObject, targetProperty, new Binding(key) + { + Converter = Converter, + ConverterParameter = ConverterParameter, + UpdateSourceTrigger = UpdateSourceTrigger.Explicit, + Source = Source, + Mode = BindingMode.OneWay + }); + } } } \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs index 55051127..82f8df76 100644 --- a/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs +++ b/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs @@ -10,6 +10,7 @@ using System.Windows.Media.Animation; using System.Windows.Navigation; using HandyControl.Controls; using HandyControl.Data; +using HandyControl.Properties.Langs; namespace HandyControl.Tools { @@ -37,13 +38,11 @@ namespace HandyControl.Tools } } - public void SetSystemVersionInfo(SystemVersionInfo info) - { - BlurWindow.SystemVersionInfo = info; - } + public void SetSystemVersionInfo(SystemVersionInfo info) => BlurWindow.SystemVersionInfo = info; public void SetLang(string lang) { + LangDecorator.Culture = new CultureInfo(lang); Application.Current.Dispatcher.Thread.CurrentUICulture = new CultureInfo(lang); Lang = XmlLanguage.GetLanguage(lang); }