WPF-桌面应用程序 - 吐司通知的自定义音频不起作用

发布于 2025-02-11 04:32:38 字数 609 浏览 0 评论 0原文

我已经使用WPF创建了一个C#桌面应用程序来发送敬酒通知。显示敬酒通知时,我正在使用自己的自定义音频播放。我发现一些问题,当弹出通知窗口时,我的自定义声音没有播放。

我已经使用以下代码将自定义音频添加到我的通知中。

        bool supportsCustomAudio = true;

        if (AnalyticsInfo.VersionInfo.DeviceFamily.Equals("Windows.Desktop")
            && !ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2))
        {
            supportsCustomAudio = false;
        }
        if (supportsCustomAudio)
        {
            notificationBuilder.AddAudio(new Uri("ms-appx:///Assets/Audio/customaudio.mp3"));
        }

我想念什么吗?有人可以帮我解决这个问题吗?

I have created a C# desktop application using WPF for sending a toast notification. I am using my own custom audio to play when the toast notification gets displayed. I found some problems where my custom sound is not getting played when the notification window is popped out.

I have used the following code to add custom audio to my notification.

        bool supportsCustomAudio = true;

        if (AnalyticsInfo.VersionInfo.DeviceFamily.Equals("Windows.Desktop")
            && !ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2))
        {
            supportsCustomAudio = false;
        }
        if (supportsCustomAudio)
        {
            notificationBuilder.AddAudio(new Uri("ms-appx:///Assets/Audio/customaudio.mp3"));
        }

Am I missing something? Could someone please help me with the issue?

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

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

发布评论

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