private void btnSubscribe_Click(object sender, RoutedEventArgs e) { string state = txtState.Text.ToUpper(); if (state != string.Empty && state.Length == 2) { Subscription subscription = _Subscriptions.FirstOrDefault(item => item.State.ToUpper() == state); if (subscription == null) { subscription = new Subscription() { State = state }; _Subscriptions.Add(subscription); Task.Run(() => { int subs = _Proxy.Subscribe(state); _SyncContext.Send(new SendOrPostCallback(arg => { subscription.Subscribers = subs; txtState.Text = ""; }), null); }); } } }
private void TesteCon() { var itemsFunc = new List <Mensagem>(); EndpointAddress address = new EndpointAddress(serverPubSubManagerEndPont); Binding binding = new NetTcpBinding(); PubSubClient proxy = new PubSubClient(new InstanceContext(this)); proxy.Open(); proxy.Subscribe("asdasd"); proxy.Close(); }
private bool JoinGame(string playerName, string clientUri) { if (gameJoined == true) { return(true); } if (psc.Subscribe() == true) { gameJoined = true; return(true); } // need to call stateupdate to notify host that you have joined the game Debug.LogError("Error: failed to join game."); return(false); }