示例#1
0
        public override IButterflyWPFClient Build()
        {
            this.RegisterViewModels();
            var networkClientBuilder = new NetworkClientBuilder();
            var services             = networkClientBuilder.GetServiceCollection();

            services.AddSingleton <IEventAggregator>(this.containerRegistry.Resolve <IEventAggregator>());

            networkClientBuilder.UseIp("87.206.204.123")
            .UseTcp(7894)
            //.UseUdp(7895, 7895)
            .RegiserUnionsModule <DefaultDynamicUnionsModule>()
            .RegisterPacketHandlerModule <WPFClientHandlerModule>()
            .UseZeroFormatter()
            .SetPacketBufferSize(2000000)
            .Build();
            var serviceProvider    = networkClientBuilder.GetServiceProvider();
            var networkClient      = serviceProvider.GetService <INetworkClient>();
            var videoPacketHandler = serviceProvider.GetService <WPFNv21VideoPacketHandler>();


            this.containerRegistry.RegisterInstance <WPFNv21VideoPacketHandler>(videoPacketHandler);
            this.containerRegistry.RegisterInstance <INetworkClient>(networkClient);
            this.containerRegistry.RegisterInstance <IButterflyWPFClient>(new ButterflyWPFClient(networkClient,
                                                                                                 this.containerRegistry.Resolve <IEventAggregator>()));

            return(containerRegistry.Resolve <IButterflyWPFClient>());
        }
示例#2
0
        public virtual IButterflyMobileClientBuilder BuildNetworkClient()
        {
            var builderNetwork = new NetworkClientBuilder().SetServiceCollection(this.GetServiceCollection());

            builderNetwork.UseIp("87.206.204.123")
            .UseTcp(7894)
            .UseUdp(7895, 7896)
            .RegisterPacketHandlerModule <DefaultPacketHandlerModule>()
            .UseZeroFormatter()
            .SetPacketBufferSize(500000)
            .Build();
            return(this);
        }