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(); } }
protected virtual void OnCurrentZoneChanged(CurrentZoneChangedEventArgs args) { log.LogDebug("Dispatch zone change for {0}.", args.SubName); var handler = CurrentZoneChanged; if (handler != null) { handler(this, args); } }