public CheckAnswerState( GameModel gameModel, IAsyncPublisher <GameStateEnum, bool> answerResultPublisher) { _gameModel = gameModel; _answerResultPublisher = answerResultPublisher; }
public static async Task <PublishedItems <T> > SubscribeToUpdatesAsync <T>(this IAsyncPublisher <T> publisher) { var models = new PublishedItems <T>(publisher); await models.InitializeAsync(); return(models); }
public UdpWorker(MessagePipeInterprocessUdpOptions options, IAsyncPublisher <IInterprocessKey, IInterprocessValue> publisher) { this.cancellationTokenSource = new CancellationTokenSource(); this.options = options; this.publisher = publisher; this.server = new Lazy <SocketUdpServer>(() => { return(SocketUdpServer.Bind(options.Port, 0x10000)); }); this.client = new Lazy <SocketUdpClient>(() => { return(SocketUdpClient.Connect(options.Host, options.Port, 0x10000)); }); #if !UNITY_2018_3_OR_NEWER this.channel = Channel.CreateUnbounded <byte[]>(new UnboundedChannelOptions() { SingleReader = true, SingleWriter = false, AllowSynchronousContinuations = true }); #else this.channel = Channel.CreateSingleConsumerUnbounded <byte[]>(); #endif }
public NamedPipeWorker(IServiceProvider provider, MessagePipeInterprocessNamedPipeOptions options, IAsyncPublisher <IInterprocessKey, IInterprocessValue> publisher) { this.pipeName = options.PipeName; this.provider = provider; this.cancellationTokenSource = new CancellationTokenSource(); this.options = options; this.publisher = publisher; this.server = CreateLazyServerStream(); this.client = new Lazy <NamedPipeClientStream>(() => { return(new NamedPipeClientStream(options.ServerName, options.PipeName, PipeDirection.InOut, PipeOptions.Asynchronous)); }); #if !UNITY_2018_3_OR_NEWER this.channel = Channel.CreateUnbounded <byte[]>(new UnboundedChannelOptions() { SingleReader = true, SingleWriter = false, AllowSynchronousContinuations = true }); #else this.channel = Channel.CreateSingleConsumerUnbounded <byte[]>(); #endif if (options.HostAsServer != null && options.HostAsServer.Value) { StartReceiver(); } }
public TcpWorker(IServiceProvider provider, MessagePipeInterprocessTcpOptions options, IAsyncPublisher <IInterprocessKey, IInterprocessValue> publisher) { this.provider = provider; this.cancellationTokenSource = new CancellationTokenSource(); this.options = options; this.publisher = publisher; this.server = new Lazy <SocketTcpServer>(() => { return(SocketTcpServer.Listen(options.Host, options.Port)); }); this.client = new Lazy <SocketTcpClient>(() => { return(SocketTcpClient.Connect(options.Host, options.Port)); }); #if !UNITY_2018_3_OR_NEWER this.channel = Channel.CreateUnbounded <byte[]>(new UnboundedChannelOptions() { SingleReader = true, SingleWriter = false, AllowSynchronousContinuations = true }); #else this.channel = Channel.CreateSingleConsumerUnbounded <byte[]>(); #endif if (options.HostAsServer != null && options.HostAsServer.Value) { StartReceiver(); } }
public GenerateLevelState( GameModel gameModel, IAsyncPublisher <GameStateEnum, IList <int> > answersPublisher, IAsyncPublisher <GameStateEnum, int> correctAnswerPublisher) { _gameModel = gameModel; _answersPublisher = answersPublisher; _correctAnswerPublisher = correctAnswerPublisher; }
public Program( IPublisher <string, MyMessage> publisher, ISubscriber <string, MyMessage> subscriber, IPublisher <MyMessage> keyless1, ISubscriber <MyMessage> keyless2, IAsyncPublisher <MyMessage> asyncKeylessP, IAsyncSubscriber <MyMessage> asyncKeylessS, IRequestHandler <Ping, Pong> pingponghandler, //PingHandler pingpingHandler, IRequestAllHandler <Ping, Pong> pingallhandler, IPublisher <int> intP, ISubscriber <int> intS, IServiceScopeFactory scopeF, MessagePipeDiagnosticsInfo diagnosticsInfo, IServiceProvider provider ) { this.provider = provider; this.scopeF = scopeF; this.publisher = publisher; this.subscriber = subscriber; this.keylessP = keyless1; this.keylessS = keyless2; this.asyncKeylessP = asyncKeylessP; this.asyncKeylessS = asyncKeylessS; this.pingponghandler = pingponghandler; //this.pingpingHandler = pingpingHandler; this.pingallhandler = pingallhandler; this.intPublisher = intP; this.intSubscriber = intS; this.diagnosticsInfo = diagnosticsInfo; var r1 = provider.GetRequiredService <IRequestHandler <string, int> >(); r1.Invoke("foo"); }
public InMemoryDistributedPublisher(IAsyncPublisher <TKey, TMessage> publisher) { this.publisher = publisher; }
public MainMenuState(IAsyncPublisher <GameStateEnum> gameStatePublisher) { _gameStatePublisher = gameStatePublisher; }
public PublishedItems(IAsyncPublisher <T> publisher, Func <T, bool>?filter = null) { _publisher = publisher; _filter = filter; }
public unsafe PublishOps() { var provider = new ServiceCollection().AddMessagePipe().BuildServiceProvider(); prism = new Prism.Events.EventAggregator().GetEvent <Message>(); prismStrong = new Prism.Events.EventAggregator().GetEvent <Message>(); var mdiatr = new ServiceCollection().AddMediatR(typeof(PublishOps).Assembly).BuildServiceProvider(); medi = mdiatr.GetRequiredService <IMediator>(); p = provider.GetRequiredService <IPublisher <Message> >(); var s = provider.GetRequiredService <ISubscriber <Message> >(); keyed = provider.GetRequiredService <IPublisher <Guid, Message> >(); var keyedS = provider.GetRequiredService <ISubscriber <Guid, Message> >(); hub = Hub.Default; var px = new ServiceCollection().AddMessagePipe().BuildServiceProvider(); filter1 = px.GetRequiredService <IPublisher <Message> >(); var filter1Sub = px.GetRequiredService <ISubscriber <Message> >(); var px2 = new ServiceCollection().AddMessagePipe().BuildServiceProvider(); filter2 = px2.GetRequiredService <IPublisher <Message> >(); var filter2Sub = px2.GetRequiredService <ISubscriber <Message> >(); m = new Message(); subject = new Subject <Message>(); signalBus = SetupZenject(); easyMsgHub = new MessageHub(); asyncP = provider.GetRequiredService <IAsyncPublisher <Message> >(); asyncS = provider.GetRequiredService <IAsyncSubscriber <Message> >(); #if WinBenchmark mvvmLight = new Messenger(); mvvmLightStrong = new Messenger(); #endif toolkitStrong = new Microsoft.Toolkit.Mvvm.Messaging.StrongReferenceMessenger(); toolkitWeak = new Microsoft.Toolkit.Mvvm.Messaging.WeakReferenceMessenger(); simpleArray = new PlainAction[8]; actionDelegate = new Action[8]; interfaceArray = new IInvoke[8]; for (int i = 0; i < 8; i++) { s.Subscribe(new EmptyMessageHandler()); prism.Subscribe(lambdaRef.Delegate); prismStrong.Subscribe(_ => { }, true); ev += _ => { }; subject.Subscribe(_ => { }); hub.Subscribe <Message>(_ => { }); #if WinBenchmark UniRx.MessageBroker.Default.Receive <Message>().Subscribe(new NopObserver()); mvvmLight.Register <Message>(this, _ => { }, false); // mvvmLightStrong.Register<Message>(this, _ => { }, true); #endif keyedS.Subscribe(key, _ => { }); filter1Sub.Subscribe(new EmptyMessageHandler(), new EmptyMessageHandlerFilter()); filter2Sub.Subscribe(new EmptyMessageHandler(), new EmptyMessageHandlerFilter(), new EmptyMessageHandlerFilter()); easyMsgHub.Subscribe <Message>(_ => { }); simpleArray[i] = new PlainAction(); actionDelegate[i] = new PlainAction().DelegateAction; interfaceArray[i] = new PlainAction(); asyncS.Subscribe((_, _) => default(ValueTask)); toolkitStrong.Register <Message>(new object(), lambdaRef2.Delegate); toolkitWeak.Register <Message>(new object(), lambdaRef2.Delegate); } signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); signalBus.Subscribe <Message>(_ => { }); }