public static async void openConnectionServer() { // Open a connection to the server try { using (_call = _chatService.chat()) { // Read messages from the response stream while (await _call.ResponseStream.MoveNext(CancellationToken.None)) { var serverMessage = _call.ResponseStream.Current; var otherClientMessage = serverMessage.Message; MessageFormatter.RecieveMessage(otherClientMessage.From, otherClientMessage.Message); ManelePlayer.RecieveMessage(otherClientMessage.Message); } } } catch (RpcException) { _call = null; throw; } }
public ChatWindow() { InitializeComponent(); MessageFormatter.SubscribeToMessageReciever(UpdateChatTextBlock); }