DrawingCoreModuleInitialize Method

Initializes the KGySoft.Drawing.Core module. It initializes the resource manager for string resources and registers its central management in the LanguageSettings class.

Definition

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.1.0
C#
public static void Initialize()

Remarks

  Note

The module initializer is executed automatically when any member is accessed in the module for the first time. This method is public to able to trigger module initialization without performing any other operation. Normally you don't need to call it explicitly but it can be useful if you use the KGy SOFT Drawing Core Libraries in an application and you want to configure resource management on starting the application via the LanguageSettings class. In such case you can call this method before configuring language settings to make sure that the resources of the KGySoft.Drawing.Core.dll are also affected by the settings.

Example

The following example demonstrates how to initialize the KGySoft.Drawing.Core module in an application (you don't really need to do this if you use KGy SOFT Drawing Core Libraries from a class library):
C#
using KGySoft;
using KGySoft.Drawing;
using KGySoft.Resources;

public class Example
{
    public static void Main()
    {
        // To make sure that configuring LanguageSettings affects also the resources in KGySoft.Drawing.Core
        DrawingCoreModule.Initialize();

        // Opting in to use compiled and .resx resources for the application
        LanguageSettings.DynamicResourceManagersSource = ResourceManagerSources.CompiledAndResX;
        LanguageSettings.DisplayLanguage = MyConfigs.GetLastlyUsedLanguage(); // Get some CultureInfo

        // Optional: To add possibly new resource entries to the localization of the current language
        LanguageSettings.EnsureInvariantResourcesMerged();

        // Now you can launch the actual application
        LaunchMyApplication(); // whatever your app actually does
    }
}

See Also