Example #1
0
        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);
            }
        }
Example #2
0
File: Host.cs Project: bumac/VKRLib
        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);
            }
        }