Example #1
0
    //网络下载任务
    private void RunDownloadTask(SSHttpTask task)
    {
        bool failure = httpClient.doDownload(task.request, task.filePath);

        if (!failure)
        {
            AsyncTask.QueueOnMainThread(() => { task.handleMainThreadCompleted(); });
        }
        else
        {
            AsyncTask.QueueOnMainThread(() => { task.handleErrorOcurr(); });
        }
    }
Example #2
0
    private void RunCommon(SSHttpTask task)
    {
        string acknowlege = httpClient.doRequest(task.request);

        //Check if we need response or not.


        if (!string.IsNullOrEmpty(acknowlege))
        {
            task.response = acknowlege.Trim();
            AsyncTask.QueueOnMainThread(() => { task.handleMainThreadCompleted(); });
        }
        else
        {
            // error ocurr
            task.response = UNABLE_GET_RESPONSE;
            AsyncTask.QueueOnMainThread(() => { task.handleErrorOcurr(); });
        }
    }