48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
@namespace AdamGais.Module.AnmeldeTool
|
|
@inherits ModuleBase
|
|
@inject ISettingService SettingService
|
|
@inject IStringLocalizer<Settings> Localizer
|
|
|
|
<div class="container">
|
|
<div class="row mb-1 align-items-center">
|
|
<Label Class="col-sm-3" For="value" HelpText="Enter a value" ResourceKey="SettingName" ResourceType="@resourceType">Name: </Label>
|
|
<div class="col-sm-9">
|
|
<input id="value" type="text" class="form-control" @bind="@_value" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private string resourceType = "AdamGais.Module.AnmeldeTool.Settings, AdamGais.Module.AnmeldeTool.Client.Oqtane"; // for localization
|
|
public override string Title => "AnmeldeTool 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)
|
|
{
|
|
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)
|
|
{
|
|
AddModuleMessage(ex.Message, MessageType.Error);
|
|
}
|
|
}
|
|
}
|