本文整理匯總了C#中System.Globalization.Message.ContainsKey方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.ContainsKey方法的具體用法?C# Message.ContainsKey怎麽用?C# Message.ContainsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Globalization.Message
的用法示例。
在下文中一共展示了Message.ContainsKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReceiveMessage
public void ReceiveMessage(Message message)
{
ASSERT( message != null, "Missing parameter 'message'" );
LOG( "ReceiveMessage(" + message + ") - Start" );
#if DEBUG
MessageReceived = true;
#endif
if( Router != null )
{
var triggerMessageKeys = Router.TriggerMessageKeys;
var n = triggerMessageKeys.Length;
for( int i=0; i<n; ++i )
{
var triggerKey = triggerMessageKeys[ i ];
if( message.ContainsKey(triggerKey) )
{
LOG( "ReceiveMessage(" + message + ") - Invoke router for this message" );
Router.ReceiveTriggeredMessageFromConnection( message );
LOG( "ReceiveMessage(" + message + ") - Router returned" );
goto EXIT;
}
}
}
CallbackItem callbackItem;
if(! HandlerCallbacks.TryGetValue(message.HandlerType, out callbackItem) )
throw new NotImplementedException( "There is no message handler defined for messages of type '" + message.HandlerType + "'" );
var messageContext = new MessageContext( this, callbackItem, message );
if(! callbackItem.IsThreaded )
{
// Process message right now
HandleMessageThread( messageContext, /*taskEntry=*/null );
}
else
{
// Handle the message inside its own thread
TaskQueue.CreateTask( (taskEntry)=>{ HandleMessageThread(messageContext, taskEntry); } );
}
EXIT:
LOG( "ReceiveMessage(" + message + ") - Exit" );
}