Esempio n. 1
0
        /// <inheritdoc/>
        public IDisposable EnableFilter(params string[] filterNames)
        {
            //TODO: Check if filters exists?

            var enabledFilters = new List <string>();

            foreach (var filterName in filterNames)
            {
                var filterIndex = GetFilterIndex(filterName);
                if (!filters[filterIndex].IsEnabled)
                {
                    enabledFilters.Add(filterName);
                    filters[filterIndex] = new DataFilterConfiguration(filters[filterIndex], true);
                }
            }

            enabledFilters.ForEach(ApplyEnableFilter);

            return(new DisposeAction(() => DisableFilter(enabledFilters.ToArray())));
        }
Esempio n. 2
0
        private void ChangeFilterIsEnabledIfNotOverrided(List <DataFilterConfiguration> filterOverrides, string filterName, bool isEnabled)
        {
            if (filterOverrides.Any(f => f.FilterName == filterName))
            {
                return;
            }

            var index = filters.FindIndex(f => f.FilterName == filterName);

            if (index < 0)
            {
                return;
            }

            if (filters[index].IsEnabled == isEnabled)
            {
                return;
            }

            filters[index] = new DataFilterConfiguration(filterName, isEnabled);
        }