Beispiel #1
0
        public async Task UpdateZoneStatusAsync(string subName, string zoneName, bool status)
        {
            await lazyLoadStatusAsync();

            var key     = subName + "." + zoneName;
            var changed = false;

            try
            {
                changed = status != zoneStatus[key];
            }
            catch (KeyNotFoundException)
            {
                changed = true;
            }

            zoneStatus[key] = status;

            if (changed)
            {
                var args = new ZoneStatusChangedEventArgs()
                {
                    SubName  = subName,
                    ZoneName = zoneName,
                    Status   = status
                };
                OnZoneStatusChanged(args);

                await storeStatusAsync();
            }
        }
Beispiel #2
0
        protected virtual void OnZoneStatusChanged(ZoneStatusChangedEventArgs args)
        {
            log.LogDebug("Dispatch status change for {0}.{1}.",
                         args.SubName, args.ZoneName);
            var handler = ZoneStatusChanged;

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