Example #1
0
        public override Task OnConnected()
        {
            var loginName = HttpContext.Current.Request.Cookies["LastLoginname"].Value;                                             //验证信息

            ProgressiveJobInterface.OnConnected(string.IsNullOrEmpty(credentials) ? loginName : credentials, Context.ConnectionId); //存储验证信息
            //ProgressiveJobInterface.Inital(loginName, ProgressiveJobManager.progressiveJobs(loginName)); //初始化当前进度任务
            return(base.OnConnected());
        }
Example #2
0
        /// <summary>
        /// 更新任务进度
        /// </summary>
        public void UpdateProgress(int progress, string description)
        {
            Progress    = progress;
            Description = description;
            ProgressiveJobInterface.AddorUpdate(UserLoginName, this);

            if (progress == 100)
            {
                //任务完成后还显示3秒
                ProgressiveJobInterface.Finish(UserLoginName, this);
                Thread.Sleep(3000);
                ProgressiveJobManager.Remove(this);
            }
        }
Example #3
0
 //接收客户端发送的消息,取消执行任务
 public void Stop(string name)
 {
     ProgressiveJobInterface.OnDisconnected(name);
     OnDisconnected();
 }