WpfModuleInitialize Method

Initializes the KGySoft.Drawing.Wpf module (and also 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.Wpf
Assembly: KGySoft.Drawing.Wpf (in KGySoft.Drawing.Wpf.dll) Version: 10.0.0-rc.1
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 be 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 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.Wpf.dll are also affected by the settings.

Examples

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

public class Example
{
    public static void Main()
    {
        // To make sure that configuring LanguageSettings affects also the resources in KGySoft.Drawing.Wpf
        WpfModule.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