add NotifyIcon and Notification docs

This commit is contained in:
NaBian 2020-08-11 23:23:13 +08:00
parent a22822624d
commit b4d1616753
3 changed files with 105 additions and 11 deletions

View File

@ -1,3 +1,54 @@
---
title: Notification
title: Notification 桌面通知
---
用于在桌面显示一则富内容消息.
```cs
public sealed class Notification : System.Windows.Window
```
# 方法
|名称|说明|
|-|-|
| Show(object, ShowAnimation, bool) | 显示桌面通知(消息内容, 动画效果类型, 是否保持打开) |
# 案例
```xml
<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"
BorderThickness="1"
BorderBrush="{DynamicResource BorderBrush}"
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="{hc:Lang Key={x:Static hc:LangKeys.Close}}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,0,10,10"/>
</hc:SimplePanel>
</Border>
```
```cs
namespace HandyControlDemo.UserControl
{
public partial class AppNotification
{
public AppNotification()
{
InitializeComponent();
}
}
}
```
```cs
Notification.Show(new AppNotification(), ShowAnimation.Fade, true)
```
![Notification](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Notification.png)

View File

@ -1,5 +1,48 @@
---
title: 建设中
title: NotifyIcon 托盘图标
---
建设中
系统托盘图标的wpf实现方式.
```cs
public class NotifyIcon : FrameworkElement, IDisposable
```
# 属性
|属性|描述|默认值|备注|
|-|-|-|-|
|Token|用于设置消息标记||用于在指定的托盘图标上显示气泡提示|
|Text|鼠标提示文本|||
|Icon|图标|||
|ContextContent|右键弹出内容|||
|BlinkInterval|闪烁间隔|500ms||
|IsBlink|是否闪烁|false|||
# 方法
|名称|说明|
|-|-|
| Init() | 初始化 |
| Register(string, NotifyIcon) | 为指定的托盘图标注册消息标记 |
| Unregister(string, NotifyIcon) | 为指定的托盘图标取消消息标记的注册 |
| Unregister(NotifyIcon) | 如果该托盘图标注册了消息标记则取消注册 |
| Unregister(string) | 如果该消息标记有对应的托盘图标则取消注册 |
| ShowBalloonTip(string, string, NotifyIconInfoType, string) | 显示气泡提示 |
| ShowBalloonTip(string, string, NotifyIconInfoType) | 显示气泡提示 |
| CloseContextControl() | 关闭上下文控件 |
# 事件
|名称|说明|
|-|-|
| Click | 单击时触发 |
| MouseDoubleClick | 双击时触发 |
# 案例
```xml
<hc:NotifyIcon Text="HandyControl" IsBlink="true" Visibility="Visible" Icon="/HandyControlDemo;component/Resources/Img/icon-white.ico"/>
```
![NotifyIcon](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/NotifyIcon.gif)