コード例 #1
0
ファイル: QRCodeHub.cs プロジェクト: Dekryptor/LeXun.Demos
 /// <summary>
 /// Called when the connection reconnects to this hub instance.
 /// </summary>
 /// <returns>A <see cref="T:System.Threading.Tasks.Task" /></returns>
 public override Task OnReconnected()
 {
     if (!SessionTimer.Timers.ContainsKey(Context.ConnectionId))
     {
         string      qrCodeTypeStr = Context.QueryString["qrCodeType"].ToString().ToLower();
         string      targetUrl     = Context.QueryString["TargetUrl"].ToString().ToLower();
         QRCodeTypes qrCodeType    = QRCodeTypes.Other;
         switch (qrCodeTypeStr)
         {
         case "logincode":
             qrCodeType = QRCodeTypes.Login;
             break;
         }
         SessionTimer.StartTimer(Context.ConnectionId, qrCodeType, targetUrl);
     }
     return(base.OnReconnected());
 }
コード例 #2
0
ファイル: QRCodeHub.cs プロジェクト: Dekryptor/LeXun.Demos
        /// <summary>
        /// Called when the connection connects to this hub instance.
        /// </summary>
        /// <returns>A <see cref="T:System.Threading.Tasks.Task" /></returns>
        public override Task OnConnected()
        {
            string      qrCodeTypeStr = Context.QueryString["qrCodeType"].ToString().ToLower();
            string      targetUrl     = Context.QueryString["TargetUrl"].ToString().ToLower();
            QRCodeTypes qrCodeType    = QRCodeTypes.Other;

            switch (qrCodeTypeStr)
            {
            case "logincode":
                qrCodeType = QRCodeTypes.Login;
                break;
            }
            SessionTimer.StartTimer(Context.ConnectionId, qrCodeType, targetUrl);
            //string uuid = Context.QueryString["uuid"].ToString();
            //SendQRCodeUUID(uuid);
            return(base.OnConnected());
        }
コード例 #3
0
ファイル: QRCodeHub.cs プロジェクト: Dekryptor/LeXun.Demos
        /// <summary>
        /// 重置时钟
        /// </summary>
        public void ResetTimer()
        {
            SessionTimer timer;

            if (SessionTimer.Timers.TryGetValue(Context.ConnectionId, out timer))
            {
                timer.ResetTimer();
            }
            else
            {
                string      qrCodeTypeStr = Context.QueryString["qrCodeType"].ToString().ToLower();
                string      targetUrl     = Context.QueryString["TargetUrl"].ToString().ToLower();
                QRCodeTypes qrCodeType    = QRCodeTypes.Other;
                switch (qrCodeTypeStr)
                {
                case "logincode":
                    qrCodeType = QRCodeTypes.Login;
                    break;
                }
                SessionTimer.StartTimer(Context.ConnectionId, qrCodeType, targetUrl);
            }
        }
コード例 #4
0
ファイル: QRCodeHub.cs プロジェクト: Dekryptor/LeXun.Demos
 /// <summary>
 /// Called when a connection disconnects from this hub gracefully or due to a timeout.
 /// </summary>
 /// <param name="stopCalled">
 /// true, if stop was called on the client closing the connection gracefully;
 /// false, if the connection has been lost for longer than the
 /// <see cref="P:Microsoft.AspNet.SignalR.Configuration.IConfigurationManager.DisconnectTimeout" />.
 /// Timeouts can be caused by clients reconnecting to another SignalR server in scaleout.
 /// </param>
 /// <returns>A <see cref="T:System.Threading.Tasks.Task" /></returns>
 public override Task OnDisconnected(bool stopCalled)
 {
     SessionTimer.StopTimer(Context.ConnectionId);
     return(base.OnDisconnected(stopCalled));
 }