gpt4 book ai didi

c# - 使用带有 Xamarin Mac 的 Controller 打开窗口

转载 作者:太空狗 更新时间:2023-10-29 21:53:22 25 4
gpt4 key购买 nike

我在 Xamarin Mac 的托盘图标应用程序上有一个状态菜单。将 Application is agent (UIElement) 设置为 1 时不会显示任何窗口。登录窗口必须仅在单击 menuItem 后显示。 (使用操作连接。)

以下代码在单击按钮后初始化了一个新的 MainWindowController。调用此操作是因为命中断点,但没有显示窗口。

partial void OpenLoginWindow(NSMenuItem sender)
{
var loginController = new MainWindowController();
loginController.Window.MakeKeyAndOrderFront(this);
loginController.ShowWindow(this);
}

当我将 Application is agent (UIElement) 设置回 0 时。单击停靠图标时会显示该窗口。但是当登录菜单项被点击时,窗口被初始化,但它并没有被带到前台。

Info.plist 中的 Main nib 文件名 设置为 MainMenu,这不是窗口的文件。

最佳答案

看起来这总是有效的。但是因为应用程序设置为 Application is agent (UIElement) 没有显示停靠项,并且在 ALT+TAB 时不显示。因为 Xamarin Studio 有焦点,窗口在后台启动。

关于c# - 使用带有 Xamarin Mac 的 Controller 打开窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34675113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com