Search Framework:
Namespace: WealthLab.Core
Parent: Object
Descendants: many

Contains the functionality for an object to support configuration. A Configurable object has a Name property, implementing the INamed interface. Its configuration is automatically persisted as a string in WL8's settings file, and is contained in the Configuration parameter. The ConfigurationType property determines whether the configuration string is an object-specific, plain vanilla format, or represents a persisted ParameterList. In the latter case, the object's Parameters property contains its parameters.

public virtual string ConfigKey

The key that is used when WL8 saves this item's Configuration to the settings file. By default, ConfigKey is composed of ConfigPrefix + "_" + Name. You can override this property to specify a different ConfigKey, which is useful in cases where multiple components must share the same configuration.

public virtual string ConfigPrefix

Returns the prefix that will be used when creating a key to store the item's Configuration in the WL8 settings file. Each class of item has been given a short two- or three-character prefix. For example, Historical Providers are "HP" and Streaming Providers are "SP".

public abstract ConfigurableType ConfigurableType

Determines whether the Configuration string is a plain vanilla string, or a persisted instance of a ParameterList. For the latter case, the object's Parameters property will contain the parsed parameters. Possible values are ConfigurableType.VanillaString and ConfigurableType.ParameterList.

public string Configuration

Contains the configuration of the item expressed as a single string. If ConfigurableType is equal to ConfigurableType.ParameterList, then this string is the persisted Parameters instance.

public virtual string EditConfig()

Causes WL8 to bring up a configuration dialog allowing the user to edit the object's configuration. If the object uses a ParameterList as its configuration, WL8 will bring up a parameter editor dialog. If you're developing your own WIndows/WPF WL8 extension, you can provide a custom editor by creating a class descending from ObjectEditorBase, defined in the WealthLab.WPF library.

public virtual void GenerateParameters()

Override this method to populate a Configurable object's Parameters property with instances of the Parameter class. This method is relevant only if the object's ConfigurableType is equal to ConfigurableType.ParameterList.

public virtual bool IsConfigurable

Indicates whether the object supports configuration. For example, the Historical Data Provider Yahoo! Finance does not require configuration, so returns false here. However, AlphaVantage requires an API Key, which it defines as a Parameter in its Parameters property, so returns true. By default, if an object is ConfigurableType.ParameterList, and contains one or more Parameters, this property returns true.

public virtual bool IsConfigured

The default method returns false if IsConfigurable is true, but the Configuration string is null or empty. Override to provide more fine grained control over whether an item should be configured or not. Data Providers that are not configured cannot be used to create DataSets, for example.

public virtual bool LoadConfig()

Called when WL8 loads the item's configuration upon initialization. By default, the information is loaded from the WL8 settings file.

public ParameterList Parameters

Contains the Parameter instances that comprise the configuration for this instance. This property is relevant only if the object's ConfigurableType is equal to ConfigurableType.ParameterList.

public virtual void ProcessConfig()

You can override this method to perform special processing after the instance's configuration has changed.

public virtual void SaveConfig()

Called when the object's configuration changes, and must be persisted. The default implementation stores the Configuration string in the WL8 settings file.

Descriptive Properties
public virtual string Description

Return an optional, short description of the item. WL8 uses this throughout the user interface as items are displayed and edited.

public virtual bool DisableGlyphReverse

WL8 will reverse an item's GlyphResource image when it is operating in a Dark Theme. If you do not wish the image to be reversed in this manner, return true here.

public virtual string GlyphResource

Return a string that describes an Embedded Resource in the .NET library that should be used to represent the item when it's displayed in a list. If you have an Embedded Resource named MyBitmap.png in the folder Images in your project named SomeCompany.WealthLabUtils, then the corresponding string would be: "SomeCompany.WealthLabUtils.Images.MyBitmap.png".

public abstract string Name

Returns the name of the instance. Since Configurable objects are named, and implement the INamed interface, they can be used as the target type for FactoryBase<T> classes.

public virtual string URL

Return an optional URL that points to a web site containing additional information about the item. WL8 uses this throughout the user interface as items are displayed and edited.

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

Adds a StringChoice Parameter instance to the object's Parameters property. The values added to the Parameter instance Choices property correspond to the possible values in the Enumerated Type specified in enumInstance. The Parameter default value assumes the value of enumInstance.

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

Adds an indicator-type Parameter to the object's Parameters property. Does the additional work of assigning appropriate values to the Parameter instance's IndicatorAbbreviation, IndicatorParameters and IndicatorInstance properties.

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

Adds a Parameter instance to the object's Parameters property.

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

Adds a StringChoice Parameter instance to the object's Parameters property. The values added to the Parameter instance Choices property are:

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