Exemple #1
0
 /// <summary>
 /// 发布一条新微博
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="channelUrl"></param>
 /// <param name="message"></param>
 protected override void SocialSharePublish(string channelName, 
     string channelUrl, string message, SocialBase.SocialShareHandler callBack)
 {
     var social = SocialViewModel.Instance.DataInfos[SocialType.TENCENT];
     OAuthConfigruation.AccessToken = new AccessToken(social.AcessToken);
     var share = new TService();
     var arg = new ServiceArgument()
     {
         Content = message,
         Url = channelUrl
     };
     try
     {
         share.AddVideo(arg, obj =>
         {
             if (obj.Succeed)
                 callBack(true, string.Empty);
             else
                 callBack(false, obj.InnerException.Message);
         });
     }
     catch (Exception ex)
     {
         callBack(false, ex.Message);
     }
 }
Exemple #2
0
        /// <summary>
        /// 新浪微博发布一条新微博
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="channelUrl"></param>
        /// <param name="message"></param>
        protected override void SocialSharePublish(string channelName, 
            string channelUrl, string message, SocialBase.SocialShareHandler callBack)
        {
            try
            {
                var social = SocialViewModel.Instance.DataInfos[SocialType.SINA];
                var netEngine = new SdkNetEngine();
                var cmdBase = new cmdUploadMessage
                {
                    status = message,
                    acessToken = social.AcessToken,
                    acessTokenSecret = social.RefreshToken
                };

                netEngine.RequestCmd(SdkRequestType.UPLOAD_MESSAGE, cmdBase, (type, response) =>
                {
                    if (response.errCode == SdkErrCode.SUCCESS)
                    {
                        callBack(true, response.content);
                    }
                    else
                    {
                        callBack(false, response.content);
                    }
                });
            }
            catch(Exception ex)
            {
                callBack(false, ex.Message);
            }
        }
Exemple #3
0
 /// <summary>
 /// 人人网发布
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="channelUrl"></param>
 /// <param name="message"></param>
 protected override void SocialSharePublish(string channelName, 
     string channelUrl, string message, SocialBase.SocialShareHandler callBack)
 {
     JudgeToken(SocialViewModel.Instance.DataInfos[SocialType.RENREN]);
     var renren = new RenrenApiClient();
     try
     {
         renren.CallPublishShare(channelName, channelUrl, message, responseData =>
         {
             var responseMsg = string.Empty;
             try
             {
                 JObject.Parse(responseData);
                 callBack(true, responseData);
             }
             catch
             {
                 callBack(false, responseData);
             }
         });
     }
     catch (Exception ex)
     {
         callBack(false, ex.Message);
     }
 }
Exemple #4
0
 public SocialEventArgs(SocialType socialType, SocialBase socialData)
 {
     SocialType = socialType;
     SocialData = socialData;
 }