Class Options
Provides static methods, properties and events to store and read user options. Options are grouped in sections.
Namespace: ABB.Robotics.RobotStudio
Assembly: ABB.Robotics.RobotStudio.dll
Syntax
public sealed class Options
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
Constructors
View SourceOptions()
ABB internal use.
Declaration
public Options()
Properties
View SourceLanguage
Gets or sets the application language as an IETF language tag (e.g. "en-US").
Declaration
public static string Language { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RestartRequired
Gets or sets a value indicating if the application needs to be restart for changed options to apply.
Declaration
public static bool RestartRequired { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceGetDefaultValue(string, string)
Gets the default value for an option with the specified key.
Declaration
public static object GetDefaultValue(string section, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which to get the default value. |
| string | key | The key of the option for which to get the default value. |
Returns
| Type | Description |
|---|---|
| object |
GetKeys(string)
Gets an array of all option keys in the specified section.
Declaration
public static string[] GetKeys(string section)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section |
Returns
| Type | Description |
|---|---|
| string[] | An array of strings with the names of the option sections. |
GetSections()
Gets an array of all options sections.
Declaration
public static string[] GetSections()
Returns
| Type | Description |
|---|---|
| string[] | An array of strings with the names of the options sections. |
GetValue(string, string)
Gets the value for an option with the specified key.
Declaration
public static object GetValue(string section, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which to get the value. |
| string | key | The key of the option from which to get the value. |
Returns
| Type | Description |
|---|---|
| object |
Load(string)
Load options from an XML file.
Declaration
[Obsolete("No longer supported")]
public static void Load(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The name of the XML file to load. |
Reload()
Reloads options from disk
Declaration
public static void Reload()
RemoveKey(string, string)
Removes an option with the specified key from the specified section.
Declaration
public static void RemoveKey(string section, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option that shall be removed. |
| string | key | The key of the option to remove. |
RemoveSection(string)
Removes an entire section. Use with care!
Declaration
public static void RemoveSection(string section)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section |
Save()
Commits all options to disk.
Declaration
public static void Save()
SaveAs(string)
Save options to an XML file.
Declaration
[Obsolete("No longer supported")]
public static void SaveAs(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The name of the XML file where options will be saved. |
SetDefaultValue(string, string, bool)
Sets a default boolean value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| bool | value | The default value of the option. |
SetDefaultValue(string, string, double)
Sets a default double value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, double value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| double | value | The default value of the option. |
SetDefaultValue(string, string, Color)
Sets a default Color value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, Color value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| Color | value | The default value of the option. |
SetDefaultValue(string, string, int)
Sets a default integer value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| int | value | The default value of the option. |
SetDefaultValue(string, string, long)
Sets a default 64-bit integer value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, long value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| long | value | The default value of the option. |
SetDefaultValue(string, string, float)
Sets a default float value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| float | value | The default value of the option. |
SetDefaultValue(string, string, string)
Sets a default string value of for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| string | value | The default value of the option. |
SetDefaultValue(string, string, string[])
Sets a default string array value for an option with the specified key.
Declaration
public static void SetDefaultValue(string section, string key, string[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which the default value shall be set. |
| string | key | The key of the option for which the default value shall be set. |
| string[] | value | The default value of the option. |
SetFileName(string)
Sets an alternative filename for the options file.
Declaration
public static void SetFileName(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName |
Remarks
Set this when using the Options API outside the RobotStudio executable. This must be set before using any other method. If the file does not exist, the default file is loaded.
SetValue(string, string, bool)
Sets a boolean value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| bool | value | The boolean to use as value for the option. |
SetValue(string, string, double)
Sets a double value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, double value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| double | value | The double to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, Color)
Sets a Color value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, Color value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| Color | value | The integer to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, int)
Sets an integer value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| int | value | The integer to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, long)
Sets an 64-bit integer value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, long value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| long | value | The integer to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, float)
Sets a float value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| float | value | The float to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, string)
Sets a string value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| string | value | The string to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
SetValue(string, string, string[])
Sets an string array value for an option with the specified key.
Declaration
public static void SetValue(string section, string key, string[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section in which to set a value. |
| string | key | The key of the option. |
| string[] | value | The array of strings to use as value for the option. |
Remarks
Options created by Add-Ins shall use a section name that is unique for the Add-In, to avoid conflicts between Add-Ins. If the Add-In has a lot of options and you would like to group them into different sections, then use the same prefix for each section name. For example "CompanyABCAddIn.SectionA", "CompanyABCAddIn.SectionB" etc.
TryGetDefaultValue<T>(string, string, out T)
Gets the typed default value for an option with the specified key.
Declaration
public static bool TryGetDefaultValue<T>(string section, string key, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which to get the default value. |
| string | key | The key of the option from which to get the default value. |
| T | value | The default value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. |
Returns
| Type | Description |
|---|---|
| bool | True if the default value was found and of the specified type, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The expected type of the value. |
TryGetValue<T>(string, string, out T)
Gets the typed value for an option with the specified key.
Declaration
public static bool TryGetValue<T>(string section, string key, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The options section which contains the option for which to get the value. |
| string | key | The key of the option from which to get the value. |
| T | value | The value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. |
Returns
| Type | Description |
|---|---|
| bool | True if the option was found and of the specified type, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The expected type of the value. |
Events
View SourceChanged
Fired when a change of options has occurred.
Declaration
public static event EventHandler Changed
Event Type
| Type | Description |
|---|---|
| EventHandler |
SectionChanged
Occurs when the specified section has called.
Declaration
public static event SectionChangedEventHandler SectionChanged
Event Type
| Type | Description |
|---|---|
| SectionChangedEventHandler |
Remarks
Also raised for "section.key0" where key0 is the first point-separated part of the property key E.g. SetValue("RobotStudio", "Appearance.Color") raises SectionChanged("RobotStudio.Appearance")