add EnumDataProvider
This commit is contained in:
1 parent
665ee3866e
commit
a4e44b75d8
24 files changed
+2480
-82
No files matched your search
@@ -46,11 +46,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>MessageToken.tt</DependentUpon>
|
<DependentUpon>MessageToken.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.Designer.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.Designer.cs">
|
||||||
<Link>Properties\Langs\Lang.Designer.cs</Link>
|
<Link>Properties\Langs\Lang.Designer.cs</Link>
|
||||||
@@ -523,10 +523,10 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -42,11 +42,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Lang.resx</DependentUpon>
|
<DependentUpon>Lang.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -72,10 +72,10 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
||||||
|
|||||||
@@ -75,11 +75,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>MessageToken.tt</DependentUpon>
|
<DependentUpon>MessageToken.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\AssemblyInfo.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\AssemblyInfo.cs">
|
||||||
<Link>Properties\AssemblyInfo.cs</Link>
|
<Link>Properties\AssemblyInfo.cs</Link>
|
||||||
@@ -452,10 +452,10 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
||||||
|
|||||||
@@ -47,11 +47,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Lang.resx</DependentUpon>
|
<DependentUpon>Lang.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -113,10 +113,10 @@
|
|||||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -155,11 +155,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>MessageToken.tt</DependentUpon>
|
<DependentUpon>MessageToken.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\AssemblyInfo.cs">
|
<Compile Include="..\..\Shared\HandyControlDemo_Shared\Properties\AssemblyInfo.cs">
|
||||||
<Link>Properties\AssemblyInfo.cs</Link>
|
<Link>Properties\AssemblyInfo.cs</Link>
|
||||||
@@ -513,10 +513,10 @@
|
|||||||
</Resource>
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Data\MessageToken.tt">
|
<Content Include="..\..\Shared\HandyControlDemo_Shared\Data\MessageToken.tt">
|
||||||
<Link>Data\MessageToken.tt</Link>
|
<Link>Data\MessageToken.tt</Link>
|
||||||
|
|||||||
@@ -122,11 +122,11 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Lang.resx</DependentUpon>
|
<DependentUpon>Lang.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.cs">
|
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.cs">
|
||||||
<Link>Properties\Langs\LangDecorator.cs</Link>
|
<Link>Properties\Langs\LangProvider.cs</Link>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>LangDecorator.tt</DependentUpon>
|
<DependentUpon>LangProvider.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -158,10 +158,10 @@
|
|||||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangDecorator.tt">
|
<Content Include="..\..\Shared\HandyControl_Shared\Properties\Langs\LangProvider.tt">
|
||||||
<Link>Properties\Langs\LangDecorator.tt</Link>
|
<Link>Properties\Langs\LangProvider.tt</Link>
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>LangDecorator.cs</LastGenOutput>
|
<LastGenOutput>LangProvider.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -4,42 +4,32 @@
|
|||||||
xmlns:viewModel="clr-namespace:HandyControlDemo.ViewModel"
|
xmlns:viewModel="clr-namespace:HandyControlDemo.ViewModel"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:d1P1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:d1P1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
|
||||||
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
xmlns:resources="clr-namespace:HandyControlDemo.Resources"
|
|
||||||
d1P1:Ignorable="d"
|
d1P1:Ignorable="d"
|
||||||
StartupUri="MainWindow.xaml">
|
StartupUri="MainWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<hc:Theme Name="HandyTheme"/>
|
<ResourceDictionary>
|
||||||
<resources:DemoTheme Name="DemoTheme"/>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||||
|
<ResourceDictionary Source="Resources/Themes/SkinDefault.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||||
|
<ResourceDictionary Source="Resources/Themes/Theme.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<langs:LangProvider x:Key="DemoLangs"/>
|
||||||
<langs:LangDecorator x:Key="DemoLangs"/>
|
|
||||||
<viewModel:ViewModelLocator x:Key="Locator" d:IsDataSource="True"/>
|
<viewModel:ViewModelLocator x:Key="Locator" d:IsDataSource="True"/>
|
||||||
|
<hc:EnumDataProvider x:Key="DemoTypes" Type="data:DemoType" MethodName=""/>
|
||||||
<ObjectDataProvider x:Key="DemoTypes" MethodName="GetValues" ObjectType="sys:Enum">
|
<hc:EnumDataProvider x:Key="ShowAnimations" Type="hc:ShowAnimation"/>
|
||||||
<ObjectDataProvider.MethodParameters>
|
<hc:EnumDataProvider x:Key="HatchStyles" Type="hc:HatchStyle"/>
|
||||||
<x:Type Type="data:DemoType"/>
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
|
|
||||||
<ObjectDataProvider x:Key="ShowAnimations" MethodName="GetValues" ObjectType="sys:Enum">
|
|
||||||
<ObjectDataProvider.MethodParameters>
|
|
||||||
<x:Type TypeName="hc:ShowAnimation"/>
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
|
|
||||||
<ObjectDataProvider x:Key="HatchStyles" MethodName="GetValues" ObjectType="sys:Enum">
|
|
||||||
<ObjectDataProvider.MethodParameters>
|
|
||||||
<x:Type Type="hc:HatchStyle"/>
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
@@ -88,8 +88,22 @@ namespace HandyControlDemo
|
|||||||
|
|
||||||
internal void UpdateSkin(SkinType skin)
|
internal void UpdateSkin(SkinType skin)
|
||||||
{
|
{
|
||||||
ResourceHelper.GetTheme("HandyTheme", Resources).Skin = skin;
|
var skins0 = Resources.MergedDictionaries[0];
|
||||||
ResourceHelper.GetTheme("DemoTheme", Resources).Skin = skin;
|
skins0.MergedDictionaries.Clear();
|
||||||
|
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
|
||||||
|
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skin));
|
||||||
|
|
||||||
|
|
||||||
|
var skins1 = Resources.MergedDictionaries[1];
|
||||||
|
skins1.MergedDictionaries.Clear();
|
||||||
|
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||||
|
{
|
||||||
|
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||||
|
});
|
||||||
|
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||||
|
{
|
||||||
|
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||||
|
});
|
||||||
|
|
||||||
Current.MainWindow?.OnApplyTemplate();
|
Current.MainWindow?.OnApplyTemplate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ using HandyControl.Tools;
|
|||||||
|
|
||||||
namespace HandyControlDemo.Properties.Langs
|
namespace HandyControlDemo.Properties.Langs
|
||||||
{
|
{
|
||||||
public class LangDecorator : INotifyPropertyChanged
|
public class LangProvider : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
internal static LangDecorator Instance => ResourceHelper.GetResource<LangDecorator>("DemoLangs");
|
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("DemoLangs");
|
||||||
|
|
||||||
private static string CultureInfoStr;
|
private static string CultureInfoStr;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -25,9 +25,9 @@ using HandyControl.Tools;
|
|||||||
|
|
||||||
namespace HandyControlDemo.Properties.Langs
|
namespace HandyControlDemo.Properties.Langs
|
||||||
{
|
{
|
||||||
public class LangDecorator : INotifyPropertyChanged
|
public class LangProvider : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
internal static LangDecorator Instance => ResourceHelper.GetResource<LangDecorator>("DemoLangs");
|
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("DemoLangs");
|
||||||
|
|
||||||
private static string CultureInfoStr;
|
private static string CultureInfoStr;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ namespace HandyControlDemo.Tools.Extension
|
|||||||
{
|
{
|
||||||
public LangExtension()
|
public LangExtension()
|
||||||
{
|
{
|
||||||
Source = LangDecorator.Instance;
|
Source = LangProvider.Instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace HandyControlDemo.UserControl
|
|||||||
if (sender is TagPanel panel)
|
if (sender is TagPanel panel)
|
||||||
{
|
{
|
||||||
var tag = new Tag();
|
var tag = new Tag();
|
||||||
LangDecorator.SetLang(tag, ContentProperty, LangKeys.SubTitle);
|
LangProvider.SetLang(tag, ContentProperty, LangKeys.SubTitle);
|
||||||
panel.Children.Add(tag);
|
panel.Children.Add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace HandyControlDemo.UserControl
|
|||||||
PopupConfig.IsOpen = false;
|
PopupConfig.IsOpen = false;
|
||||||
if (tag.Equals(GlobalData.Config.Lang)) return;
|
if (tag.Equals(GlobalData.Config.Lang)) return;
|
||||||
ConfigHelper.Instance.SetLang(tag);
|
ConfigHelper.Instance.SetLang(tag);
|
||||||
LangDecorator.Culture = new CultureInfo(tag);
|
LangProvider.Culture = new CultureInfo(tag);
|
||||||
Messenger.Default.Send<object>(null, "LangUpdated");
|
Messenger.Default.Send<object>(null, "LangUpdated");
|
||||||
|
|
||||||
GlobalData.Config.Lang = tag;
|
GlobalData.Config.Lang = tag;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
Messenger.Default.Register<object>(this, MessageToken.LangUpdated, obj =>
|
Messenger.Default.Register<object>(this, MessageToken.LangUpdated, obj =>
|
||||||
{
|
{
|
||||||
if (DemoItemCurrent == null) return;
|
if (DemoItemCurrent == null) return;
|
||||||
ContentTitle = LangDecorator.GetLang(DemoItemCurrent.Name);
|
ContentTitle = LangProvider.GetLang(DemoItemCurrent.Name);
|
||||||
});
|
});
|
||||||
|
|
||||||
DataList = dataService.GetDemoDataList();
|
DataList = dataService.GetDemoDataList();
|
||||||
@@ -155,7 +155,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
private void SwitchDemo(DemoItemModel item)
|
private void SwitchDemo(DemoItemModel item)
|
||||||
{
|
{
|
||||||
DemoItemCurrent = item;
|
DemoItemCurrent = item;
|
||||||
ContentTitle = LangDecorator.GetLang(item.Name);
|
ContentTitle = LangProvider.GetLang(item.Name);
|
||||||
var obj = AssemblyHelper.ResolveByKey(item.TargetCtlName);
|
var obj = AssemblyHelper.ResolveByKey(item.TargetCtlName);
|
||||||
var ctl = obj ?? AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
|
var ctl = obj ?? AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
|
||||||
Messenger.Default.Send(ctl is IFull, MessageToken.FullSwitch);
|
Messenger.Default.Send(ctl is IFull, MessageToken.FullSwitch);
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ namespace HandyControl.Controls
|
|||||||
if (panel == null) return;
|
if (panel == null) return;
|
||||||
|
|
||||||
var menuItem = new MenuItem();
|
var menuItem = new MenuItem();
|
||||||
LangDecorator.SetLang(menuItem, HeaderedItemsControl.HeaderProperty, LangKeys.Clear);
|
LangProvider.SetLang(menuItem, HeaderedItemsControl.HeaderProperty, LangKeys.Clear);
|
||||||
|
|
||||||
menuItem.Click += (s, e) =>
|
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\Text\SimpleText.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Window\GlowWindow.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Window\GlowWindow.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Data\DisposableObject.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\DrawerShowMode.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HatchStyle.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HatchStyle.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HitMode.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HitMode.cs" />
|
||||||
|
|||||||
+2
-2
@@ -6,9 +6,9 @@ using HandyControl.Tools;
|
|||||||
|
|
||||||
namespace HandyControl.Properties.Langs
|
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;
|
private static string CultureInfoStr;
|
||||||
|
|
||||||
+2
-2
@@ -25,9 +25,9 @@ using HandyControl.Tools;
|
|||||||
|
|
||||||
namespace HandyControl.Properties.Langs
|
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;
|
private static string CultureInfoStr;
|
||||||
|
|
||||||
@@ -89,7 +89,6 @@
|
|||||||
<Setter Property="WindowStyle" Value="None"/>
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
<Setter Property="WindowState" Value="Maximized"/>
|
<Setter Property="WindowState" Value="Maximized"/>
|
||||||
<Setter Property="Topmost" Value="True"/>
|
<Setter Property="Topmost" Value="True"/>
|
||||||
<Setter Property="AllowsTransparency" Value="True"/>
|
|
||||||
<Setter Property="ResizeMode" Value="NoResize"/>
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<langs:LangDecorator x:Key="Langs"/>
|
<langs:LangProvider x:Key="Langs"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
<ResourceDictionary Source="Basic/Basic.xaml"/>
|
<ResourceDictionary Source="Basic/Basic.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Style.xaml"/>
|
<ResourceDictionary Source="Styles/Style.xaml"/>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace HandyControl.Tools.Extension
|
|||||||
public LangExtension()
|
public LangExtension()
|
||||||
{
|
{
|
||||||
_proxy = new DependencyObject();
|
_proxy = new DependencyObject();
|
||||||
Source = LangDecorator.Instance;
|
Source = LangProvider.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LangExtension(string key) : this()
|
public LangExtension(string key) : this()
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace HandyControl.Tools
|
|||||||
|
|
||||||
public void SetLang(string lang)
|
public void SetLang(string lang)
|
||||||
{
|
{
|
||||||
LangDecorator.Culture = new CultureInfo(lang);
|
LangProvider.Culture = new CultureInfo(lang);
|
||||||
Application.Current.Dispatcher.Thread.CurrentUICulture = new CultureInfo(lang);
|
Application.Current.Dispatcher.Thread.CurrentUICulture = new CultureInfo(lang);
|
||||||
Lang = XmlLanguage.GetLanguage(lang);
|
Lang = XmlLanguage.GetLanguage(lang);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user