jm.
jm.

Reputation: 23734

Using Satellite assembly to replace UI in .NET application

At start of my WindowsForms/C#/.NET application, I'd like to load my satellite assembly and use it to replace the look-and-feel of my application. In a manner similar to how satellite assemblies are loaded for internationalizing an application. Except that I just want to be able to call something like:

// Load it. Ignore CultureInfo, etc.
UseSatelliteAssembly("mySatelliteAssembly.dll"); 

I have created a satellite assembly in .NET that contains a bunch of compiled RESX files. The RESX files come from the UI of my application, and I compiled them into a satellite assembly using the AL.EXE program.

I don't want to have to write code to copy each string in the satellite assembly into my UI.

My main assembly is signed. My satellite assembly probably would not be signed (with same key, anyway).

Is there any easy way to do this?

Upvotes: 0

Views: 558

Answers (2)

jm.
jm.

Reputation: 23734

I found this sample that makes me think there is a way to replace ComponentResourceManager...

http://www.codeproject.com/KB/mobile/Wm2005Globalization2.aspx

Upvotes: 0

Hans Passant
Hans Passant

Reputation: 942227

No. You can't alter the designer, it generates the resources.ApplyResources() calls. You can't alter the ComponentResourceManager class, it is baked into the framework.

The class has only one way to alter its behavior: Thread.CurrentThread.CurrentUICulture. Use it. Change the UI culture before the InitializeComponent() call, restore it afterwards. Plenty of culture abbreviations you can hijack to map to something meaningful.

Upvotes: 2

Related Questions