Esempio n. 1
0
 /// <summary>
 /// 取消暂停任务
 /// </summary>
 /// <param name="gid">任务标识符</param>
 /// <returns>成功返回true, 失败返回fale</returns>
 public bool UnPause(string gid)
 {
     try
     {
         bool result = Aria2cWarpper.UnPause(gid);
         if (result)
         {
             Aria2cTask task = Aria2cWarpper.TellStatus(gid);
             OnUnPause?.Invoke(this, new Aria2cTaskEvent(task));
         }
         return(result);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }
 private void Update()
 {
     if (Pause_Keys.KeyDown())
     {
         if (!paused)
         {
             paused         = true;
             Time.timeScale = 0;
             OnPause.Invoke();
         }
         else
         {
             paused         = false;
             Time.timeScale = 1;
             OnUnPause.Invoke();
         }
     }
 }
        /// <summary>
        /// 任务状态变换
        /// </summary>
        /// <param name="task"></param>
        private void OnStatusChanged(Aria2cTask task)
        {
            switch (task.Status)
            {
            case Aria2cTaskStatus.Active:
                OnUnPause?.Invoke(this, new Aria2cTaskEvent(task));
                break;

            case Aria2cTaskStatus.Complete:
            {
                OnFinish?.Invoke(this, new Aria2cTaskEvent(task));
                RemoveDownTask(task.Gid);
                if (CountDownTask() == 0)
                {
                    OnAllFinish?.Invoke(this, new EventArgs());
                }
            }
            break;

            case Aria2cTaskStatus.Error:
                OnError?.Invoke(this, new Aria2cTaskEvent(task));
                break;

            case Aria2cTaskStatus.Paused:
                OnPaused?.Invoke(this, new Aria2cTaskEvent(task));
                break;

            case Aria2cTaskStatus.Removed:
                OnRemoved?.Invoke(this, new Aria2cEvent(task.Gid));
                downLoadDict.Remove(task.Gid);
                break;

            case Aria2cTaskStatus.Waiting:
                OnWaiting?.Invoke(this, new Aria2cTaskEvent(task));
                break;

            default:
                break;
            }
        }
Esempio n. 4
0
	public void UnPause(){
		IsPaused = false;
		if (onUnPause != null) {
			onUnPause.Invoke ();
		}
	}