C#WPF Toastnotifications snooze后

发布于 2025-02-10 03:48:51 字数 2076 浏览 3 评论 0原文

我在Visual Studio 2022中创建了一个C#WPF Windows应用程序。

该应用程序在按钮上按下按钮,按下“重要”,然后将其解散。 当使用贪睡按钮时,时间已经过去了,并再次显示通知,然后,现在的事件按钮并按下文本“重要”不像以前那样行为。

它以“ - 抗激活的 - 装饰”为论点进入了Onstartup,没有关于按钮还是按下的文字的信息?

我在这里错过了什么如何分开贪睡?

一些sourcecode:

      protected override void OnStartup(StartupEventArgs sea)
        {
            if (sea.Args.Count() > 0)
            {
                String s = "args:";
                foreach (var item in sea.Args)
                    s = s + "<" + item + ">";
                if (sea.Args[0] == "RKToast.xml")
                {
                    ShowNotification();
                }
                else
                if (sea.Args[0] == "-ToastActivated" && sea.Args[1] == "-Embedding")
                {
                    MessageBox.Show($"ToastAction after snooze:\r\n{s}");
                }

在示威化中:

notification = new ToastNotification(xmlDocument);
notification.Activated += ToastActivated;
notification.Dismissed += ToastDismissed;
notification.Failed += ToastFailed;
...

xmldocument很简单

<toast scenario="reminder">
    <visual>
        <binding template="ToastGeneric">
            <text>Text....</text>
            <group>
                <subgroup>
                    <text hint-align="center" hint-style="title">IMPORTANT</text>
                </subgroup>
            </group>
        </binding>
    </visual>
    <actions>
        <input id="snoozeTime" type="selection" defaultInput="1">
            <selection id="1" content="1 minut"/>
            <selection id="15" content="15 minuter"/>
            <selection id="60" content="1 time"/>
        </input>
        <action content="Now" arguments="action=[EXECUTE]" activationType="background"/>
        <action content="Later" arguments="snooze" activationType="system" hint-inputId="snoozeTime"/>
    </actions>
</toast>

I created a C# WPF windows app in Visual Studio 2022

The app handles press on buttons, press on "Important" and dismiss just fine.
When using the Snooze button, the time has passed and the notification is shown again, then the events Now button and pressing on the text "Important" does not behave as before.

It comes into the OnStartup with argument of "-ToastActivated -Embedding" and no information about if it was the button or the text that was pressed?

What am I missing here how to tell events apart after snooze?

Some of the sourcecode:

      protected override void OnStartup(StartupEventArgs sea)
        {
            if (sea.Args.Count() > 0)
            {
                String s = "args:";
                foreach (var item in sea.Args)
                    s = s + "<" + item + ">";
                if (sea.Args[0] == "RKToast.xml")
                {
                    ShowNotification();
                }
                else
                if (sea.Args[0] == "-ToastActivated" && sea.Args[1] == "-Embedding")
                {
                    MessageBox.Show(
quot;ToastAction after snooze:\r\n{s}");
                }

In ShowNotification:

notification = new ToastNotification(xmlDocument);
notification.Activated += ToastActivated;
notification.Dismissed += ToastDismissed;
notification.Failed += ToastFailed;
...

xmlDocument is simple

<toast scenario="reminder">
    <visual>
        <binding template="ToastGeneric">
            <text>Text....</text>
            <group>
                <subgroup>
                    <text hint-align="center" hint-style="title">IMPORTANT</text>
                </subgroup>
            </group>
        </binding>
    </visual>
    <actions>
        <input id="snoozeTime" type="selection" defaultInput="1">
            <selection id="1" content="1 minut"/>
            <selection id="15" content="15 minuter"/>
            <selection id="60" content="1 time"/>
        </input>
        <action content="Now" arguments="action=[EXECUTE]" activationType="background"/>
        <action content="Later" arguments="snooze" activationType="system" hint-inputId="snoozeTime"/>
    </actions>
</toast>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文