@namespace Oqtane.Modules.HtmlText @inherits ModuleBase @inject ISettingService SettingService @implements Oqtane.Interfaces.ISettingsControl @inject IStringLocalizer Localizer @inject IStringLocalizer SharedLocalizer
@code { private string resourceType = "Oqtane.Modules.HtmlText.Settings, Oqtane.Client"; // for localization private string _allowfilemanagement; private string _allowrawhtml; protected override void OnInitialized() { try { _allowfilemanagement = SettingService.GetSetting(ModuleState.Settings, "AllowFileManagement", "true"); _allowrawhtml = SettingService.GetSetting(ModuleState.Settings, "AllowRawHtml", "true"); } catch (Exception ex) { AddModuleMessage(ex.Message, MessageType.Error); } } public async Task UpdateSettings() { try { var settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId); settings = SettingService.SetSetting(settings, "AllowFileManagement", _allowfilemanagement); settings = SettingService.SetSetting(settings, "AllowRawHtml", _allowrawhtml); await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId); } catch (Exception ex) { AddModuleMessage(ex.Message, MessageType.Error); } } }