private static void InvokeHandler(ReceiveHandler handler, Message msg, Connection.Connection connection) { var async = handler.GetType().GetCustomAttributes(typeof(AsyncOperationAttribute), false).Length > 0; if (async) { ThreadPool.QueueUserWorkItem((o) => handler.Invoke(msg, connection)); } else { handler.Invoke(msg, connection); } }
private static void InvokeHandler(ReceiveHandler handler, Message msg, Connection.Connection connection) { if (Dispatcher.IsInitialized) { Dispatcher.RunOnMainThread(handler, msg, connection); return; } var async = handler.GetType().GetCustomAttributes(typeof(AsyncOperationAttribute), false).Length > 0; if (async) { ThreadPool.QueueUserWorkItem((o) => handler.Invoke(msg, connection)); } else { handler.Invoke(msg, connection); } }