Interface ISettingsProvider
- Namespace
- WindowSill.API
- Assembly
- WindowSill.API.dll
Provides a set of methods to manage the application's settings.
public interface ISettingsProvider
- Extension Methods
Methods
GetSetting<T>(SettingDefinition<T>)
Gets the value of a defined setting.
T GetSetting<T>(SettingDefinition<T> settingDefinition)
Parameters
settingDefinitionSettingDefinition<T>The SettingDefinition<T> that defines the targeted setting.
Returns
- T
Return the value of the setting or its default value.
Type Parameters
TThe type of value that will be retrieved.
IsActivelyControlledByAdmin<T>(SettingDefinition<T>)
Determines whether the specified setting is currently being overwritten by an administrator.
bool IsActivelyControlledByAdmin<T>(SettingDefinition<T> settingDefinition)
Parameters
settingDefinitionSettingDefinition<T>The definition of the setting to check for administrative control. Cannot be null.
Returns
- bool
true if the setting is actively controlled by an administrator; otherwise, false.
Type Parameters
TThe type of the value associated with the setting definition.
Remarks
This method can be used to distinguish between settings managed by end users and those enforced by organization policy. If a setting is actively controlled by an administrator, it is recommended to make the corresponding UI elements read-only to prevent user modifications, and indicate that the setting is managed by policy.
OpenSettingsPageForSill(string, string?)
Opens the settings page for the specified sill.
void OpenSettingsPageForSill(string internalSillName, string? sillSettingViewTitle)
Parameters
internalSillNamestringThe internal name of the sill whose settings page should be opened.
sillSettingViewTitlestringThe display name of the SillSettingsView to navigate to. This is optional when there's only one setting view defined in a ISill.
ResetSetting<T>(SettingDefinition<T>)
Resets a given setting to its default value.
void ResetSetting<T>(SettingDefinition<T> settingDefinition)
Parameters
settingDefinitionSettingDefinition<T>
Type Parameters
T
SetSetting<T>(SettingDefinition<T>, T)
Sets the value of a given setting.
void SetSetting<T>(SettingDefinition<T> settingDefinition, T value)
Parameters
settingDefinitionSettingDefinition<T>The SettingDefinition<T> that defines the targeted setting.
valueTThe value to set
Type Parameters
TThe type of value that will be set.
Remarks
If the setting is actively controlled by an administrator (via registry policy override), this method will have no effect and the setting will remain read-only.
Settings are limited to 8 KB per settings or 64 KB for the entire WindowSill app. Do NOT store large data in settings. Use IPluginInfo instead
Events
SettingChanged
Raised when a setting value has changed.
event TypedEventHandler<ISettingsProvider, SettingChangedEventArgs>? SettingChanged