【问题标题】:Windows Universal Apps and trayWindows 通用应用程序和托盘
【发布时间】:2015-12-09 18:55:55
【问题描述】:

我打算编写一个在托盘中运行的 Windows 通用应用程序。在托盘图标上会有一个带有多个选项的上下文菜单(用于添加新的时间日志,用于关闭当前的)。但根据这篇帖子System tray/taskbar icon/notify icon with universal apps,不可能在托盘中运行 WUP。真的吗??

托盘是否仅适用于系统应用程序和旧款应用程序?

还有其他选择吗?有固定任务栏图标的菜单项,可能是?

谢谢

【问题讨论】:

  • 如果查看应用程序的主要方式是通过托盘,或者您希望应用程序始终在桌面 PC 的后台运行,那么通用应用程序既不适合也不适合这种情况。

标签: windows-10 win-universal-app system-tray


【解决方案1】:

通用应用无法将自身添加到通知区域,但最近的 Windows 10 更新使它们能够将项目添加到右键单击项目的任务栏图标或磁贴时显示的 JumpList

bool jumpListPresent = Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList");
if (jumpListPresent && JumpList.IsSupported()) 
{
    JumpList jl = await JumpList.LoadCurrentAsync();
    jl.Items.Clear();
    JumpListItem jli = JumpListItem.CreateWithArguments("myJumpListItem", "my Jump List Item");
    jl.Items.Add(jli);
    await jl.SaveAsync();
}

【讨论】:

  • 可能没有最后一次更新,噗……不过谢谢。
【解决方案2】:

据我所知,UWP 应用程序不可能有托盘图标。以前,Windows 应用程序设计为在全屏模式下运行。

如果这是一个 LOB 应用,您可以尝试使用代理组件来访问托盘图标功能。

谢谢,

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-01
    • 1970-01-01
    • 2011-07-20
    • 1970-01-01
    相关资源
    最近更新 更多