简体   繁体   English

在Citrix中运行时,如何防止WPF + win32应用程序任务栏图标更改为Citrix默认图标?

[英]How to prevent WPF+win32 app taskbar icon from changing to Citrix default icon when run in Citrix?

I have a WPF application with lots of native code and win32 windows. 我有一个带有许多本机代码和Win32 Windows的WPF应用程序。 Program's Application's icon is defined in VS2015 project as ..\\gui\\rc\\MyApp.ico. 程序的应用程序图标在VS2015项目中定义为.. \\ gui \\ rc \\ MyApp.ico。 When I start program in XenApp Citrix: 在XenApp Citrix中启动程序时:

  1. Splash appears 出现飞溅
  2. WPF Login window appears with correct App icon in taskbar WPF登录窗口出现在任务栏中,带有正确的应用程序图标
  3. After login a splash appears again and taskbar icon disappear 登录后,再次出现闪屏,任务栏图标消失
  4. Next a win32 window appears with a taskbar icon. 接下来,出现带有任务栏图标的win32窗口。
  5. While loading large amount of data, the taskbar icon is Citrix-icon, but when ready the correct app icon is switched back 加载大量数据时,任务栏图标为Citrix-icon,但准备就绪后,正确的应用程序图标会切换回
  6. After closing win32 dialog the mainwindow appears with Citrix-icon in taskbar. 关闭win32对话框后,主窗口出现,任务栏中显示Citrix-icon。

The win32-dialog (steps 4-5) before mainwindow can be skipped resulting mainwindow to be opened after splash with Citrix taskbar icon. 可以跳过mainwindow之前的win32对话框(步骤4-5),并在启动后通过Citrix任务栏图标打开主窗口。 Steps are above only because while dialog is loading taskbar icon is Citrix. 上面的步骤仅是因为在对话框加载时,任务栏图标是Citrix。

MyApp.ico is 160x160 pixels with 32 bit depth. MyApp.ico是160x160像素,具有32位深度。

When mainwindow is created during initialization its ShowInTaskbar is set to false. 在初始化期间创建mainwindow时,其ShowInTaskbar设置为false。 When it is ready it is set to true. 准备就绪时将其设置为true。 This is done because we want to show other window(s) before mainwindow so unfinished mainwindow is somewhere outside the screen(s) and we don't want it to be accessible from taskbar. 这样做是因为我们想在mainwindow之前显示其他窗口,所以未完成的mainwindow在屏幕之外,并且我们不希望从任务栏访问它。

EDIT: This does not happen if ShowInTaskbar is not set to false. 编辑:如果ShowInTaskbar未设置为false,则不会发生。

Not actually a generic solution for this problem, but it seems that my proposed simple way solves this particular issue with the OP's code. 实际上,不是解决此问题的通用解决方案,但似乎我提出的简单方法可以用OP的代码解决此特定问题。

Rather than setting the ShownInTaskbar property, it is enough to initially set the Visibility property of the main form to the Visibility.Hidden value. ShownInTaskbar将主窗体的Visibility属性初始设置为Visibility.Hidden值,而ShownInTaskbar设置ShownInTaskbar属性。

As soon as the window is ready, the Visibility property can be set to the Visibility.Visible value causing the window and its task bar button to be displayed (with the correct icons). 一旦窗口准备就绪,就可以将Visibility属性设置为Visibility.Visible值,从而显示窗口及其任务栏按钮(带有正确的图标)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM