本文整理汇总了C#中IncomingMessage.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IncomingMessage.GetType方法的具体用法?C# IncomingMessage.GetType怎么用?C# IncomingMessage.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IncomingMessage
的用法示例。
在下文中一共展示了IncomingMessage.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleIncomingMessage
public override void HandleIncomingMessage(IncomingMessage message)
{
if (message is CredentialsMessage)
{
CredentialsMessage cm = message as CredentialsMessage;
if (AuthenticationHandler.Authenticate(cm.Credentials))
{
_session.ClientId.Credentials = cm.Credentials;
_session.Communication.SendAuthenticationAccepted();
_session.State = new PairingState(_session);
}
else
{
_session.Communication.SendAuthenticationRejected();
}
}
else if (message is ClientPausedMessage ||
message is ClientResumedMessage)
{
// Ignore, but not reject!
}
else
{
string errorMsg = string.Format("Message type '{0}' is not supported at this point", message.GetType().Name);
Debug.WriteLine(errorMsg);
throw new NotSupportedException(errorMsg);
}
}
示例2: HandleIncomingMessage
public override void HandleIncomingMessage(IncomingMessage message)
{
if (message is PinCodeMessage)
{
PinCodeMessage pincodeMessage = (message as PinCodeMessage);
ClientTagVisualization visualizationMatch = ClientSessionsController.Instance.GetMatchForPinCode(pincodeMessage.PinCode);
if (visualizationMatch != null)
{
ClientSessionsController.Instance.UnregisterPairingCodes(visualizationMatch);
_session.SetClientTag(visualizationMatch.VisualizedTag);
_session.Communication.SendPairingCodeAccepted();
if (ClientDataStorage.Instance.GetClientCalibration(visualizationMatch.VisualizedTag) == null)
{
_session.State = new CalibrationState(_session, visualizationMatch);
}
else
{
_session.State = new StreamingState(_session, visualizationMatch);
}
visualizationMatch.AssociateClient(_session);
}
else
{
_session.Communication.SendPincodeRejected();
}
}
else if (message is ColorCodeMessage)
{
throw new NotSupportedException("COLOR_CODE not supported yet");
}
else if (message is ClientPausedMessage ||
message is ClientResumedMessage)
{
// Ignore, but not reject!
}
else
{
string errorMsg = string.Format("Message type '{0}' is not supported at this point", message.GetType().Name);
Debug.WriteLine(errorMsg);
throw new NotSupportedException(errorMsg);
}
}
示例3: HandleIncomingMessage
public override void HandleIncomingMessage(IncomingMessage message)
{
if (message is CalibrationAcceptedMessage)
{
Visualization.CalibrationAccepted();
}
else if (message is TouchEventMessage ||
message is ColorCodeMessage ||
message is PinCodeMessage ||
message is ClientPausedMessage ||
message is ClientResumedMessage)
{
// Ignored messages, but not rejected...
}
else
{
Debug.WriteLine(string.Format("Message type '{0}' is not supported at this point", message.GetType().Name));
throw new NotSupportedException();
}
}
示例4: HandleIncomingMessage
public override void HandleIncomingMessage(IncomingMessage message)
{
if (message is TouchEventMessage)
{
if (Visualization != null)
{
Visualization.TouchEvent(message as TouchEventMessage);
}
}
else if (message is CalibrationAcceptedMessage)
{
if (Visualization != null)
{
Visualization.CalibrationAccepted();
}
}
else if (message is ClientPausedMessage)
{
StopStreaming();
}
else if (message is ClientResumedMessage)
{
StartStreaming();
}
else if (message is RequestCalibrationMessage)
{
Debug.WriteLineIf(DebugSettings.DEBUG_CALIBRATION, "RequestCalibrationMessage");
StopStreaming();
CalibrationState.SetAsState(_session, Visualization);
}
else if (message is ColorCodeMessage ||
message is PinCodeMessage)
{
// Ignored messages, but not rejected...
}
else
{
Debug.WriteLine(string.Format("Message type '{0}' is not supported at this point", message.GetType().Name));
throw new NotSupportedException();
}
}