48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
@namespace [Owner].[Module]
|
|
@inherits ModuleBase
|
|
@inject ISettingService SettingService
|
|
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<Label For="value" HelpText="Enter a value">Name: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="value" type="text" class="form-control" @bind="@_value" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
@code {
|
|
public override string Title => "[Module] Settings";
|
|
|
|
string _value;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
|
_value = SettingService.GetSetting(settings, "SettingName", "");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
|
}
|
|
}
|
|
|
|
public async Task UpdateSettings()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
|
SettingService.SetSetting(settings, "SettingName", _value);
|
|
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
|
}
|
|
}
|
|
}
|