private void tryAddingComponent(object o) { if (o is IAliasAnswerer) { IAliasAnswerer asAns = (IAliasAnswerer)o; List <IAliasAnswerer> answerers; if (asAns.getAlias() == null) { return; } if (components.ContainsKey(asAns.getAlias())) { answerers = components[asAns.getAlias()]; answerers.Add(asAns); } else { answerers = new List <IAliasAnswerer>(); answerers.Add(asAns); components.Add(asAns.getAlias(), answerers); } notifyAliasAdd(asAns.getAlias(), asAns); } }
//public void unregisterComponent(IAliased comp) public void unregisterComponent(IAliasAnswerer comp) { try { unregisterComponent(comp.getAlias()); } catch (Exception e) { } }
//public void registerComponent(string alias, IAliased comp) public void registerComponent(string alias, IAliasAnswerer comp) { if (alias != null && alias.Length > 0) { if (components.ContainsKey(comp.getAlias())) { components[comp.getAlias()] = comp; } else { components.Add(alias, comp); } if (socket != null && active) { notifyAliasAdd(alias); } } }
private void tryRemovingComponent(object o) { if (o is IAliasAnswerer) { IAliasAnswerer asAns = (IAliasAnswerer)o; if (asAns.getAlias() == null) { return; } List <IAliasAnswerer> answerers = components[asAns.getAlias()]; if (answerers != null) { answerers.Remove(asAns); } } }
//public void registerComponent(IAliased comp) public void registerComponent(IAliasAnswerer comp) { registerComponent(comp.getAlias(), comp); }