Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using app resw file from background task

I'm working on a Modern UI app and i'm currently trying to access my app's resources file (Resources.resw) from a backgroundtask. Both are in different projects in the same solution. I tried that way :

ResourceLoader resources = new ResourceLoader("MyApp/Resources");

But i've got an arror as it can't get to the resources map.

Is there a specific way to do that ?

like image 217
Sicha Avatar asked Oct 07 '22 02:10

Sicha


2 Answers

In case anyone comes across this.

In UWP, it seems that you don't have to do anything special to make this work. If the .resw files are included in the main UWP project, you can use the resource loader to retrieve them even from the background task assembly. For a resource string called LiveNotifications-ItemComplete, it would be the following:

var resource = new ResourceLoader().GetString("LiveNotifications-ItemCompleted");

Hope this helps!

like image 111
Jan Kratochvil Avatar answered Oct 10 '22 04:10

Jan Kratochvil


Try to use just the name of the resource file. If the name is MyResources.resw, then use:

ResourceLoader resources = new ResourceLoader("MyResources");
like image 42
Martin Suchan Avatar answered Oct 10 '22 03:10

Martin Suchan