add Notification

This commit is contained in:
NaBian committed 2019-08-16 00:30:15 +08:00
1 parent 436f5d076b
commit a4e80e288d
30 files changed
+440 -78

No files matched your search

@@ -6,6 +6,7 @@
xmlns:d1P1="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:data="clr-namespace:HandyControlDemo.Data"
xmlns:hc="https://handyorg.github.io/handycontrol"
d1P1:Ignorable="d"
StartupUri="MainWindow.xaml">
<Application.Resources>
@@ -35,6 +36,12 @@
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ShowAnimations" MethodName="GetValues" ObjectType="sys:Enum">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="hc:ShowAnimation"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</ResourceDictionary>
</Application.Resources>
@@ -112,6 +112,8 @@
public static readonly string SpriteDemoCtl = nameof(SpriteDemoCtl);
public static readonly string NotificationDemoCtl = nameof(NotificationDemoCtl);
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
@@ -58,7 +58,8 @@ var controlList = new List<string>
"ImageBlockDemoCtl",
"RunningBlockDemoCtl",
"HoneycombPanelDemoCtl",
"SpriteDemoCtl"
"SpriteDemoCtl",
"NotificationDemoCtl"
};
var styleList = new List<string>
{
@@ -63,6 +63,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\MagnifierDemoCtl.xaml.cs">
<DependentUpon>MagnifierDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\NotificationDemoCtl.xaml.cs">
<DependentUpon>NotificationDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml.cs">
<DependentUpon>RangeSliderDemoCtl.xaml</DependentUpon>
</Compile>
@@ -207,6 +210,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\WindowDemoCtl.xaml.cs">
<DependentUpon>WindowDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\AppNotification.xaml.cs">
<DependentUpon>AppNotification.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml.cs">
<DependentUpon>BlogsView.xaml</DependentUpon>
</Compile>
@@ -324,6 +330,7 @@
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\DialogDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\GrowlDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\ImageBrowserDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\NotificationDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\NotifyIconDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
@@ -451,6 +458,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\NotificationDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -643,6 +654,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\AppNotification.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -852,6 +852,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 桌面通知 的本地化字符串。
/// </summary>
public static string Notification {
get {
return ResourceManager.GetString("Notification", resourceCulture);
}
}
/// <summary>
/// 查找类似 托盘图标 的本地化字符串。
/// </summary>
@@ -1320,6 +1329,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 发送通知 的本地化字符串。
/// </summary>
public static string SendNotification {
get {
return ResourceManager.GetString("SendNotification", resourceCulture);
}
}
/// <summary>
/// 查找类似 徽章 的本地化字符串。
/// </summary>
@@ -1383,6 +1401,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 保持打开 的本地化字符串。
/// </summary>
public static string StaysOpen {
get {
return ResourceManager.GetString("StaysOpen", resourceCulture);
}
}
/// <summary>
/// 查找类似 步骤 的本地化字符串。
/// </summary>
@@ -651,4 +651,13 @@
<data name="OpenSprite" xml:space="preserve">
<value>Open sprite</value>
</data>
<data name="Notification" xml:space="preserve">
<value>Notification</value>
</data>
<data name="SendNotification" xml:space="preserve">
<value>Send notification</value>
</data>
<data name="StaysOpen" xml:space="preserve">
<value>Stays open</value>
</data>
</root>
@@ -651,4 +651,13 @@
<data name="OpenSprite" xml:space="preserve">
<value>打开精灵</value>
</data>
<data name="Notification" xml:space="preserve">
<value>桌面通知</value>
</data>
<data name="SendNotification" xml:space="preserve">
<value>发送通知</value>
</data>
<data name="StaysOpen" xml:space="preserve">
<value>保持打开</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

@@ -0,0 +1,18 @@
<UserControl x:Class="HandyControlDemo.UserControl.NotificationDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding NotificationDemo,Source={StaticResource Locator}}"
Width="300"
Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl>
<StackPanel Margin="32" VerticalAlignment="Center">
<ComboBox SelectedValue="{Binding ShowAnimation}" ItemsSource="{Binding Source={StaticResource ShowAnimations}}"/>
<hc:ButtonGroup Margin="0,16,0,0">
<ToggleButton Content="{x:Static langs:Lang.StaysOpen}" IsChecked="{Binding StaysOpen}"/>
<Button Command="{Binding OpenCmd}" Content="{x:Static langs:Lang.SendNotification}"/>
</hc:ButtonGroup>
</StackPanel>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class NotificationDemoCtl
{
public NotificationDemoCtl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,13 @@
<Border x:Class="HandyControlDemo.UserControl.AppNotification"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="White"
Width="320"
Height="518">
<hc:SimplePanel>
<Path Margin="0,36,0,0" VerticalAlignment="Top" Width="70" Height="70" Data="{StaticResource LogoGeometry}" Fill="#f06632"/>
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" HorizontalAlignment="Center" Margin="0,122,0,0" VerticalAlignment="Top"/>
<Button Command="hc:ControlCommands.CloseWindow" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Content="{x:Static hc:Lang.Close}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,0,10,10"/>
</hc:SimplePanel>
</Border>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class AppNotification
{
public AppNotification()
{
InitializeComponent();
}
}
}
@@ -200,7 +200,7 @@
<Image Source="../../Resources/Img/LeftMainContent/ImageStack_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.MagnifierDemoCtl}" Content="{x:Static langs:Lang.Magnifier}">
<ListBoxItem Tag="{x:Static data:MessageToken.MagnifierDemoCtl}" Content="{x:Static langs:Lang.Magnifier}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Search_16x.png"/>
</hc:EdgeElement.LeftContent>
@@ -450,6 +450,11 @@
<Image Source="../../Resources/Img/LeftMainContent/HandyControl.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.NotificationDemoCtl}" Content="{x:Static langs:Lang.Notification}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Procedure_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.DialogDemoCtl}" Content="{x:Static langs:Lang.Dialog}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Dialog_16x.png"/>
@@ -7,7 +7,7 @@ using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Tools.Extension;
namespace HandyControlDemo.ViewModel.Basic
namespace HandyControlDemo.ViewModel
{
public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable<string>
{
@@ -6,7 +6,7 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
#endif
namespace HandyControlDemo.ViewModel.Controls
namespace HandyControlDemo.ViewModel
{
public class BadgeDemoViewModel : ViewModelBase
{
@@ -11,7 +11,6 @@ using HandyControl.Controls;
using HandyControl.Tools.Extension;
using HandyControlDemo.Data;
using HandyControlDemo.UserControl;
using HandyControlDemo.ViewModel.Basic;
using HandyControlDemo.Window;
namespace HandyControlDemo.ViewModel
@@ -0,0 +1,35 @@
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using System;
using GalaSoft.MvvmLight;
using HandyControl.Controls;
using HandyControl.Data;
using HandyControlDemo.UserControl;
namespace HandyControlDemo.ViewModel
{
public class NotificationDemoViewModel : ViewModelBase
{
public RelayCommand OpenCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Notification.Show(new AppNotification(), ShowAnimation, StaysOpen))).Value;
private ShowAnimation _showAnimation;
public ShowAnimation ShowAnimation
{
get => _showAnimation;
set => Set(ref _showAnimation, value);
}
private bool _staysOpen = true;
public bool StaysOpen
{
get => _staysOpen;
set => Set(ref _staysOpen, value);
}
}
}
@@ -1,5 +1,4 @@
using System;
using GalaSoft.MvvmLight;
using HandyControl.Controls;
using HandyControlDemo.UserControl;
#if netle40
@@ -8,9 +7,9 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
# endif
namespace HandyControlDemo
namespace HandyControlDemo.ViewModel
{
public class SpriteDemoViewModel : ViewModelBase
public class SpriteDemoViewModel
{
public RelayCommand OpenCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value;
@@ -4,8 +4,6 @@ using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;
using HandyControlDemo.Data;
using HandyControlDemo.Service;
using HandyControlDemo.ViewModel.Basic;
using HandyControlDemo.ViewModel.Controls;
namespace HandyControlDemo.ViewModel
{
@@ -40,6 +38,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register<NoUserViewModel>();
SimpleIoc.Default.Register<CardDemoViewModel>();
SimpleIoc.Default.Register<SpriteDemoViewModel>();
SimpleIoc.Default.Register<NotificationDemoViewModel>();
}
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
@@ -93,6 +92,8 @@ namespace HandyControlDemo.ViewModel
public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance<SpriteDemoViewModel>();
public NotificationDemoViewModel NotificationDemo => ServiceLocator.Current.GetInstance<NotificationDemoViewModel>();
#endregion
}
}