void IZeroOption.Load(bool first) { var option = ConfigurationHelper.Get <RabbitMQOption>(sectionName); if (option == null) { throw new ZeroOptionException(optionName, sectionName); } if (option.HostName.IsBlank() || option.Port < 0 || option.Port > 65536) { throw new ZeroOptionException(optionName, sectionName, "HostName或Port不正确"); } HostName = option.HostName; Port = option.Port; UserName = option.UserName; Password = option.Password; AsyncPost = option.AsyncPost; Concurrency = option.Concurrency; if (Concurrency <= 0) { Concurrency = 1; } if (ItemOptions == null) { ItemOptions = new Dictionary <string, RabbitMQItemOption>(StringComparer.OrdinalIgnoreCase); } if (option.ItemOptions == null || option.ItemOptions.Count == 0) { return; } foreach (var kv in option.ItemOptions) { if (!ItemOptions.ContainsKey(kv.Key)) { ItemOptions.Add(kv.Key, kv.Value); } } }
public void Add(LayoutItem child, Map options) { if (Children.Contains(child)) { Remove(child); } Children.Add(child); if (!ItemOptions.ContainsKey(child)) { ItemOptions.Add(child, options); } else { if (options != null) { if (!options.Equals(ItemOptions[child])) { Children.EnsureAdded(child); } } } }