예제 #1
0
        public async Task <bool> ApplySetting(ISettingApplyingContext context)
        {
            var settingApplyingContext = context as IQuickAccessMemoryApplyingContext;

            foreach (var quickAccessAddressRange in QuickAccessAddressRanges)
            {
                await settingApplyingContext.OnFillAddressRange(quickAccessAddressRange);
            }
            return(IsSettingEnabled);
        }
예제 #2
0
        public async Task <bool> ApplySettingByKey(string key, ISettingApplyingContext settingApplyingContext)
        {
            IFragmentSetting settingToApply = FragmentSettings.FirstOrDefault((setting => setting.StrongName == key));

            if (settingToApply == null)
            {
                return(false);
            }
            return(await settingToApply.ApplySetting(settingApplyingContext));
        }
        public async Task <bool> ApplySetting(ISettingApplyingContext settingApplyingContext)
        {
            if (IsSettingEnabled &&
                settingApplyingContext is IActivatedSettingApplyingContext activatedSettingApplyingContext)
            {
                IQueryResult queryResult = await activatedSettingApplyingContext.DataProvider.WriteSingleCoilAsync(
                    ActivationAddress, true,
                    ConfigurationKeys.Settings.ACTIVATION_CONFIGURATION_SETTING);

                return(queryResult.IsSuccessful);
            }

            return(false);
        }