You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
App.xaml 不指定主窗口的情况下,直接启动托盘。目前实现不了。
Describe the solution you'd like
A clear and concise description of what you want to happen.
以下代码我测试了,可以显示icon,但是右键无法弹出contextMenu。
public partial class App : Application
{
NotifyIcon _notifyIcon = null;
protected override void OnStartup(StartupEventArgs e)
{
string apptEntryDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string iconPath = Path.Combine(apptEntryDir, "Assets\\Img\\logo.ico");
ContextMenu menu = new ContextMenu();
menu.Items.Add(new MenuItem() { Header = "主界面" });
menu.Items.Add(new MenuItem() { Header = "退出", Command = ControlCommands.ShutdownApp });
_notifyIcon = new NotifyIcon()
{
Token = "token",
Icon = new BitmapImage(new Uri(iconPath, UriKind.Absolute)),
ContextMenu = menu
};
_notifyIcon.Init();
base.OnStartup(e);
}
}
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
App.xaml 不指定主窗口的情况下,直接启动托盘。目前实现不了。
Describe the solution you'd like
A clear and concise description of what you want to happen.
以下代码我测试了,可以显示icon,但是右键无法弹出contextMenu。
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
分析源码,我发现用IsLoaded过滤了事件处理。这句话屏蔽即可正常运行,不知道这样设计是否有什么特殊原因。
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: