Prev | Current Page 878 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Text = rm.GetString("Search.searchButton.Text");
searchButton.Click += new EventHandler(SearchButtonClick);
this.Controls.Add(searchButton);
The ResourceManager class exists in the System.Resources namespace and is responsible
for locating the correct resources requested based on the CurrentUICulture setting on the thread
that is executing. The preceding code indicates that the ResourceManager instance should retrieve
a string value that is identified by the name ???Search.searchButton.Text???. Once it is located, the
string value is assigned to the Text property.
The ResourceManager instance created in the preceding code snippet is retrieved by a utility
class named ResourceFactory in the Live Search control library code. Listing 13-15 shows the full
listing for this utility class.
Listing 13-15. The ResourceFactory.cs Class File
using System.Reflection;
using System.Resources;
namespace ControlsBook2Lib.CH12.LiveSearchControls
{
698 CHAPTER 13 ?–  PACKAGING AND DEPLOYMENT
///
/// Allows for efficient access to a single ResourceManager instance
/// using a singleton type of factory pattern
///

internal class ResourceFactory
{
private ResourceFactory()
{
}
internal const string ResourceName =
"ControlsBook2Lib.


Pages:
866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890