Framework Reference
WEALTHLAB FRAMEWORK / CLASS REFERENCE

Configurable

API documentation, members, signatures, and C# examples.

Search the framework

Find classes, members, and documentation.

NamespaceWealthLab.Core
Parent
Object
Descendants
many

The Configurable class provides base functionality for WealthLab components that support configuration. Configurable implements the IParameterized and INamed interfaces. Configuration can be represented either as a plain string or as a persisted ParameterList, as determined by the ConfigurableType property. The Configurable constructor calls GenerateParameters and then LoadConfig, so derived classes can define their Parameters and automatically restore previously saved configuration when they are instantiated.

Configuration

15

ConfigKey

public virtual string ConfigKey

Returns the key used to persist the object's Configuration in the WL9 settings file. If ConfigPrefix is blank, the key is simply Name. Otherwise, it is composed of ConfigPrefix + "_" + Name. Override this property when a different configuration key is required.

ConfigPrefix

public virtual string ConfigPrefix

Returns the prefix used when constructing ConfigKey. The default value is a blank string. Derived classes can override this to provide a prefix appropriate for the component type.

ConfigurableType

public abstract ConfigurableType ConfigurableType

Determines how the object's Configuration string is represented. ConfigurableType.VanillaString indicates that the component manages its configuration as a plain string. ConfigurableType.ParameterList indicates that the Configuration represents a persisted ParameterList, available through the Parameters property.

Configuration

public string Configuration

Gets or sets the object's configuration as a string. For ConfigurableType.VanillaString, the value is stored directly. For ConfigurableType.ParameterList, the getter returns the persisted representation of Parameters, and assigning a value parses it as a ParameterList and assigns its values to the existing Parameters. ProcessConfig is called when the configuration changes.

Configure

public bool Configure()

Displays the configuration interface by calling EditConfig. If the configuration was changed, the new configuration is persisted by calling SaveConfig and the method returns true. Otherwise, it returns false.

ConfigureIfNeeded

public virtual bool ConfigureIfNeeded()

Loads the persisted configuration and checks IsConfigured. If the object is not configured, calls Configure to allow the user to configure it. Returns true if the object is already configured or configuration succeeds.

EditConfig

public virtual void EditConfig()

Causes WL9 to display an interface that allows the user to edit the object's configuration. The default implementation assigns the object's Description and itself as the Caller of its ParameterList, then passes the object to the WL9 host for configuration.

GenerateParameters

public virtual void GenerateParameters()

Override this method to populate the object's Parameters property. The Configurable constructor calls this method before loading persisted configuration, allowing the existing Parameter instances to receive the persisted values.

IsConfigurable

public virtual bool IsConfigurable

Returns whether the object requires configuration. The default implementation returns true when ConfigurableType is ConfigurableType.ParameterList and Parameters contains at least one Parameter. It returns false otherwise.

IsConfigured

public virtual bool IsConfigured

Returns whether the object is properly configured. If IsConfigurable is false, this property returns true. Otherwise, it attempts to load the configuration if it is currently blank and returns whether a non-empty Configuration is available.

KeepCompanionsInSync

public virtual bool KeepCompanionsInSync

Return true to keep configuration Parameters synchronized among Configurable instances that share the same ConfigKey. When the Configuration of one such instance changes, matching companion instances receive the same Parameter values. The default value is false.

LoadConfig

public virtual bool LoadConfig()

Loads the object's configuration from the WL9 settings using ConfigKey. If a stored configuration is found, it is assigned to Configuration and the method returns true. Otherwise, it returns false.

Parameters

public ParameterList Parameters

Gets or sets the ParameterList containing the object's configuration Parameters. When persisted Parameters are assigned, Configurable preserves the Parameter instances generated by the constructor while adopting their persisted values and optimization-related settings. This allows newly introduced Parameters to remain present when loading configuration saved by an earlier version.

ProcessConfig

public virtual void ProcessConfig()

Called after the object's Configuration changes. Override this method to perform any additional processing required by the new configuration. The default implementation assigns the object's Description to the Parameters' Description property.

SaveConfig

public virtual void SaveConfig()

Persists the current Configuration in the WL9 settings using ConfigKey. The setting is updated only if the persisted value differs from the current Configuration.

Descriptive Properties

6

Description

public virtual string Description

Returns an optional short description of the component. The default value is a blank string. WL9 can display this description when the component is being configured.

DisableGlyphReverse

public virtual bool DisableGlyphReverse

Determines whether WL9 should suppress automatic reversal of the component's glyph when displaying it in a Dark Theme. The default value is false.

GlyphResource

public virtual string GlyphResource

Returns the qualified name of an embedded resource containing the image that WL9 should use to represent the component. The default value is a blank string.

GlyphStream

public Stream GlyphStream

Returns a Stream containing the embedded resource specified for the object's glyph.

Name

public abstract string Name

Returns the name of the component. Configurable implements the INamed interface.

URL

public virtual string URL

Returns an optional URL containing additional information about the component. The default value is a blank string.

Helper Methods

4

AddEnumParameter

public Parameter AddEnumParameter(string label, System.Enum enumInstance)

Adds a StringChoice Parameter whose choices correspond to the possible values of the enum represented by enumInstance. The Parameter's default value is the supplied enum value, and its TypeName is set to the enum type's name. Returns the newly created Parameter.

AddIndicatorParameter

public Parameter AddIndicatorParameter(string label, string indicator = "RSI", ParameterType pt = ParameterType.Indicator)

Adds an indicator Parameter to Parameters. The method sets its IndicatorAbbreviation and attempts to create the specified indicator using IndicatorFactory. If successful, the Parameter's IndicatorParameters and IndicatorInstance properties are populated from the indicator instance. Returns the newly created Parameter.

AddParameter

public Parameter AddParameter(string label, ParameterType pt, object defaultValue)

Creates a Parameter with the specified label, ParameterType, and defaultValue, adds it to Parameters, and returns the newly created Parameter.

AddValueCompareParameter

public Parameter AddValueCompareParameter(string label = "is", string defaultValue = "equal to")

Adds a StringChoice Parameter to Parameters and returns it. The available choices are:

  • less than
  • less than or equal to
  • equal to
  • not equal to
  • greater than or equal to
  • greater than

IParameterized

1

ParameterEdited

public virtual void ParameterEdited(IParameterEditor editor)

Called when a Parameter associated with the object is edited. The default implementation performs no processing. Override this method when the component needs to respond immediately to Parameter edits.

Need help with this API?

Ask the community or explore custom development services.