Demo adds language switching

This commit is contained in:
NaBian committed 2018-10-25 14:06:23 +08:00
1 parent 8477771161
commit ca0c8ce7a0
55 files changed
+313 -123

No files matched your search

+4 -2
View File
@@ -388,9 +388,11 @@ namespace HandyControl.Controls
/// 询问
/// </summary>
/// <param name="message"></param>
public static void Ask(string message) => Ask(new GrowlInfo
/// <param name="actionBeforeClose"></param>
public static void Ask(string message, Func<bool, bool> actionBeforeClose) => Ask(new GrowlInfo
{
Message = message
Message = message,
ActionBeforeClose = actionBeforeClose
});
/// <summary>
@@ -7,6 +7,8 @@
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="6,0,0,0"/>
<Setter Property="Template">
@@ -7,6 +7,8 @@
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="6,0,0,0"/>
<Setter Property="Template">
@@ -44,7 +46,7 @@
</Ellipse.RenderTransform>
</Ellipse>
</Border>
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true">
+5 -1
View File
@@ -1,9 +1,13 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base/RadioButtonBaseStyle.xaml"/>
<ResourceDictionary Source="ToggleButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource RadioButtonBaseStyle}" TargetType="RadioButton"/>
<Style x:Key="RadioButtonCustom" BasedOn="{StaticResource ToggleButtonCustom}" TargetType="RadioButton"/>
</ResourceDictionary>
@@ -106,6 +106,8 @@
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="0"/>
-1
View File
@@ -100,7 +100,6 @@
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
+10 -1
View File
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Threading;
using System.Windows;
using HandyControlDemo.Data;
namespace HandyControlDemo
{
@@ -12,7 +13,15 @@ namespace HandyControlDemo
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
GlobalData.Init();
Thread.CurrentThread.CurrentUICulture = new CultureInfo(GlobalData.Config.Lang);
}
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
GlobalData.Save();
}
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace HandyControlDemo.Data
{
internal class AppConfig
{
public static string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
public string Lang { get; set; } = "cn";
}
}
+29
View File
@@ -0,0 +1,29 @@
using System.IO;
using Newtonsoft.Json;
namespace HandyControlDemo.Data
{
internal class GlobalData
{
public static void Init()
{
if (File.Exists(AppConfig.SavePath))
{
var json = File.ReadAllText(AppConfig.SavePath);
Config = JsonConvert.DeserializeObject<AppConfig>(json);
}
else
{
Config = new AppConfig();
}
}
public static void Save()
{
var json = JsonConvert.SerializeObject(Config);
File.WriteAllText(AppConfig.SavePath, json);
}
public static AppConfig Config { get; set; }
}
}
+41 -34
View File
@@ -46,6 +46,9 @@
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -62,7 +65,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Data\AppConfig.cs" />
<Compile Include="Data\Enum\DemoType.cs" />
<Compile Include="Data\GlobalData.cs" />
<Compile Include="Data\MessageToken.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -447,40 +452,42 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="Resources\Img\RadioButton_16x.png" />
<Resource Include="Resources\Img\BorderElement_16x.png" />
<Resource Include="Resources\Img\ScrollBox_16x.png" />
<Resource Include="Resources\Img\ContextMenu_16x.png" />
<Resource Include="Resources\Img\WindowsForm_16x.png" />
<Resource Include="Resources\Img\TreeView_16x.png" />
<Resource Include="Resources\Img\ListBox_16x.png" />
<Resource Include="Resources\Img\CheckBox_16x.png" />
<Resource Include="Resources\Img\Path_16x.png" />
<Resource Include="Resources\Img\Paginator_16x.png" />
<Resource Include="Resources\Img\Timeline_16x.png" />
<Resource Include="Resources\Img\SplitterControl_16x.png" />
<Resource Include="Resources\Img\Carousel_16x.png" />
<Resource Include="Resources\Img\ColorPalette_16x.png" />
<Resource Include="Resources\Img\ImageBrowser_16x.png" />
<Resource Include="Resources\Img\Loading_Blue_16x.png" />
<Resource Include="Resources\Img\Message_16x.png" />
<Resource Include="Resources\Img\Flow_16x.png" />
<Resource Include="Resources\Img\TimePicker_16x.png" />
<Resource Include="Resources\Img\Time_color_16x.png" />
<Resource Include="Resources\Img\ShapeArcRing_16x.png" />
<Resource Include="Resources\Img\NumericListBox_16x.png" />
<Resource Include="Resources\Img\Toggle_16x.png" />
<Resource Include="Resources\Img\DataGrid_16x.png" />
<Resource Include="Resources\Img\TabPage_16x.png" />
<Resource Include="Resources\Img\DatePicker_16x.png" />
<Resource Include="Resources\Img\Calendar_16x.png" />
<Resource Include="Resources\Img\ProgressBar_16x.png" />
<Resource Include="Resources\Img\Expander_16x.png" />
<Resource Include="Resources\Img\PasswordBox_16x.png" />
<Resource Include="Resources\Img\TextBox_16x.png" />
<Resource Include="Resources\Img\ComboBox_16x.png" />
<Resource Include="Resources\Img\TextBlock_16x.png" />
<Resource Include="Resources\Img\ButtonClick_16x.png" />
<Resource Include="Resources\Img\Flag\cn.png" />
<Resource Include="Resources\Img\Flag\en.png" />
<Resource Include="Resources\Img\LeftMainContent\RadioButton_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\BorderElement_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ScrollBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ContextMenu_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\WindowsForm_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\TreeView_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ListBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\CheckBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Path_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Paginator_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Timeline_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\SplitterControl_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Carousel_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ColorPalette_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ImageBrowser_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Loading_Blue_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Message_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Flow_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\TimePicker_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Time_color_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ShapeArcRing_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\NumericListBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Toggle_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\DataGrid_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\TabPage_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\DatePicker_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Calendar_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ProgressBar_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Expander_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\PasswordBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\TextBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ComboBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\TextBlock_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ButtonClick_16x.png" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+45
View File
@@ -69,6 +69,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 询问 的本地化字符串。
/// </summary>
public static string Ask {
get {
return ResourceManager.GetString("Ask", resourceCulture);
}
}
/// <summary>
/// 查找类似 填写基本信息 的本地化字符串。
/// </summary>
@@ -123,6 +132,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 是否重启以更改语言? 的本地化字符串。
/// </summary>
public static string ChangeLangAsk {
get {
return ResourceManager.GetString("ChangeLangAsk", resourceCulture);
}
}
/// <summary>
/// 查找类似 复选框 的本地化字符串。
/// </summary>
@@ -141,6 +159,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 清空 的本地化字符串。
/// </summary>
public static string Clear {
get {
return ResourceManager.GetString("Clear", resourceCulture);
}
}
/// <summary>
/// 查找类似 时钟 的本地化字符串。
/// </summary>
@@ -240,6 +267,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 错误 的本地化字符串。
/// </summary>
public static string Error {
get {
return ResourceManager.GetString("Error", resourceCulture);
}
}
/// <summary>
/// 查找类似 展开框 的本地化字符串。
/// </summary>
@@ -249,6 +285,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 严重 的本地化字符串。
/// </summary>
public static string Fatal {
get {
return ResourceManager.GetString("Fatal", resourceCulture);
}
}
/// <summary>
/// 查找类似 信息通知 的本地化字符串。
/// </summary>
@@ -345,4 +345,19 @@
<data name="Ignore" xml:space="preserve">
<value>Ignore</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="Ask" xml:space="preserve">
<value>Ask</value>
</data>
<data name="Fatal" xml:space="preserve">
<value>Fatal</value>
</data>
<data name="Clear" xml:space="preserve">
<value>Clear</value>
</data>
<data name="ChangeLangAsk" xml:space="preserve">
<value>Whether to restart to change the language?</value>
</data>
</root>
@@ -325,4 +325,19 @@
<data name="Ignore" xml:space="preserve">
<value>忽略</value>
</data>
<data name="Error" xml:space="preserve">
<value>错误</value>
</data>
<data name="Ask" xml:space="preserve">
<value>询问</value>
</data>
<data name="Fatal" xml:space="preserve">
<value>严重</value>
</data>
<data name="Clear" xml:space="preserve">
<value>清空</value>
</data>
<data name="ChangeLangAsk" xml:space="preserve">
<value>是否重启以更改语言?</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 266 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 624 B

