enhance: Growl demo.
This commit is contained in:
1 parent
8405e7f2b1
commit
83fc434e7d
5 files changed
+168
-71
No files matched your search
@@ -2,12 +2,12 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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:data="clr-namespace:HandyControlDemo.Data"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
d1P1:Ignorable="d"
|
||||
d1P1:Ignorable="d"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
@@ -30,6 +30,7 @@
|
||||
<hc:EnumDataProvider x:Key="DemoTypes" Type="data:DemoType"/>
|
||||
<hc:EnumDataProvider x:Key="ShowAnimations" Type="hc:ShowAnimation"/>
|
||||
<hc:EnumDataProvider x:Key="HatchStyles" Type="hc:HatchStyle"/>
|
||||
<hc:EnumDataProvider x:Key="TransitionModes" Type="hc:TransitionMode"/>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -7,30 +7,82 @@
|
||||
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<hc:TransitioningContentControl>
|
||||
<StackPanel Margin="32">
|
||||
<GroupBox Header="Window" Padding="10,5">
|
||||
<hc:UniformSpacingPanel Margin="32"
|
||||
Orientation="Vertical"
|
||||
Spacing="32">
|
||||
<ComboBox SelectedValue="{Binding TransitionMode}"
|
||||
ItemsSource="{Binding Source={StaticResource TransitionModes}}" />
|
||||
<GroupBox Header="Window"
|
||||
Padding="10,5">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<Button Command="{Binding InfoCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Info}}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
|
||||
<Button Command="{Binding SuccessCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Success}}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
|
||||
<Button Command="{Binding WarningCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}" Margin="5" Style="{StaticResource ButtonWarning}"/>
|
||||
<Button Command="{Binding ErrorCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Error}}" Margin="5" Style="{StaticResource ButtonDanger}"/>
|
||||
<Button Command="{Binding AskCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Ask}}" Margin="5" Background="BlueViolet" Foreground="White" BorderThickness="0"/>
|
||||
<Button Command="{Binding FatalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Fatal}}" Margin="5,0"/>
|
||||
<Button Command="{Binding ClearCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Clear}}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Command="{Binding InfoCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Info}}"
|
||||
Margin="0,5,5,5"
|
||||
Style="{StaticResource ButtonInfo}" />
|
||||
<Button Command="{Binding SuccessCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Success}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button Command="{Binding WarningCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonWarning}" />
|
||||
<Button Command="{Binding ErrorCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Error}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
<Button Command="{Binding AskCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Ask}}"
|
||||
Margin="5"
|
||||
Background="BlueViolet"
|
||||
Foreground="White"
|
||||
BorderThickness="0" />
|
||||
<Button Command="{Binding FatalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Fatal}}"
|
||||
Margin="5,0" />
|
||||
<Button Command="{Binding ClearCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Clear}}"
|
||||
Margin="5,0,0,0"
|
||||
Style="{StaticResource ButtonPrimary}" />
|
||||
</WrapPanel>
|
||||
</GroupBox>
|
||||
<Button Command="{Binding NewWindowCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.NewWindow}}" Margin="0,32" HorizontalAlignment="Left"/>
|
||||
<GroupBox Header="Desktop" Padding="10,5">
|
||||
<Button Command="{Binding NewWindowCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.NewWindow}}"
|
||||
HorizontalAlignment="Left" />
|
||||
<GroupBox Header="Desktop"
|
||||
Padding="10,5">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<Button Command="{Binding InfoGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Info}}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
|
||||
<Button Command="{Binding SuccessGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Success}}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
|
||||
<Button Command="{Binding WarningGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}" Margin="5" Style="{StaticResource ButtonWarning}"/>
|
||||
<Button Command="{Binding ErrorGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Error}}" Margin="5" Style="{StaticResource ButtonDanger}"/>
|
||||
<Button Command="{Binding AskGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Ask}}" Margin="5" Background="BlueViolet" Foreground="White" BorderThickness="0"/>
|
||||
<Button Command="{Binding FatalGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Fatal}}" Margin="5,0"/>
|
||||
<Button Command="{Binding ClearGlobalCmd}" Content="{ex:Lang Key={x:Static langs:LangKeys.Clear}}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Command="{Binding InfoGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Info}}"
|
||||
Margin="0,5,5,5"
|
||||
Style="{StaticResource ButtonInfo}" />
|
||||
<Button Command="{Binding SuccessGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Success}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button Command="{Binding WarningGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonWarning}" />
|
||||
<Button Command="{Binding ErrorGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Error}}"
|
||||
Margin="5"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
<Button Command="{Binding AskGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Ask}}"
|
||||
Margin="5"
|
||||
Background="BlueViolet"
|
||||
Foreground="White"
|
||||
BorderThickness="0" />
|
||||
<Button Command="{Binding FatalGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Fatal}}"
|
||||
Margin="5,0" />
|
||||
<Button Command="{Binding ClearGlobalCmd}"
|
||||
Content="{ex:Lang Key={x:Static langs:LangKeys.Clear}}"
|
||||
Margin="5,0,0,0"
|
||||
Style="{StaticResource ButtonPrimary}" />
|
||||
</WrapPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
@@ -6,10 +7,12 @@ using HandyControlDemo.Window;
|
||||
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class GrowlDemoViewModel
|
||||
public class GrowlDemoViewModel : ViewModelBase
|
||||
{
|
||||
private readonly string _token;
|
||||
|
||||
private TransitionMode _transitionMode;
|
||||
|
||||
public GrowlDemoViewModel()
|
||||
{
|
||||
|
||||
@@ -20,6 +23,24 @@ public class GrowlDemoViewModel
|
||||
_token = token;
|
||||
}
|
||||
|
||||
public TransitionMode TransitionMode
|
||||
{
|
||||
get => _transitionMode;
|
||||
#if NET40
|
||||
set
|
||||
{
|
||||
Set(nameof(TransitionMode), ref _transitionMode, value);
|
||||
Growl.SetTransitionMode(Application.Current.MainWindow, value);
|
||||
}
|
||||
#else
|
||||
set
|
||||
{
|
||||
Set(ref _transitionMode, value);
|
||||
Growl.SetTransitionMode(Application.Current.MainWindow, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Window
|
||||
|
||||
public RelayCommand InfoCmd => new(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token));
|
||||
|
||||
Reference in new issue
Block a user