mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 11:57:37 +08:00
update demo
This commit is contained in:
parent
1680858455
commit
dc64d5cacb
@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
"title": "Styles",
|
||||
"selectedIndex": -1,
|
||||
"demoItemList": [
|
||||
[ "Brush", "BrushDemoCtl", "Brush_16x", "" ],
|
||||
[ "Button", "ButtonDemoCtl", "ButtonClick_16x", "" ],
|
||||
@ -30,12 +31,13 @@
|
||||
[ "ToolBar", "ToolBarDemoCtl", "ToolBar_16x", "" ],
|
||||
[ "Border", "BorderDemoCtl", "BorderElement_16x", "" ],
|
||||
[ "Label", "LabelDemoCtl", "Label_16x", "" ],
|
||||
[ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ],
|
||||
[ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ]
|
||||
[ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ],
|
||||
[ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Controls",
|
||||
"selectedIndex": 0,
|
||||
"demoItemList": [
|
||||
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "" ],
|
||||
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "" ],
|
||||
@ -104,9 +106,10 @@
|
||||
},
|
||||
{
|
||||
"title": "Tools",
|
||||
"selectedIndex": 0,
|
||||
"demoItemList": [
|
||||
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
|
||||
[ "Morphing Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
|
||||
[ "Morphing_Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
|
||||
[ "Effects", "EffectsDemoCtl", "Effects_16x", "" ]
|
||||
]
|
||||
}
|
||||
|
@ -48,5 +48,7 @@
|
||||
|
||||
public static readonly string DialogContainer = nameof(DialogContainer);
|
||||
|
||||
public static readonly string LangUpdated = nameof(LangUpdated);
|
||||
|
||||
}
|
||||
}
|
@ -26,7 +26,8 @@ var messageList = new List<string>
|
||||
"GlowWindow",
|
||||
"NativeCommonWindow",
|
||||
"NavigationWindow",
|
||||
"DialogContainer"
|
||||
"DialogContainer",
|
||||
"LangUpdated"
|
||||
};
|
||||
#>
|
||||
namespace HandyControlDemo.Data
|
||||
|
@ -897,6 +897,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LangComment {
|
||||
get {
|
||||
return ResourceManager.GetString("LangComment", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 列表框 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -747,4 +747,7 @@
|
||||
<data name="TextDialogInControl" xml:space="preserve">
|
||||
<value>TextDialog(In control)</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -747,4 +747,7 @@
|
||||
<data name="TextDialogInControl" xml:space="preserve">
|
||||
<value>TextDialog(In control)</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -747,4 +747,7 @@
|
||||
<data name="TextDialogInControl" xml:space="preserve">
|
||||
<value>TextDialog(In control)</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -747,4 +747,7 @@
|
||||
<data name="TextDialogInControl" xml:space="preserve">
|
||||
<value>TextDialog(In control)</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -747,4 +747,7 @@
|
||||
<data name="TextDialogInControl" xml:space="preserve">
|
||||
<value>文本对话框(控件中)</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>查找类似 {0} 的本地化字符串。</value>
|
||||
</data>
|
||||
</root>
|
@ -26,6 +26,8 @@ namespace HandyControlDemo.Properties.Langs
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLang(string key) => Lang.ResourceManager.GetString(key, Culture);
|
||||
|
||||
public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) =>
|
||||
BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key)
|
||||
{
|
||||
@ -128,6 +130,7 @@ namespace HandyControlDemo.Properties.Langs
|
||||
OnPropertyChanged(nameof(InteractiveDialog));
|
||||
OnPropertyChanged(nameof(IsNotPhone));
|
||||
OnPropertyChanged(nameof(Label));
|
||||
OnPropertyChanged(nameof(LangComment));
|
||||
OnPropertyChanged(nameof(ListBox));
|
||||
OnPropertyChanged(nameof(ListView));
|
||||
OnPropertyChanged(nameof(Loading));
|
||||
@ -712,6 +715,11 @@ namespace HandyControlDemo.Properties.Langs
|
||||
/// </summary>
|
||||
public string Label => Lang.Label;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public string LangComment => Lang.LangComment;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 列表框 的本地化字符串。
|
||||
/// </summary>
|
||||
@ -1771,6 +1779,11 @@ namespace HandyControlDemo.Properties.Langs
|
||||
/// </summary>
|
||||
public static string Label = nameof(Label);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LangComment = nameof(LangComment);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 列表框 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -13,7 +13,7 @@
|
||||
{
|
||||
langDic[item] =
|
||||
@$"/// <summary>
|
||||
/// 查找类似 {Lang.ResourceManager.GetString(item, Lang.Culture)} 的本地化字符串。
|
||||
/// {string.Format(Lang.LangComment, Lang.ResourceManager.GetString(item, Lang.Culture))}
|
||||
/// </summary>";
|
||||
}
|
||||
#>
|
||||
@ -45,6 +45,8 @@ namespace HandyControlDemo.Properties.Langs
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLang(string key) => Lang.ResourceManager.GetString(key, Culture);
|
||||
|
||||
public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) =>
|
||||
BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key)
|
||||
{
|
||||
|
@ -381,7 +381,8 @@ namespace HandyControlDemo.Service
|
||||
{
|
||||
Key = titleKey,
|
||||
Title = title,
|
||||
DemoItemList = list
|
||||
DemoItemList = list,
|
||||
SelectedIndex = (int) item.selectedIndex
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControlDemo.Data;
|
||||
@ -24,6 +25,7 @@ namespace HandyControlDemo.UserControl
|
||||
if (tag.Equals(GlobalData.Config.Lang)) return;
|
||||
ConfigHelper.Instance.SetLang(tag);
|
||||
LangDecorator.Culture = new CultureInfo(tag);
|
||||
Messenger.Default.Send<object>(null, "LangUpdated");
|
||||
|
||||
GlobalData.Config.Lang = tag;
|
||||
GlobalData.Save();
|
||||
|
@ -9,6 +9,7 @@ using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Service;
|
||||
using HandyControlDemo.Tools;
|
||||
using HandyControlDemo.UserControl;
|
||||
@ -56,6 +57,11 @@ namespace HandyControlDemo.ViewModel
|
||||
}
|
||||
});
|
||||
|
||||
Messenger.Default.Register<object>(this, MessageToken.LangUpdated, obj =>
|
||||
{
|
||||
ContentTitle = LangDecorator.GetLang(DemoItemCurrent.Name);
|
||||
});
|
||||
|
||||
DataList = dataService.GetDemoDataList();
|
||||
DemoInfoList = dataService.GetDemoInfo();
|
||||
}
|
||||
@ -141,16 +147,20 @@ namespace HandyControlDemo.ViewModel
|
||||
if (e.AddedItems[0] is DemoItemModel item)
|
||||
{
|
||||
if (Equals(DemoItemCurrent, item)) return;
|
||||
|
||||
DemoItemCurrent = item;
|
||||
ContentTitle = item.Name;
|
||||
var obj = AssemblyHelper.ResolveByKey(item.TargetCtlName);
|
||||
var ctl = obj ?? AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
|
||||
Messenger.Default.Send(ctl is IFull, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(ctl, MessageToken.LoadShowContent);
|
||||
SwitchDemo(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void SwitchDemo(DemoItemModel item)
|
||||
{
|
||||
DemoItemCurrent = item;
|
||||
ContentTitle = LangDecorator.GetLang(item.Name);
|
||||
var obj = AssemblyHelper.ResolveByKey(item.TargetCtlName);
|
||||
var ctl = obj ?? AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
|
||||
Messenger.Default.Send(ctl is IFull, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(ctl, MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
private void OpenPracticalDemo()
|
||||
{
|
||||
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
||||
|
@ -249,6 +249,15 @@ namespace HandyControl.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LangComment {
|
||||
get {
|
||||
return ResourceManager.GetString("LangComment", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 下一页 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -228,4 +228,7 @@
|
||||
<data name="Find" xml:space="preserve">
|
||||
<value>Find</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -228,4 +228,7 @@
|
||||
<data name="Find" xml:space="preserve">
|
||||
<value>Find</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -228,4 +228,7 @@
|
||||
<data name="Find" xml:space="preserve">
|
||||
<value>Find</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -228,4 +228,7 @@
|
||||
<data name="Find" xml:space="preserve">
|
||||
<value>Find</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>Looks up a localized string similar to "{0}".</value>
|
||||
</data>
|
||||
</root>
|
@ -228,4 +228,7 @@
|
||||
<data name="Find" xml:space="preserve">
|
||||
<value>查找</value>
|
||||
</data>
|
||||
<data name="LangComment" xml:space="preserve">
|
||||
<value>查找类似 {0} 的本地化字符串。</value>
|
||||
</data>
|
||||
</root>
|
@ -26,6 +26,8 @@ namespace HandyControl.Properties.Langs
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLang(string key) => Lang.ResourceManager.GetString(key, Culture);
|
||||
|
||||
public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) =>
|
||||
BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key)
|
||||
{
|
||||
@ -56,6 +58,7 @@ namespace HandyControl.Properties.Langs
|
||||
OnPropertyChanged(nameof(Interval30s));
|
||||
OnPropertyChanged(nameof(Interval5m));
|
||||
OnPropertyChanged(nameof(IsNecessary));
|
||||
OnPropertyChanged(nameof(LangComment));
|
||||
OnPropertyChanged(nameof(NextPage));
|
||||
OnPropertyChanged(nameof(No));
|
||||
OnPropertyChanged(nameof(OutOfRange));
|
||||
@ -179,6 +182,11 @@ namespace HandyControl.Properties.Langs
|
||||
/// </summary>
|
||||
public string IsNecessary => Lang.IsNecessary;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public string LangComment => Lang.LangComment;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 下一页 的本地化字符串。
|
||||
/// </summary>
|
||||
@ -373,6 +381,11 @@ namespace HandyControl.Properties.Langs
|
||||
/// </summary>
|
||||
public static string IsNecessary = nameof(IsNecessary);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LangComment = nameof(LangComment);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 下一页 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -13,7 +13,7 @@
|
||||
{
|
||||
langDic[item] =
|
||||
@$"/// <summary>
|
||||
/// 查找类似 {Lang.ResourceManager.GetString(item, Lang.Culture)} 的本地化字符串。
|
||||
/// {string.Format(Lang.LangComment, Lang.ResourceManager.GetString(item, Lang.Culture))}
|
||||
/// </summary>";
|
||||
}
|
||||
#>
|
||||
@ -45,6 +45,8 @@ namespace HandyControl.Properties.Langs
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLang(string key) => Lang.ResourceManager.GetString(key, Culture);
|
||||
|
||||
public static void SetLang(DependencyObject dependencyObject, DependencyProperty dependencyProperty, string key) =>
|
||||
BindingOperations.SetBinding(dependencyObject, dependencyProperty, new Binding(key)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user