示例#1
0
 public void SetCallback(OnProgressHandler onProgress, OnErrorHandler onError, OnSuccHandler onSucc, OnURLRedirectHandler onRedirect)
 {
     m_onProgressHandler = onProgress;
     m_onErrorHandler    = onError;
     m_onSuccHandler     = onSucc;
     m_onRedirectHandler = onRedirect;
 }
示例#2
0
    public bool DownLoadFile(string url, string saveFile, OnProgressHandler onProgress, OnErrorHandler onError, OnSuccHandler onSucc, OnURLRedirectHandler onRedirect)
    {
        bool hasTask = m_httpWorker != null;

        m_downLoadContent = null;

        m_onProgressHandler = onProgress;
        m_onErrorHandler    = onError;
        m_onSuccHandler     = onSucc;
        m_onRedirectHandler = onRedirect;

        m_fileName   = saveFile;
        m_httpWorker = new HttpClientHelper(saveFile, url, ++m_workerSerNum);
        m_loopCheckHelper.SetActive(true);

        m_httpWorker.SetCallback(new OnProgressHandler(this.OnProgress), new OnErrorHandler(this.OnError), new OnSuccHandler(this.OnSucc),
                                 new OnURLRedirectHandler(this.OnReidrect));
        m_httpWorker.Start();

        return(hasTask);
    }