Esempio n. 1
0
        /// <inheritdoc />
        public void ActivateElement(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.Activate(container, element);
            adapter.Sort(container);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public bool Navigate(string region, object element)
        {
            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;

            bool result = adapter.Navigate(container, element);

            adapter.Sort(container);

            return(result);
        }
Esempio n. 3
0
        /// <inheritdoc />
        public void ActivateAllElements(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.Activate(container, element);
            }

            adapter.Sort(container);
        }
Esempio n. 4
0
        /// <inheritdoc />
        public void ClearElements(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;

            adapter.Clear(container);
            adapter.Sort(container);
        }