Table of Contents

Class IcyConfiguration

Namespace
Icy.Configuration
Assembly
IcyUI.dll

Aggregates library services and provides fluent configuration for all of these.

public class IcyConfiguration
Inheritance
IcyConfiguration
Inherited Members
Extension Methods

Constructors

IcyConfiguration(IInputSystem, AssetConfiguration, IRenderContext, ReflectionConfiguration, ThemeConfiguration?, ScalingConfiguration?, ILoggerFactory?)

Initializes a new instance of the IcyConfiguration class.

public IcyConfiguration(IInputSystem input, AssetConfiguration assets, IRenderContext renderContext, ReflectionConfiguration types, ThemeConfiguration? theme = null, ScalingConfiguration? scaling = null, ILoggerFactory? logging = null)

Parameters

input IInputSystem

An input service that is used by library in this application.

assets AssetConfiguration

Configuration of the assets system used by library in this application.

renderContext IRenderContext

The rendering service instance used by library in this application.

types ReflectionConfiguration

An instance of the reflection-related services used in library.

theme ThemeConfiguration

The default-theme configuration used by the library. Defaults to an empty ThemeConfiguration (no theme applied) when omitted.

scaling ScalingConfiguration

The UI scaling defaults used by the library. Defaults to a new ScalingConfiguration (Dpi) when omitted.

logging ILoggerFactory

Where IcyUI writes its log messages. Defaults to Instance (nothing is logged) when omitted.

Properties

Assets

Gets the assets configuration section.

public AssetConfiguration Assets { get; }

Property Value

AssetConfiguration

Culture

Gets or sets the culture IcyUI formats and parses the values players read and type with.

[AllowNull]
public CultureInfo Culture { get; set; }

Property Value

CultureInfo

The culture set for this configuration, or CurrentUICulture (read at each use) while none is set. Setting null goes back to following CurrentUICulture.

Remarks

The default follows the UI language rather than CurrentCulture (the system's regional format): a game shows numbers the way its own language writes them, so 3,5 in Russian and 3.5 in English, whatever the player's system settings are.

Used by:

Changing it applies to existing bindings the next time they update. Markup itself always uses the invariant culture: Width="3.5" means the same in every language.

Fonts

Gets a service for access to the library fonts.

public FontSystem Fonts { get; }

Property Value

FontSystem

Input

Gets the input service instance used by the library.

public IInputSystem Input { get; }

Property Value

IInputSystem

Logging

Gets the factory IcyUI creates its loggers from. Categories are IcyUI's full type names, such as Icy.Rendering.Fonts.FontSystem, so a prefix filter like "Icy.Markup" selects one area.

public ILoggerFactory Logging { get; }

Property Value

ILoggerFactory

RenderContext

Gets the rendering service instance used by the library.

public IRenderContext RenderContext { get; }

Property Value

IRenderContext

Scaling

Gets the application-wide UI scaling defaults used by every Canvas built against this configuration.

public ScalingConfiguration Scaling { get; }

Property Value

ScalingConfiguration

Theme

Gets the default-theme configuration used by the library.

public ThemeConfiguration Theme { get; }

Property Value

ThemeConfiguration

Types

Gets the services for the reflection purposes.

public ReflectionConfiguration Types { get; }

Property Value

ReflectionConfiguration

Methods

Localize(string, string?)

Gets the localized string for key in Culture, from Localizer.

public string Localize(string key, string? context = null)

Parameters

key string

The key, such as Menu.Play.

context string

An optional context that tells apart keys with the same text (gettext's msgctxt).

Returns

string

The string, or key itself when the localizer has none: the text stays readable, and a warning (event 4001) is logged once per key and culture.

Events

CultureChanged

Occurs when Culture changed to a different culture. IcyUI re-applies every localized property then ({Localize}, and Localize on elements built in code).

public event EventHandler? CultureChanged

Event Type

EventHandler

Remarks

Raised when setting Culture leaves it different from the culture localized texts were last shown in. Not raised by changes of CurrentUICulture alone, while Culture follows it: set Culture to switch the game's language.