Files
notify/Notify/Models/ToastSettings.cs
T
chuan cfb1b99162 feat: Avalonia 常驻通知应用(保活 + 弹窗 + 跨桌面)
- 常驻 Host:无主窗口保活 + 系统托盘菜单
- Toast 弹窗:堆叠 / 自动消失 / 悬停暂停 / 淡入淡出 / 点击关闭
- Sticky 常驻弹窗与 InputMode 边框配色
- 跨虚拟桌面显示(源生成 COM PinView,AOT 友好)
- 设置窗口(Semi + Ursa)+ JSON 源生成持久化
- AOT 准备:IsAotCompatible 0 警告
2026-06-22 14:25:14 +08:00

61 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace Notify.Models;
/// <summary>
/// 屏幕角落,决定 toast 堆叠的起点与方向
/// </summary>
public enum ToastCorner
{
TopLeft,
TopRight,
BottomLeft,
BottomRight,
}
/// <summary>
/// 持久化的弹窗设置(纯数据模型,序列化到磁盘)
/// </summary>
public sealed class ToastSettings
{
/// <summary>
/// 自动消失前的停留秒数
/// </summary>
public int DurationSeconds { get; set; } = 4;
/// <summary>
/// 出现的屏幕角落
/// </summary>
public ToastCorner Corner { get; set; } = ToastCorner.BottomRight;
/// <summary>
/// 不透明度 01
/// </summary>
public double Opacity { get; set; } = 0.96;
/// <summary>
/// 最多同时可见的 toast 数量,超出则排队
/// </summary>
public int MaxVisible { get; set; } = 5;
/// <summary>
/// 是否播放提示音
/// </summary>
public bool PlaySound { get; set; } = true;
/// <summary>
/// toast 宽度(DIP
/// </summary>
public double Width { get; set; } = 340;
/// <summary>
/// 淡入/淡出时长(毫秒)
/// </summary>
public int FadeMilliseconds { get; set; } = 300;
/// <summary>
/// 跨所有虚拟桌面显示(未公开 API,失败自动退回单桌面)
/// </summary>
public bool ShowOnAllDesktops { get; set; } = true;
public ToastSettings Clone() => (ToastSettings)MemberwiseClone();
}