小编Chr*_*man的帖子

如何使通知窗口更像吐司?

我正在为我的Package Tracker应用程序创建一个通知系统...我需要知道如何使这种吐司风格比现在更高效...

我希望完成的事情:

  1. 当显示多个通知时,将其从屏幕右侧的顶部到底部停靠(以寻找更好的解决方案)<<<完成!
  2. 1条通知关闭时,将其下方的所有通知向上移动... <<<完成!

  3. 粘性通知在计算机空闲时启用。<<<完成!

  4. 如果某个特定项目存在一个通知,它将被替换,而不是创建一个新的通知。<<<完成!

要显示通知,我使用:

#region Check if Notification Exists

foreach (Form f in ActiveNotifications)
{
    string[] windowID = f.Text.Split('|');

    if (windowID[1] == NotificationTrackingNumber)
    {
        NotificationFound = true;
        f.Text = "Description=" + NotificationDescription;
        f.Text = "Status=" + NotificationStatus;
    }
}

#endregion Check if Notification Exists

if (NotificationFound)
{
    NotificationFound = false;
}
else if (!NotificationFound)
{
    notification = new Notification(NotificationDescription, NotificationStatus, NotificationTrackingNumber, min, sec, WindowID);
    notification.Closed += new EventHandler(Notification_Closed);
    notification.Show();
    ActiveNotifications.Add(notification);
    WindowID++;
}
Run Code Online (Sandbox Code Playgroud)

要在屏幕的右侧上下放置它们,请使用:

Rectangle res …
Run Code Online (Sandbox Code Playgroud)

c# notifications

5
推荐指数
0
解决办法
178
查看次数

标签 统计

c# ×1

notifications ×1