private void ReceiveGameState(IAsyncResult result) { try { HttpListenerContext context = portListener.EndGetContext(result); HttpListenerRequest request = context.Request; string JSON; waitForConnection.Set(); using (Stream inputStream = request.InputStream) { using (StreamReader sr = new StreamReader(inputStream)) JSON = sr.ReadToEnd(); } using (HttpListenerResponse response = context.Response) { response.StatusCode = (int)HttpStatusCode.OK; response.StatusDescription = "OK"; response.Close(); } CurrentGameState = new CurrentGameStateService(JSON); } catch (ObjectDisposedException) { // Intentionally left blank, when the Listener is closed. } }
private void OnNewGameState(CurrentGameStateService gs) { CurrentGameViewModel currentGameViewModel = new CurrentGameViewModel(gs); CurrentMatchInfo = currentGameViewModel.CurrentMatchInfo; }
private void OnNewGameState(CurrentGameStateService gs) { PreGameViewModel = new PreGameViewModel(cache, gs); check = true; }