private void HandleChildRemoved(IServiceList <TChildren> sender, TChildren child) { child.Container = null; child.Bounds.OnChanged -= this.HandleChildBoundsChanged; this.TryCleanInline(); }
public IService FindByClass(IServiceList list, Type @class) { return(list .GetServices() .Where(x => x.Registration.TargetType.IsAssignableFrom(@class)) .FirstOrDefault()); }
private void HandleUserAdded(IServiceList <IUser> sender, IUser user) { if (user.Connection != default && !this.Connections.Contains(user.Connection)) { this.Connections.Add(user.Connection); } }
private void HandleUserRemoved(IServiceList <IUser> sender, IUser user) { if (user.Connection != default && this.Connections.Contains(user.Connection)) { this.Connections.Remove(user.Connection); } }
private void HandleUserLeft(IServiceList <IUser> sender, IUser oldUser) { // Broadcast the disconnected user id to all connected peers... this.Messages[Constants.Messages.Channel.UserLeft].Create(om => { om.Write(oldUser.Id); }, this.Users.Connections); }
private void HandleUserAddedToPipe(IServiceList <IUser> sender, IUser args) { // Broadcast every single networkEntity within the pipe to the new user. foreach (INetworkEntity networkEntity in this.Entity.NetworkEntities) { networkEntity.Messages[Guppy.Network.Constants.Messages.NetworkEntity.Create].Create(args.Connection.Yield()); } }
public IEnumerable <IService> FindGenericServices(IServiceList list, Type type) { if (IsClassValidator.Validate(type)) { return(ClassFinder.FindClasses(list, type)); } return(InterfaceFinder.FindInterfaces(list, type)); }
public ServiceUpdateDatabase( IServiceList <Logger> serviceList, ILogger <ServiceUpdateDatabase> logger, IMediator mediator) { _serviceList = serviceList; _logger = logger; _mediator = mediator; }
public CreateManyLoggerCommandHandler( IRepositoryCommand <Logger> repository, ILogger <CreateManyLoggerCommandHandler> logger, IServiceList <Logger> serviceList) { _repository = repository; _logger = logger; _serviceList = serviceList; }
public IEnumerable <IService> FindMany(IServiceList list, Type type) { if (GenericParametersChecker.Check(type)) { return(GenericServiceFinder.FindGenericServices(list, type)); } return(TypeIsClassValidator.Validate(type) ? ByClassFinder.FindManyByClass(list, type) : ByInterfaceFinder.FindManyByInterface(list, type)); }
public IEnumerable <IService> FindClasses(IServiceList list, Type @class) { IEnumerable <Type> keyParameters = GenericParametersProvider.ProvideGenericTypes(@class); return(list .GetServices() .Where(x => x.Registration.RegistrationFlags.Has(RegistrationFlagConstants.HasGenericParameters)) .Where(x => x.Registration.RegistrationFlags.SelectValueOrNull <IEnumerable <Type> >(RegistrationFlagConstants.GenericParameters).Count() == keyParameters.Count()) .Where(x => x.Registration.RegistrationFlags.SelectValueOrNull <IEnumerable <Type> >(RegistrationFlagConstants.GenericParameters).SequenceEqual(keyParameters))); }
private void HandleChildAdded(IServiceList <TChildren> sender, TChildren child) { if (child.Container != null && child.Container != this) { throw new Exception($"Unable to add child, already resides within another container."); } child.Container = this; child.TryCleanBounds(); child.Bounds.OnChanged += this.HandleChildBoundsChanged; this.TryCleanInline(); }
public IService Find(IServiceList list, Type typeKey) { if (GenericParametersChecker.Check(typeKey)) { return(GenericServiceFinder .FindGenericServices(list, typeKey) .FirstOrDefault()); } bool isClass = TypeIsClassValidator.Validate(typeKey); return(isClass ? ByClassFinder.FindByClass(list, typeKey) : ByInterfaceFinder.FindByInterface(list, typeKey)); }
public void Register(IServiceList list, IEnumerable <IService> services) { IEnumerable <IService> filteredList = RegistratedServicesFilter.Filter(list, services); foreach (IService service in filteredList) { if (!InstanceChecker.Check(service)) { InstanceProvider.ProvideInstance(service); } list.AddService(service); } }
public IEnumerable <IService> FindManyByInterface(IServiceList list, Type @interface) { foreach (IService service in list.GetServices()) { IEnumerable <IInterface> interfaces = InterfacesExtractor.ExtractInterfaces(service.Registration); IEnumerable <IInterface> matchingInterfaces = interfaces .Where(x => !x.HasGenericArguments) .Where(x => Comparer.Compare(@interface, x.Type)); if (matchingInterfaces.Any()) { yield return(service); } } }
/// <summary> /// Throw an exception when a later is added to the /// collection. /// </summary> /// <param name="item"></param> /// <returns></returns> private bool CanAddLayer(IServiceList <ILayer> list, ILayer item) { foreach (Layer layer in this) { if (item.Id == layer.Id) { return(false); } else if (item.Group.Overlap(layer.Group)) { throw new Exception("Unable to add Layer to collection, Group overlap detected."); } } return(true); }
private void HandleUserJoined(IServiceList <IUser> sender, IUser newUser) { // Broadcast a list of all users to the new user... foreach (IUser user in this.Users) { if (user != newUser) { this.Messages[Constants.Messages.Channel.UserJoined].Create(om => { user.TryWrite(om); }, newUser.Connection.Yield()); } } // Broadcast the new users to all connected users. this.Messages[Constants.Messages.Channel.UserJoined].Create(om => { newUser.TryWrite(om); }, this.Users.Connections); }
public IEnumerable <IService> FindInterfaces(IServiceList list, Type @interface) { // return list.GetServices() // .Where(x => x.Registration.Interfaces.Count > 0) // .Where(x => x.Registration.Interfaces.Where(x => x.HasGenericArguments).Any()) // .Where(x => x.Registration.Interfaces.Where(x => Comparer.Compare(@interface, x.Type)).Any()); // TODO provizory foreach (IService service in list.GetServices()) { IEnumerable <IInterface> interfaces = InterfacesExtractor.ExtractInterfaces(service.Registration); IEnumerable <IInterface> matchingInterfaces = interfaces .Where(x => x.HasGenericArguments) .Where(x => Comparer.Compare(@interface, x.Type)); if (matchingInterfaces.Any()) { yield return(service); } } }
private void HandleChannelAdded(IServiceList <IChannel> sender, IChannel args) { _channels.Add(args.Id, args); }
public IEnumerable <IService> Filter(IServiceList list, IEnumerable <IService> services) { return(services.Where(x => list.GetServices().SingleOrDefault(y => y.Registration.TargetType == x.Registration.TargetType) == null)); }
private void HandleChannelRemoved(IServiceList <IChannel> sender, IChannel args) { _channels.Remove(args.Id); }
public QueueController(IServiceList <Logger> serviceList) { _serviceList = serviceList; }
public bool Check(IServiceList list, Type type) { return(Finder.Find(list, type) != null); }
public IEnumerable <IService> FindManyByClass(IServiceList list, Type @class) { return(list .GetServices() .Where(x => x.Registration.TargetType.IsAssignableFrom(@class))); }
private void HandleNetworkEntityRemovedFromPipe(IServiceList <INetworkEntity> sender, INetworkEntity networkEntity) { // Broadcast the delete message to all users who are not also in the new NE's pipe. networkEntity.Messages[Guppy.Network.Constants.Messages.NetworkEntity.Delete].Create( this.Entity.Users.Connections.Except(networkEntity.Pipe?.Users.Connections ?? Enumerable.Empty <NetConnection>())); }
private void HandleNetworkEntityAddedToPipe(IServiceList <INetworkEntity> sender, INetworkEntity networkEntity) { // Broadcast create message through the pipe... networkEntity.Messages[Guppy.Network.Constants.Messages.NetworkEntity.Create].Create(this.Entity); }
private void HandleUserConnected(IServiceList <IUser> sender, IUser args) { this.Channel.Users.TryAdd(args); this.Channel.Pipes.GetOrCreateById(Guid.Empty).Users.TryAdd(args); }
private void HandleUserJoined(IServiceList <IUser> sender, IUser args) { // throw new NotImplementedException(); }