After

Width:  |  Height:  |  Size: 624 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 383 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 401 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 561 B

After

Width:  |  Height:  |  Size: 561 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 704 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 174 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 434 B

After

Width:  |  Height:  |  Size: 434 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 249 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 417 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 143 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 143 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

@@ -2,17 +2,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
Background="White">
<controls:TransitioningContentControl>
<WrapPanel Margin="32" VerticalAlignment="Center">
<Button Command="{Binding InfoCmd}" Content="Info" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
<Button Command="{Binding SuccessCmd}" Content="Success" Margin="5" Style="{StaticResource ButtonSuccess}"/>
<Button Command="{Binding WarningCmd}" Content="Warning" Margin="5" Style="{StaticResource ButtonWarning}"/>
<Button Command="{Binding ErrorCmd}" Content="Error" Margin="5" Style="{StaticResource ButtonDanger}"/>
<Button Command="{Binding AskCmd}" Content="Ask" Margin="5" Background="BlueViolet" Foreground="White"/>
<Button Command="{Binding FatalCmd}" Content="Fatal" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="Clear" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</WrapPanel>
</controls:TransitioningContentControl>
</UserControl>
@@ -17,97 +17,97 @@
<ListBox BorderThickness="0" SelectionMode="Single">
<ListBoxItem Tag="{x:Static data:MessageToken.ButtonDemoCtl}" Content="{x:Static langs:Lang.Button}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ButtonClick_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ButtonClick_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ToggleButtonDemoCtl}" Content="{x:Static langs:Lang.ToggleButton}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Toggle_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Toggle_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RadioButtonDemoCtl}" Content="{x:Static langs:Lang.RadioButton}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/RadioButton_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/RadioButton_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.CheckBoxDemoCtl}" Content="{x:Static langs:Lang.CheckBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/CheckBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/CheckBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.NaiveScrollViewerDemoCtl}" Content="{x:Static langs:Lang.ScrollViewer}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ScrollBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TextBlockDemoCtl}" Content="{x:Static langs:Lang.TextBlock}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TextBlock_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TextBlock_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TextBoxDemoCtl}" Content="{x:Static langs:Lang.TextBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TextBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TextBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ComboBoxDemoCtl}" Content="{x:Static langs:Lang.ComboBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ComboBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ComboBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.PasswordBoxDemoCtl}" Content="{x:Static langs:Lang.PasswordBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/PasswordBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/PasswordBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ExpanderDemoCtl}" Content="{x:Static langs:Lang.Expander}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Expander_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Expander_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ProgressBarDemoCtl}" Content="{x:Static langs:Lang.ProgressBar}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ProgressBar_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ProgressBar_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.CalendarDemoCtl}" Content="{x:Static langs:Lang.Calendar}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Calendar_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Calendar_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.DatePickerDemoCtl}" Content="{x:Static langs:Lang.DatePicker}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/DatePicker_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/DatePicker_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.NaiveTabControlDemoCtl}" Content="{x:Static langs:Lang.TabControl}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TabPage_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TabPage_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.DataGridDemoCtl}" Content="{x:Static langs:Lang.DataGrid}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/DataGrid_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/DataGrid_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TreeViewDemoCtl}" Content="{x:Static langs:Lang.TreeView}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TreeView_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TreeView_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ListBoxDemoCtl}" Content="{x:Static langs:Lang.ListBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ListBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ListBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.MenuDemoCtl}" Content="{x:Static langs:Lang.Menu}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ContextMenu_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ContextMenu_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.BorderDemoCtl}" Content="{x:Static langs:Lang.Border1}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/BorderElement_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/BorderElement_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
</ListBox>
@@ -116,87 +116,87 @@
<ListBox BorderThickness="0" SelectionMode="Single">
<ListBoxItem Tag="{x:Static data:MessageToken.NumericUpDownDemoCtl}" Content="{x:Static langs:Lang.NumericUpDown}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/NumericListBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/NumericListBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.CirclePanelDemoCtl}" Content="{x:Static langs:Lang.CirclePanel}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ShapeArcRing_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ShapeArcRing_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ClockDemoCtl}" Content="{x:Static langs:Lang.Clock}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Time_color_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Time_color_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TimePickerDemoCtl}" Content="{x:Static langs:Lang.TimePicker}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TimePicker_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TimePicker_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.StepBarDemoCtl}" Content="{x:Static langs:Lang.StepBar}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Flow_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Flow_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.GrowlDemoCtl}" Content="{x:Static langs:Lang.Growl}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Message_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Message_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.LoadingDemoCtl}" Content="{x:Static langs:Lang.Loading}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Loading_Blue_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Loading_Blue_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ImageBrowserDemoCtl}" Content="{x:Static langs:Lang.ImageBrowser}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ImageBrowser_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ImageBrowser_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ColorPickerDemoCtl}" Content="{x:Static langs:Lang.ColorPicker}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ColorPalette_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ColorPalette_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.CarouselDemoCtl}" Content="{x:Static langs:Lang.Carousel}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Carousel_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Carousel_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.CompareSliderDemoCtl}" Content="{x:Static langs:Lang.CompareSlider}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/SplitterControl_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/SplitterControl_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TimeBarDemoCtl}" Content="{x:Static langs:Lang.TimeBar}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Timeline_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Timeline_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.PaginationDemoCtl}" Content="{x:Static langs:Lang.Pagination}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Paginator_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Paginator_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.AnimationPathDemoCtl}" Content="{x:Static langs:Lang.AnimationPath}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/Path_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/Path_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TabControlDemoCtl}" Content="{x:Static langs:Lang.TabControl}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/TabPage_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/TabPage_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ScrollViewerDemoCtl}" Content="{x:Static langs:Lang.ScrollViewer}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/ScrollBox_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.WindowDemoCtl}" Content="{x:Static langs:Lang.Window}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/WindowsForm_16x.png" Stretch="Uniform"/>
<Image Source="../../Resources/Img/LeftMainContent/WindowsForm_16x.png" Stretch="Uniform"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
</ListBox>
@@ -1,30 +1,51 @@
<StackPanel x:Class="HandyControlDemo.UserControl.NoUserContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
Orientation="Horizontal">
<Button WindowChrome.IsHitTestVisibleInChrome="True" Margin="4,0,0,0" Width="28" Height="28" Style="{StaticResource ButtonCustom}">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Click">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.ShowSystemMenuCommand}" />
</interactivity:EventTrigger>
<interactivity:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.CloseWindowCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
<Grid x:Class="HandyControlDemo.UserControl.NoUserContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Stretch" Orientation="Horizontal">
<Button WindowChrome.IsHitTestVisibleInChrome="True" Margin="4,0,0,0" Width="28" Height="28" Style="{StaticResource ButtonCustom}">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Click">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.ShowSystemMenuCommand}" />
</interactivity:EventTrigger>
<interactivity:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.CloseWindowCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
</Button>
<Menu Margin="10,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True" Background="Transparent">
<MenuItem Foreground="White" Header="File">
<MenuItem Header="New repository" InputGestureText="Ctrl+N"/>
<Separator/>
<MenuItem Header="Add local repository"/>
<MenuItem Header="Clone repository"/>
</MenuItem>
<MenuItem Foreground="White" Header="Edit"/>
<MenuItem Foreground="White" Header="View"/>
<MenuItem Foreground="White" Header="Repository"/>
<MenuItem Foreground="White" Header="Branch"/>
<MenuItem Foreground="White" Header="Help"/>
</Menu>
</StackPanel>
<Button Grid.Column="1" Click="ButtonLang_OnClick" Name="ButtonLang" Width="44" Style="{StaticResource ButtonCustom}" Background="Transparent">
<Image Name="ImageLang" Width="24" Stretch="Uniform"/>
</Button>
<Menu Margin="10,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True" Background="Transparent">
<MenuItem Foreground="White" Header="File">
<MenuItem Header="New repository" InputGestureText="Ctrl+N"/>
<Separator/>
<MenuItem Header="Add local repository"/>
<MenuItem Header="Clone repository"/>
</MenuItem>
<MenuItem Foreground="White" Header="Edit"/>
<MenuItem Foreground="White" Header="View"/>
<MenuItem Foreground="White" Header="Repository"/>
<MenuItem Foreground="White" Header="Branch"/>
<MenuItem Foreground="White" Header="Help"/>
</Menu>
</StackPanel>
<Popup AllowsTransparency="True" Grid.Column="1" PlacementTarget="{Binding ElementName=ButtonLang}" HorizontalOffset="-4" Name="PopupLang" VerticalOffset="6" StaysOpen="False">
<Border Background="White" CornerRadius="4" Margin="16" Effect="{StaticResource EffectShadow2}">
<StackPanel Button.Click="ButtonLangs_OnClick" Margin="10">
<Button Tag="cn" Style="{StaticResource ButtonCustom}">
<Image Width="32" Stretch="Uniform" Source="/HandyControlDemo;component/Resources/Img/Flag/cn.png"/>
</Button>
<Button Tag="en" Style="{StaticResource ButtonCustom}" Margin="0,10,0,0">
<Image Width="32" Stretch="Uniform" Source="/HandyControlDemo;component/Resources/Img/Flag/en.png"/>
</Button>
</StackPanel>
</Border>
</Popup>
</Grid>
@@ -1,14 +1,43 @@
// ReSharper disable once CheckNamespace
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using HandyControl.Controls;
using HandyControlDemo.Data;
// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
{
/// <summary>
/// NoUserContent.xaml 的交互逻辑
/// </summary>
public partial class NoUserContent
{
public NoUserContent()
{
InitializeComponent();
ImageLang.Source = BitmapFrame.Create(new Uri($"pack://application:,,,/HandyControlDemo;component/Resources/Img/Flag/{GlobalData.Config.Lang}.png"));
}
private void ButtonLang_OnClick(object sender, RoutedEventArgs e) => PopupLang.IsOpen = true;
private void ButtonLangs_OnClick(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is Button button && button.Tag is string tag)
{
PopupLang.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();
Process.Start(Assembly.GetExecutingAssembly().Location);
Environment.Exit(0);
return true;
});
}
}
}
}
@@ -29,14 +29,10 @@ namespace HandyControlDemo.ViewModel
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError))).Value;
public RelayCommand AskCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Ask(new GrowlInfo
new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
{
Message = Properties.Langs.Lang.GrowlAsk,
ActionBeforeClose = isConfirmed =>
{
Growl.Info(isConfirmed.ToString());
return true;
}
Growl.Info(isConfirmed.ToString());
return true;
}))).Value;
public RelayCommand FatalCmd => new Lazy<RelayCommand>(() =>
+1
View File
@@ -2,4 +2,5 @@
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net462" />
<package id="MvvmLightLibs" version="5.4.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net462" />
</packages>