# Notification 通知提醒框

Notification 用于展示比 `Message` 更完整的通知卡片，通常包含标题、正文、状态图标和关闭按钮，适合系统通知、异步任务结果、重要操作反馈。

它是静态弹层组件，不需要创建普通控件实例。aardio 中建议先在窗口中嵌入 `AntdUI.BaseForm` 作为 owner，再把 `baseForm` 传给 `Notification.Config` 或快捷方法。

## 最小示例

```aardio
import win.ui;
import dotNet;
import dotNet.AntdUI;
import System.Windows.Forms;

var winform = win.form(text="AntdUI Notification";right=640;bottom=360)
winform.add(
customBase={cls="custom";left=0;top=0;right=640;bottom=360;z=1};
btn={cls="button";text="显示通知";left=40;top=40;right=180;bottom=76;z=2}
)

var baseForm = AntdUI.BaseForm(winform.customBase);

winform.btn.oncommand = function(){
    var cfg = AntdUI.Notification.Config(
        baseForm,
        "任务完成",
        "文件已导出到桌面。",
        AntdUI.TType.Success,
        AntdUI.TAlignFrom.TR
    );
    cfg.AutoClose = 5;
    cfg.ShowInWindow = true;
    AntdUI.Notification.open(cfg);
}

winform.show();
win.loopMessage();
```

## 常用快捷方法

当前 DLL 提供这些常用静态方法：

- `AntdUI.Notification.success(form,title,text,align,font,autoClose)`
- `AntdUI.Notification.info(form,title,text,align,font,autoClose)`
- `AntdUI.Notification.warn(form,title,text,align,font,autoClose)`
- `AntdUI.Notification.error(form,title,text,align,font,autoClose)`
- `AntdUI.Notification.open(config)`
- `AntdUI.Notification.close_all()` / `close_id(id)` / `contains(id)`

快捷方法参数较长，实际开发中更推荐配置对象。

## Config 常用字段

- `ID`：通知 ID，可用于 `close_id(id)` 与 `contains(id)`。
- `Title` / `Text`：标题与正文。
- `Icon`：状态图标，常用 `AntdUI.TType.Success/Info/Warn/Error`。
- `Align`：弹出位置，常用 `TL/TR/BL/BR/Top/Bottom`。
- `Radius`：圆角。
- `AutoClose`：自动关闭秒数，`0` 表示不自动关闭。
- `ClickClose`：点击通知关闭。
- `CloseIcon`：显示关闭按钮。
- `TopMost`：是否置顶。
- `ShowInWindow`：是否在 owner 窗口内显示。
- `EnableSound`：系统声音。
- `Back` / `Fore`：自定义背景与文字颜色。
- `OnClose`：关闭回调。

## 位置与类型

```aardio
var cfg = AntdUI.Notification.Config(baseForm,"同步失败","网络连接超时",AntdUI.TType.Error,AntdUI.TAlignFrom.BR);
cfg.AutoClose = 0; // 不自动关闭
cfg.CloseIcon = true;
AntdUI.Notification.open(cfg);
```

常用位置枚举：

- `AntdUI.TAlignFrom.TL`：左上
- `AntdUI.TAlignFrom.TR`：右上
- `AntdUI.TAlignFrom.BL`：左下
- `AntdUI.TAlignFrom.BR`：右下
- `AntdUI.TAlignFrom.Top` / `Bottom`：顶部/底部居中

## 带链接的通知

当前 DLL 的 `Notification.Config` 支持 `SetLink(text, callback)` 与 `Link/Links`，可为通知添加操作入口。aardio 侧如果回调转换遇到版本差异，可退回到只展示通知，或用按钮/Modal 处理下一步操作。

```aardio
var cfg = AntdUI.Notification.Config(baseForm,"备份完成","点击查看备份目录",AntdUI.TType.Info,AntdUI.TAlignFrom.TR);
cfg.SetLink("打开目录",function(){
    raw.execute(io.fullpath("~/"));
    return true;
});
AntdUI.Notification.open(cfg);
```

## 注意

- `baseForm` 应保持存活；不要在 owner 窗口销毁后继续弹通知。
- 多条通知可用 `ID` 管理，避免重复弹出相同消息。
- 窗口内通知建议设置 `ShowInWindow = true`，更符合嵌入式 aardio 界面体验。
