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

@@ -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;
});
}
}
}
}