Assembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
Typical implementation of the IResourceUser.ResetResources method requires a call to the eponymous static method of the ResourceMgr class.
public Collection<string> ResetResources() { return ResourceMgr.ResetResources("*.xml", ref resetResources); } private static bool resetResources;
The Boolean flag in the method allows for multiple instances of a class to all make the call yet only the first one will actually reset the resources (since external resources are by definition class resources).
Note that you do not specify a path, just a file name (or a file name pattern for multiple files). The externalized files are stored in a subdirectory of the system-defined Application Data directory. The name of the subdirectory is just the base name of the application. If your application is called MyProgram.exe and your username is smith, the folder is then …\smith\Application Data\MyProgram. The initial portion of the path depends upon which version of Windows you are running.
When you wish to reset all external resources in your application, simply call the ResetAllResources( Form ) method. That method hunts for all controls instrumented as IResourceUser implementers, examining all controls in your form and any of their embedded controls. If you have a control that includes its own forms, though, you must handle this slightly different. Its implementation should include calls to ResetAllResources( Form ) for any of its child forms, which will then each be searched for embedded controls.
public Collection<string> ResetResources() { return ResourceMgr.ResetAllResources(subform1, subform2, ...); }
Since CleanCode 0.9.26.