/// <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()))); }
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); }