Example #1
0
        public async Task UpdateCurrentZoneAsync(string subName, string zoneName)
        {
            await lazyLoadZonesAsync();

            if (String.IsNullOrEmpty(zoneName))
            {
                zoneName = null;
            }

            var changed = false;

            try
            {
                changed = zoneName != currentZone[subName];
            }
            catch (KeyNotFoundException)
            {
                changed = true;
            }

            currentZone[subName] = zoneName;

            if (changed)
            {
                var args = new CurrentZoneChangedEventArgs()
                {
                    SubName  = subName,
                    ZoneName = zoneName
                };
                OnCurrentZoneChanged(args);

                await storeZonesAsync();
            }
        }
Example #2
0
        protected virtual void OnCurrentZoneChanged(CurrentZoneChangedEventArgs args)
        {
            log.LogDebug("Dispatch zone change for {0}.", args.SubName);
            var handler = CurrentZoneChanged;

            if (handler != null)
            {
                handler(this, args);
            }
        }