@namespace Oqtane.Themes.OqtaneTheme @inherits ModuleBase @implements Oqtane.Interfaces.ISettingsControl @inject ISettingService SettingService @attribute [OqtaneIgnore]
@code { private string resourceType = "Oqtane.Themes.OqtaneTheme.ContainerSettings, Oqtane.Client"; // for localization private string _title = "true"; private string _background = ""; private string _text = ""; private string _border = ""; protected override void OnInitialized() { try { _title = SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Title", "true"); _background = SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Background", ""); _text = SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Text", ""); _border = SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Border", ""); } catch (Exception ex) { AddModuleMessage(ex.Message, MessageType.Error); } } public async Task UpdateSettings() { try { var settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId); settings = SettingService.SetSetting(settings, GetType().Namespace + ":Title", _title); settings = SettingService.SetSetting(settings, GetType().Namespace + ":Background", _background); settings = SettingService.SetSetting(settings, GetType().Namespace + ":Text", _text); settings = SettingService.SetSetting(settings, GetType().Namespace + ":Border", _border); await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId); } catch (Exception ex) { AddModuleMessage(ex.Message, MessageType.Error); } } }