我们有一个wpf应用程序,可以在个人电脑和平板电脑上运行在windows7和windows10上。
我们有一个窗口,我们将其用作闪屏,当在Windows7中的应用程序中尝试打开它时,它会显示图像,而在windows中,它会显示空白窗口。
我们尝试将图像作为静态资源加载,在另一个线程中打开闪屏,使用7KB而不是1MB的图像,但仍然不起作用。
我们尝试在应用程序启动时打开启动画面,但它工作正常。
我们尝试用1MB的图片打开一个新项目,它正常工作了,所以我不知道在应用程序运行期间发生了什么,阻止它在Windows10中加载图片。
闪屏.xaml代码:
<Window .... WindowState="Maximized" Topmost="True" WindowStyle="None" Height="1080" Width="1980">
<Window.Resources>
<BitmapImage x:Key="LoadingDrill" UriSource="pack://application:,,,/Resources/Splash.png"/>
</Window.Resources>
<Grid x:Name="me">
<Image Source="{StaticResource LoadingDrill}"/>
</Grid>
</Window>.cs代码:
private static SplashViewer singleton;
public static void CloseSplash()
{
if (singleton != null)
{
singleton.Close();
singleton = null;
}
}
public static void ShowSplash()
{
if (singleton == null)
{
singleton = new SplashViewer();
singleton.Closed += Singleton_Closed;
singleton.Show();
}
}
private static void Singleton_Closed(object sender, EventArgs e)
{
singleton = null;
}
public SplashViewer()
{
InitializeComponent();
me.DataContext = this;
}打开闪屏:
SplashViewer.ShowSplash();
///
///do something...
///
SplashViewer.CloseSplash();再试一次:
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => { SplashViewer.ShowSplash(); }));有没有人知道该怎么做?
发布于 2017-08-21 16:20:21
我们最终使用了DevExpress DXSplashScreen,它是有效的。
如果有人知道为什么它不能与常规窗口一起工作,我们也会很高兴知道。
https://stackoverflow.com/questions/45790161
复制相似问题