add EnumDataProvider
This commit is contained in:
1 parent
665ee3866e
commit
a4e44b75d8
24 files changed
+2480
-82
No files matched your search
@@ -299,7 +299,7 @@ namespace HandyControl.Controls
|
||||
if (panel == null) return;
|
||||
|
||||
var menuItem = new MenuItem();
|
||||
LangDecorator.SetLang(menuItem, HeaderedItemsControl.HeaderProperty, LangKeys.Clear);
|
||||
LangProvider.SetLang(menuItem, HeaderedItemsControl.HeaderProperty, LangKeys.Clear);
|
||||
|
||||
menuItem.Click += (s, e) =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public class EnumDataProvider : ObjectDataProvider
|
||||
{
|
||||
private Type _type;
|
||||
public Type Type
|
||||
{
|
||||
get => _type;
|
||||
set
|
||||
{
|
||||
_type = value;
|
||||
MethodName = "GetValues";
|
||||
ObjectType = typeof(System.Enum);
|
||||
MethodParameters.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Text\SimpleText.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Window\GlowWindow.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\DisposableObject.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\EnumDataProvider.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\DrawerShowMode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HatchStyle.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HitMode.cs" />
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Properties.Langs
|
||||
{
|
||||
public class LangDecorator : INotifyPropertyChanged
|
||||
public class LangProvider : INotifyPropertyChanged
|
||||
{
|
||||
internal static LangDecorator Instance => ResourceHelper.GetResource<LangDecorator>("Langs");
|
||||
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("Langs");
|
||||
|
||||
private static string CultureInfoStr;
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Properties.Langs
|
||||
{
|
||||
public class LangDecorator : INotifyPropertyChanged
|
||||
public class LangProvider : INotifyPropertyChanged
|
||||
{
|
||||
internal static LangDecorator Instance => ResourceHelper.GetResource<LangDecorator>("Langs");
|
||||
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("Langs");
|
||||
|
||||
private static string CultureInfoStr;
|
||||
|
||||
@@ -89,7 +89,6 @@
|
||||
<Setter Property="WindowStyle" Value="None"/>
|
||||
<Setter Property="WindowState" Value="Maximized"/>
|
||||
<Setter Property="Topmost" Value="True"/>
|
||||
<Setter Property="AllowsTransparency" Value="True"/>
|
||||
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<langs:LangDecorator x:Key="Langs"/>
|
||||
<langs:LangProvider x:Key="Langs"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="Basic/Basic.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Style.xaml"/>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace HandyControl.Tools.Extension
|
||||
public LangExtension()
|
||||
{
|
||||
_proxy = new DependencyObject();
|
||||
Source = LangDecorator.Instance;
|
||||
Source = LangProvider.Instance;
|
||||
}
|
||||
|
||||
public LangExtension(string key) : this()
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace HandyControl.Tools
|
||||
|
||||
public void SetLang(string lang)
|
||||
{
|
||||
LangDecorator.Culture = new CultureInfo(lang);
|
||||
LangProvider.Culture = new CultureInfo(lang);
|
||||
Application.Current.Dispatcher.Thread.CurrentUICulture = new CultureInfo(lang);
|
||||
Lang = XmlLanguage.GetLanguage(lang);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user