/// <summary>
        /// 组参.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="type"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        private async Task <bool> ConfigParams(RestRequest request, SdkRequestType type, ISdkCmdBase data)
        {
            Action <string> errAction = (e1) =>
            {
                mSdkResponse.content = e1;
                mSdkResponse.errCode = SdkErrCode.XPARAM_ERR;
            };

            if (null == request)
            {
                errAction(Constants.SdkMsg.SDKInnerErr);
                return(false);
            }
            m_Client.BaseUrl = Constants.PublicApiUrl;
            if (SdkData.AccessToken != null)
            {
                request.AddParameter("access_token", SdkData.AccessToken);
            }
            else
            {
                errAction(Constants.SdkMsg.TokenNull);
                return(false);
            }

            switch (type)
            {
            case SdkRequestType.POST_MESSAGE:
            {
                CmdPostMessage message = null;
                if (data is CmdPostMessage)
                {
                    message = data as CmdPostMessage;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Method   = Method.POST;
                request.Resource = Constants.WeiboAPI.PostMsg;

                if (message.Status.Length > 0)
                {
                    request.AddParameter("status", message.Status);
                }
                if (message.ReplyId.Length > 0)
                {
                    request.AddParameter("in_reply_to_status_id", message.ReplyId);
                }
                if (message.Lat.Length > 0)
                {
                    request.AddParameter("lat", message.Lat);
                }
                if (message.Long.Length > 0)
                {
                    request.AddParameter("long", message.Long);
                }
                if (message.Annotations.Length > 0)
                {
                    request.AddParameter("annotations", message.Annotations);
                }
            }
            break;

            case SdkRequestType.POST_MESSAGE_PIC:
            {
                CmdPostMsgWithPic message = null;
                if (data is CmdPostMsgWithPic)
                {
                    message = data as CmdPostMsgWithPic;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Method   = Method.POST;
                request.Resource = Constants.WeiboAPI.PostMsgPic;

                request.AddParameter("status", message.Status);

                if (message.Lat.Length > 0)
                {
                    request.AddParameter("lat", message.Lat);
                }
                if (message.Long.Length > 0)
                {
                    request.AddParameter("long", message.Long);
                }

                if (0 == message.PicPath.Length)
                {
                    errAction(Constants.SdkMsg.PicPathEmpty);
                    return(false);
                }

                string picType = System.IO.Path.GetExtension(message.PicPath);
                string picName = System.IO.Path.GetFileName(message.PicPath);

//                        await request.AddFileAsync("pic", message.PicPath);
            }
            break;

            case SdkRequestType.FRIENDS_TIMELINE:
            {
                CmdTimelines message = null;
                if (data is CmdTimelines)
                {
                    message = data as CmdTimelines;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.FriendTimeline;
                request.Method   = Method.GET;
                if (message.SinceID.Length > 0)
                {
                    request.AddParameter("since_id", message.SinceID);
                }
                if (message.MaxID.Length > 0)
                {
                    request.AddParameter("max_id", message.MaxID);
                }
                if (message.Count.Length > 0)
                {
                    request.AddParameter("count", message.Count);
                }
                if (message.Page.Length > 0)
                {
                    request.AddParameter("page", message.Page);
                }
                if (message.BaseApp.Length > 0)
                {
                    request.AddParameter("base_app", message.BaseApp);
                }
                if (message.Feature.Length > 0)
                {
                    request.AddParameter("feature", message.Feature);
                }
            }
            break;

            case SdkRequestType.USER_TIMELINE:
            {
                CmdUserTimeline message = null;
                if (data is CmdUserTimeline)
                {
                    message = data as CmdUserTimeline;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.UserTimeline;
                request.Method   = Method.GET;

                if (message.UserId.Length > 0)
                {
                    request.AddParameter("user_id", message.UserId);
                }
                if (message.ScreenName.Length > 0)
                {
                    request.AddParameter("screen_name", message.ScreenName);
                }
                if (message.SinceID.Length > 0)
                {
                    request.AddParameter("since_id", message.SinceID);
                }
                if (message.MaxID.Length > 0)
                {
                    request.AddParameter("max_id", message.MaxID);
                }
                if (message.Count.Length > 0)
                {
                    request.AddParameter("count", message.Count);
                }

                if (message.Page.Length > 0)
                {
                    request.AddParameter("page", message.Page);
                }
                if (message.BaseApp.Length > 0)
                {
                    request.AddParameter("base_app", message.BaseApp);
                }
                if (message.Feature.Length > 0)
                {
                    request.AddParameter("feature", message.Feature);
                }
            }
            break;

            case SdkRequestType.FRIENDSHIP_CREATE:
            {
                CmdFriendShip message = null;
                if (data is CmdFriendShip)
                {
                    message = data as CmdFriendShip;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.CreateFriendShip;
                request.Method   = Method.POST;

                if (message.UserId.Length > 0)
                {
                    request.AddParameter("user_id", message.UserId);
                }
                if (message.ScreenName.Length > 0)
                {
                    request.AddParameter("screen_name", message.ScreenName);
                }
            }
            break;

            case SdkRequestType.FRIENDSHIP_DESDROY:
            {
                CmdFriendShip message = null;
                if (data is CmdFriendShip)
                {
                    message = data as CmdFriendShip;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.DestroyFriendShip;
                request.Method   = Method.POST;

                if (message.UserId.Length > 0)
                {
                    request.AddParameter("user_id", message.UserId);
                }
                if (message.ScreenName.Length > 0)
                {
                    request.AddParameter("screen_name", message.ScreenName);
                }
            }
            break;

            case SdkRequestType.FRIENDSHIP_SHOW:
            {
                CmdFriendShip message = null;
                if (data is CmdFriendShip)
                {
                    message = data as CmdFriendShip;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.ShowFriendShip;
                request.Method   = Method.GET;

                if (message.SourceId.Length > 0)
                {
                    request.AddParameter("source_id", message.SourceId);
                }
                if (message.SourceScreenName.Length > 0)
                {
                    request.AddParameter("source_screen_name", message.SourceScreenName);
                }

                if (message.UserId.Length > 0)
                {
                    request.AddParameter("target_id", message.UserId);
                }
                if (message.ScreenName.Length > 0)
                {
                    request.AddParameter("target_screen_name", message.ScreenName);
                }
            }
            break;

            case SdkRequestType.AT_USERS:
            {
                CmdAtUsers atUsers = null;
                if (data is CmdAtUsers)
                {
                    atUsers = data as CmdAtUsers;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.AtUser;
                request.Method   = Method.GET;
                if (atUsers.Keyword.Length > 0)
                {
                    request.AddParameter("q", atUsers.Keyword);
                }
                if (atUsers.Count.Length > 0)
                {
                    request.AddParameter("count", atUsers.Count);
                }
                if (atUsers.Range.Length > 0)
                {
                    request.AddParameter("range", atUsers.Range);
                }
                if (atUsers.Type.Length > 0)
                {
                    request.AddParameter("type", atUsers.Type);
                }
            }
            break;

            case SdkRequestType.SHORTEN_URL:
            {
                CmdShortenUrl shortUrl = null;
                if (data is CmdShortenUrl)
                {
                    shortUrl = data as CmdShortenUrl;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                request.Resource = Constants.WeiboAPI.ShortenUrl;
                request.Method   = Method.GET;
                if (shortUrl.OriginalUrl.Length > 0)
                {
                    request.AddParameter("url_long", shortUrl.OriginalUrl);
                }
            }
            break;

            case SdkRequestType.OTHER_API:
            {
                ICustomCmdBase customData = null;
                if (data is ICustomCmdBase)
                {
                    customData = data as ICustomCmdBase;
                }
                else
                {
                    errAction(Constants.SdkMsg.ParamTypeErr);
                    return(false);
                }
                customData.ConvertToRequestParam(request);
            }
            break;

            default:
            {
                errAction(Constants.SdkMsg.RequestNotSupppt);
                return(false);
            }
            }
            request.AddParameter("curtime", DateTime.Now.Ticks.ToString());
            return(true);
        }
        private async void ShareWeiBo()
        {

            Autho();
            await Task.Delay(1000);
            try
             {                
                SdkResponse result = null;
                var engine = new SdkNetEngine();
                //如果没有图片,则发送文字消息
                if (!string.IsNullOrWhiteSpace(info[1]))
                {
                    //微博分享图文消息,图片URI必须在本地,所以只能先下载
                    List<byte> arrayByte = new List<byte>();
                 
                    var photoStorageFile = await KnownFolders.PicturesLibrary.CreateFileAsync("scan.jpg", CreationCollisionOption.ReplaceExisting);
                    //开始异步下载图片
                    HttpClient client = new HttpClient();
                    Stream stream = await client.GetStreamAsync(info[1]);
                    byte[] buffer = new byte[1000];
                    int read = 0;
                    while ((read = stream.Read(buffer, 0, 1000)) > 0)
                    {
                        arrayByte.AddRange(buffer);
                    }
                    await FileIO.WriteBytesAsync(photoStorageFile, arrayByte.ToArray());
                    var status = await CachedFileManager.CompleteUpdatesAsync(photoStorageFile);

                    client.Dispose();
                    stream.Dispose();

                    if (status == Windows.Storage.Provider.FileUpdateStatus.Complete)
                    {
                        ISdkCmdBase cmdBase = new WeiboSDKForWinRT.CmdPostMsgWithPic()
                        {
                            Status =info[0],
                            PicPath = photoStorageFile.Path
                        };
                        result = await engine.RequestCmd(SdkRequestType.POST_MESSAGE_PIC, cmdBase);
                        
                        await photoStorageFile.DeleteAsync(StorageDeleteOption.PermanentDelete);
                    }
                }
                else
                {
                    ISdkCmdBase cmdBase = new WeiboSDKForWinRT.CmdPostMessage()
                    {
                        Status = info[0]                    
                    };
                    result = await engine.RequestCmd(SdkRequestType.POST_MESSAGE, cmdBase);
                }

                if (result.errCode == SdkErrCode.SUCCESS)
                {
                    TB_Prompt.Text = "分享成功";
                    PromptStoryboard.Begin();
                }
                else if (result.errCode == SdkErrCode.NET_UNUSUAL)
                {
                    TB_Prompt.Text = "网络不可用";
                    PromptStoryboard.Begin();
                }
                else if (result.errCode == SdkErrCode.SERVER_ERR)
                {
                    TB_Prompt.Text = "服务器异常";
                    PromptStoryboard.Begin();
                }
                else if (result.errCode == SdkErrCode.TIMEOUT)
                {
                    TB_Prompt.Text = "发送超时";
                    PromptStoryboard.Begin();
                }
                else
                {
                    TB_Prompt.Text = "分享失败";
                    PromptStoryboard.Begin();
                }
            }
            catch(Exception ex)
            {
                TB_Prompt.Text = "分享失败";
                PromptStoryboard.Begin();
            }


        }
        private async Task<string> Postmsgpic(string content, BitmapImage contentPic)
        {
            var engine = new SdkNetEngine();
            ISdkCmdBase cmdBase = new CmdPostMsgWithPic()
            {
                Status = content,
                PicPath = SendPicPath

            };
            var result = await engine.RequestCmd(SdkRequestType.POST_MESSAGE_PIC, cmdBase);
            if (result.errCode == SdkErrCode.SUCCESS)
            {
                return result.content;

            }
            else
            {
                return string.Empty;
            }
        }