本文整理汇总了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" );
}