当前位置: 首页>>代码示例>>C#>>正文


C# IncomingMessage.GetType方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:CodeByBerglund,项目名称:nai-framework,代码行数:28,代码来源:AuthenticationState.cs

示例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);
     }
 }
开发者ID:CodeByBerglund,项目名称:nai-framework,代码行数:42,代码来源:PairingState.cs

示例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();
     }
 }
开发者ID:CodeByBerglund,项目名称:nai-framework,代码行数:20,代码来源:CalibrationState.cs

示例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();
     }
 }
开发者ID:CodeByBerglund,项目名称:nai-framework,代码行数:41,代码来源:StreamingState.cs


注:本文中的IncomingMessage.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。