1

我只是在我的下一个 WPF 应用程序中添加国际化,并按照此处的说明进行操作

然后我注意到卫星 DLL 中会有相当多的重复,因此将不会在 .csproj 中本地化的图像标记为

<Localizable>False</Localizable>

不幸的是,我的其中一个资源在 SplashScreen 中使用,因此:

SplashScreen ss = new SplashScreen("Images/splash.png");
ss.Show(false);

这会在执行 Show 调用时引发异常。这是异常输出

A first chance exception of type 'System.IO.IOException' occurred in WindowsBase.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'System.RuntimeType.CreateInstanceImpl'
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance'
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Step into: Stepping over method without symbols 'System.Windows.Markup.WpfXamlLoader.Load'
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

附加信息:“对与指定绑定约束匹配的“MainWindow”类型的构造函数的调用引发了异常。行号“4”和行位置“9”。

当我删除 False 线时,它再次起作用。

有没有办法加载我想要的资源,它存储在 test.unlocalizable.g.resources 中?

4

0 回答 0