// Callback for ApplicationEndpoint's BeginEstablish(). static void EndEndpointEstablish(IAsyncResult ar) { LocalEndpoint currentEndpoint = ar.AsyncState as LocalEndpoint; try { currentEndpoint.EndEstablish(ar); _currentEndpoint = currentEndpoint; // Here, we have the endpoint fully established // So let's get started _currentEndpoint.RegisterForIncomingCall <AudioVideoCall>(IncomingAVCallReceived); _locations.Add(new Location(0, "Airport", ConfigurationManager.AppSettings["AirportRoomMusic"], _currentEndpoint)); _locations.Add(new Location(1, "Bus", ConfigurationManager.AppSettings["BusRoomMusic"], _currentEndpoint)); _locations.Add(new Location(2, "Outdoor", ConfigurationManager.AppSettings["OutdoorRoomMusic"], _currentEndpoint)); } catch (ConnectionFailureException connFailEx) { Console.WriteLine("ConnectionFailure Exception: " + connFailEx.ToString()); } catch (RealTimeException realTimeEx) { Console.WriteLine("RealTimeException : " + realTimeEx.ToString()); } catch (Exception Ex) { Console.WriteLine("Exception : " + Ex.ToString()); } }
private void EndEndpointEstablish(IAsyncResult ar) { LocalEndpoint currentEndpoint = ar.AsyncState as LocalEndpoint; try { currentEndpoint.EndEstablish(ar); } catch (AuthenticationException authEx) { // AuthenticationException will be thrown when the credentials are invalid. NonBlockingConsole.WriteLine(authEx.Message); throw; } catch (ConnectionFailureException connFailEx) { // ConnectionFailureException will be thrown when the endpoint cannot connect to the server, or the credentials are invalid. NonBlockingConsole.WriteLine(connFailEx.Message); throw; } catch (InvalidOperationException iOpEx) { // InvalidOperationException will be thrown when the endpoint is not in a valid state to connect. To connect, the platform must be started and the Endpoint Idle. NonBlockingConsole.WriteLine(iOpEx.Message); throw; } finally { // Again, just for sync. reasons. _endpointInitCompletedEvent.Set(); } }
// Callback for ApplicationEndpoint's BeginEstablish(). private void EndEndpointEstablish(IAsyncResult ar) { LocalEndpoint currentEndpoint = ar.AsyncState as LocalEndpoint; try { currentEndpoint.EndEstablish(ar); } catch (ConnectionFailureException connFailEx) { // ConnectionFailureException will be thrown when the endpoint // cannot connect to the server. // TODO (Left to the reader): Write actual handling code for the // occurrence. Console.WriteLine("ConnectionFailure Exception: " + connFailEx.ToString()); } catch (RealTimeException realTimeEx) { // RealTimeException may be thrown as a result of any UCMA // operation. // TODO (Left to the reader): Write actual handling code for the // occurrence. Console.WriteLine("RealTimeException : " + realTimeEx.ToString()); } }