コード例 #1
0
ファイル: State.cs プロジェクト: akeil/OwnZone
        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();
            }
        }
コード例 #2
0
ファイル: State.cs プロジェクト: akeil/OwnZone
        protected virtual void OnCurrentZoneChanged(CurrentZoneChangedEventArgs args)
        {
            log.LogDebug("Dispatch zone change for {0}.", args.SubName);
            var handler = CurrentZoneChanged;

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