Closed groberts-nr closed 6 months ago
@groberts-nr thanks for taking the time to implement this.
Unfortunately, I haven't done any UWP in a long time so I can't answer that. This tool dates back to Windows Phone 7 and when Windows Apps were still called Metro-style apps.
@groberts-nr I'll pull this branch once I get access to a Windows PC and try it out before we merge it in
@groberts-nr I pulled your branch but I couldn't get it to work.
I get this error
The project is just a File -> New Project -> Blank UWP App
The .Resw file has a single entry
@groberts-nr After playing a bit more, I figured out that your branch only works when the localization resources are in a separate project from the app.
Your branch works fine with this setup
But not with this:
@groberts-nr I appreciate the effort and time you took to improve on the generated code but since this tool has other users, it needs to work for several different scenarios
You're welcome to improve further on the generated code, but as it is right now I don't think we should merge it in
That makes sense, thank you for taking the time to check it out! I'll let you know if I find another solution that will work for all scenarios.
Hi @christianhelle, I updated my approach to use System.Reflection.Assembly.GetEntryAssembly()
. This fixes the same-project case. I'm not aware of any problematic implications but let me know what you think.
@christianhelle Have you had the chance to look at the latest commit?
@christianhelle Have you had the chance to look at the latest commit?
@groberts-nr Sorry, things got hectic on other projects and I completely forgot about this.
I'm having a look at it now
Thanks for the contribution @groberts-nr
Thanks so much @christianhelle ! Although now I'm realizing that this code snippet will probably cause generated Visual Basic code to fail. I'd like to have the global::
namespace in there to avoid conflicts with any user-defined System
class, but I'm not sure how to do that in a language-agnostic way.
@christianhelle Although it appears VB was already broken with the other code snippet Windows.UI.Core.CoreWindow.GetForCurrentThread() != null
so perhaps this is not a big deal after all. Thanks again!
@groberts-nr I honestly don't know of anyone who still works with VB.NET, but I'll try to fix it at some point
Calling
Windows.UI.Xaml.Application.Current
throws an exception if it is run in a UWP app that is not based on an Application class, for example, an immersive HoloLens app. Is there a reason to refer to the resource by its short name rather than fully qualified? If we always just use the fully qualified resource path, then we don't need to callApplication.Current
. Let me know what you think! Thanks!