/// <inheritdoc /> public void DeactivateElement(string region, object element) { if (region == null) { throw new ArgumentNullException(nameof(region)); } if (element == null) { throw new ArgumentNullException(nameof(element)); } if (string.IsNullOrWhiteSpace(region)) { throw new ArgumentException("Parameter is an empty string.", nameof(region)); } if (!this.RegionDictionary.ContainsKey(region)) { throw new RegionNotFoundException(region); } this.AddElement(region, element); object container = this.RegionDictionary[region] .Item1; IRegionAdapter adapter = this.RegionDictionary[region] .Item2; adapter.Deactivate(container, element); adapter.Sort(container); }
/// <inheritdoc /> public void DeactivateAllElements(string region) { if (region == null) { throw new ArgumentNullException(nameof(region)); } if (string.IsNullOrWhiteSpace(region)) { throw new ArgumentException("Parameter is an empty string.", nameof(region)); } if (!this.RegionDictionary.ContainsKey(region)) { throw new RegionNotFoundException(region); } object container = this.RegionDictionary[region] .Item1; IRegionAdapter adapter = this.RegionDictionary[region] .Item2; List <object> elements = adapter.Get(container); foreach (object element in elements) { adapter.Deactivate(container, element); } adapter.Sort(container); }