public static AvailableNetworkSessionCollection EndFind(IAsyncResult result) { AvailableNetworkSessionCollection returnValue = null; List <AvailableNetworkSession> networkSessions = new List <AvailableNetworkSession>(); try { // Retrieve the delegate. #if WINDOWS_PHONE MonoGamerPeer.FindResults(networkSessions); #else AsyncResult asyncResult = (AsyncResult)result; // Wait for the WaitHandle to become signaled. result.AsyncWaitHandle.WaitOne(); // Call EndInvoke to retrieve the results. if (asyncResult.AsyncDelegate is NetworkSessionAsynchronousFind) { returnValue = ((NetworkSessionAsynchronousFind)asyncResult.AsyncDelegate).EndInvoke(result); MonoGamerPeer.FindResults(networkSessions); } #endif } finally { // Close the wait handle. result.AsyncWaitHandle.Close(); } returnValue = new AvailableNetworkSessionCollection(networkSessions); return(returnValue); }
public static AvailableNetworkSessionCollection EndFind(IAsyncResult result) { AvailableNetworkSessionCollection returnValue = null; try { // Retrieve the delegate. AsyncResult asyncResult = (AsyncResult)result; // Wait for the WaitHandle to become signaled. result.AsyncWaitHandle.WaitOne(); // Call EndInvoke to retrieve the results. if (asyncResult.AsyncDelegate is NetworkSessionAsynchronousFind) { returnValue = ((NetworkSessionAsynchronousFind)asyncResult.AsyncDelegate).EndInvoke(result); } } finally { // Close the wait handle. result.AsyncWaitHandle.Close(); } return(returnValue); }
public static AvailableNetworkSessionCollection EndFind(IAsyncResult result) { AvailableNetworkSessionCollection sessionCollection = (AvailableNetworkSessionCollection) null; List<AvailableNetworkSession> list = new List<AvailableNetworkSession>(); try { AsyncResult asyncResult = (AsyncResult) result; result.AsyncWaitHandle.WaitOne(); if (asyncResult.AsyncDelegate is NetworkSessionAsynchronousFind) sessionCollection = ((NetworkSessionAsynchronousFind) asyncResult.AsyncDelegate).EndInvoke(result); } finally { result.AsyncWaitHandle.Close(); } return new AvailableNetworkSessionCollection((IList<AvailableNetworkSession>) list); }