/// <summary>
        /// 请求上传图片API接口
        /// </summary>
        /// <param name="requestUri">API请求的uri</param>
        /// <param name="httpMethod">API的请求方式</param>
        /// <param name="requestParams">API的请求参数</param>
        /// <param name="imageParam">图片参数</param>
        private void AsyncRequestAPIWithFile(string requestUri, string httpMethod, Dictionary<string, object> requestParams, FileSyncAPIRequestFileParam fileParam)
        {
            HttpWebRequest request = null;
            FileSyncAPIRequestState state = new FileSyncAPIRequestState();
            try
            {
                requestUri = FileSyncUtility.AddParametersToURL(requestUri, requestParams);
                request = (HttpWebRequest)WebRequest.Create(new Uri(requestUri));

                boundary = "----------" + DateTime.Now.Ticks.ToString("x");

                byte[] beginBoundary = Encoding.UTF8.GetBytes(string.Format("--{0}\r\n", boundary));

                string fileTemplate = "Content-Disposition: form-data; name=\"file\"; filename=\"{0}\"\r\nContent-Type: application/octet-stream\r\n\r\n";
                byte[] bfile = Encoding.UTF8.GetBytes(String.Format(fileTemplate, fileParam.FileKey));

                byte[] endBoundary = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");

                request.Method = httpMethod;
                request.ContentType = "multipart/form-data; boundary=" + boundary;
                request.ContentLength = beginBoundary.Length + bfile.Length + fileParam.FileData.Length + endBoundary.Length;
                request.AllowWriteStreamBuffering = false;
                request.Timeout = 300000;

                state.request = request;
                state.requestParams = requestParams;
                state.fileParam = fileParam;
                state.beginBoundary = beginBoundary;
                state.bfile = bfile;
                state.endBoundary = endBoundary;

                request.BeginGetRequestStream(new AsyncCallback(RequestReadyWithFile), state);
            }
            catch (Exception ex)
            {
                if (DownloadStringCompleted != null)
                {
                    FileSyncError error = new FileSyncError();
                    error.error_code = requestErrorDomain;
                    error.error_msg = "A Error Occurred While Creating HTTP Web Request. " + ex.Message;
                    //System.Windows.Deployment.Current.Dispatcher.BeginInvoke(delegate()
                    // {
                    if (DownloadStringCompleted != null)
                    {
                        DownloadStringCompleted(this, new FileSyncRequestResultEventArgs(request == null ? null : request.Address, FileSyncAPIRequestResult.Fail, error) { RequestParams = requestParams });
                    }
                    // });
                }
            }
        }
        /// <summary>
        /// 请求普通API接口
        /// </summary>
        /// <param name="requestUri">API请求的uri</param>
        /// <param name="httpMethod">API的请求方式</param>
        /// <param name="requestParams">API的请求参数</param>
        private void AsyncRequestAPI(string requestUri, string httpMethod, Dictionary<string, object> requestParams)
        {
            HttpWebRequest request = null;
            try
            {
                // POST
                if (httpMethod == "POST")
                {
                    requestUri = FileSyncUtility.AddParametersToURL(requestUri, requestParams);
                    FileSyncAPIRequestState state = new FileSyncAPIRequestState();
                    request = (HttpWebRequest)WebRequest.Create(requestUri);
                    request.Method = httpMethod;
                    request.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
                    //平台统计用
                    request.UserAgent = "FileSync Windows SDK " + FileSync.Config.SDKVersion + "(windows; " + Environment.OSVersion.Platform + ")";
                    state.request = request;
                    state.requestParams = requestParams;

                    request.BeginGetRequestStream(new AsyncCallback(RequestReady), state);
                }
                else if (httpMethod == "GET")
                {
                    requestUri = FileSyncUtility.AddParametersToURL(requestUri, requestParams);
                    request = (HttpWebRequest)WebRequest.Create(requestUri);
                    request.Method = httpMethod;

                    FileSyncAPIRequestState state = new FileSyncAPIRequestState();
                    state.request = request;
                    state.requestParams = requestParams;

                    request.BeginGetResponse(ResponseReady, state);
                }
            }
            catch
            {
                if (DownloadStringCompleted != null)
                {
                    FileSyncError error = new FileSyncError();
                    error.error_code = requestErrorDomain;
                    error.error_msg = "A Error Occurred While Creating HTTP Web Request.";
                    if (DownloadStringCompleted != null)
                    {
                        DownloadStringCompleted(this, new FileSyncRequestResultEventArgs(request == null ? null : request.Address, FileSyncAPIRequestResult.Fail, error));
                    }
                }
            }
        }