当前位置: 首页>>代码示例>>C#>>正文


C# TwitterService.SendDirectMessage方法代码示例

本文整理汇总了C#中TweetSharp.TwitterService.SendDirectMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.SendDirectMessage方法的具体用法?C# TwitterService.SendDirectMessage怎么用?C# TwitterService.SendDirectMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TweetSharp.TwitterService的用法示例。


在下文中一共展示了TwitterService.SendDirectMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TwitterSendDirectMessage

        public JsonResult TwitterSendDirectMessage()
        {
            bool result = false;

            string _consumerKey = System.Configuration.ConfigurationManager.AppSettings["consumerKeyLogin"];
            string _consumerSecret = System.Configuration.ConfigurationManager.AppSettings["consumerSecretLogin"];
            TwitterService service = new TwitterService(_consumerKey, _consumerSecret);

            service.AuthenticateWith(Session[Sessionvars.TwitterRequestToken].ToString(), Session[Sessionvars.TwitterRequestTokenSecert].ToString());
            string TwitterDirectMessage = Request.Params["TwitterDM"];

            string ListSelectUserDM = Convert.ToString(Request.Params["SelectedUserForDM"]);
            char[] splitchars = { ',' };
            string[] DirectMessageUserId = ListSelectUserDM.Split(splitchars, StringSplitOptions.RemoveEmptyEntries);
            if (DirectMessageUserId.Count() > 0)
            {
                foreach (var list in DirectMessageUserId)
                {
                    TwitterDirectMessage Ds = service.SendDirectMessage(Convert.ToInt32(list), TwitterDirectMessage);
                }
                result = true;
            }
            return Json(result, JsonRequestBehavior.AllowGet);
        }
开发者ID:emiprotech,项目名称:loginwithtwitter,代码行数:24,代码来源:HomeController.cs

示例2: Send

        public void Send(ChannelMessage message)
        {
            var service = new TwitterService(ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);

            foreach (var singleToName in message.To)
            {
                service.SendDirectMessage(Int32.Parse(singleToName.Address), message.BodyText.ReadString());
            }
        }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:9,代码来源:TwitterClientChannel.cs

示例3: TweetRequest

        public ActionResult TweetRequest(int[] Id)
        {
            if (OAuthWebSecurity.IsAuthenticatedWithOAuth)
            {
                ContextDb _db = new ContextDb();
                Models.Service service = _db.User.FirstOrDefault(c => c.UserId == WebSecurity.CurrentUserId).Services.FirstOrDefault(c => c.Provider == "twitter");
                if (service != null)
                {
                    TwitterService twitter = new TwitterService(Settings.Settings.TwitterConsumerKey, Settings.Settings.TwitterConsumerSecret, service.Token, service.TokenSecret);
                    foreach (var item in Id)
                    {
                        twitter.SendDirectMessage(item, "Join us at www.botf.azurewebsites.net");
                    }

                }
            }

            return RedirectToAction("Index");
        }
开发者ID:msanj1,项目名称:BOTF,代码行数:19,代码来源:HomeController.cs

示例4: SendTweet_Start

        public static void SendTweet_Start(string sMessage, int userID)
        {
            // alpascual
            // Pass your credentials to the service
            TwitterService service = new TwitterService("yASjbX9Zbu1OD0gk89qExA", "mTDH5xPm6Fu1KS3m1NUVTWKXBXi330TCakspt5Dz060");
            //OAuthAccessToken access = service.GetAccessTokenWithXAuth("alpascual", ""); // <-- user supplied username and password

            //// Step 1 - Retrieve an OAuth Request Token
            OAuthRequestToken requestToken = service.GetRequestToken();

            //// Step 2 - Redirect to the OAuth Authorization URL
            Uri uri = service.GetAuthorizationUri(requestToken);
            ////Process.Start(uri.ToString());
            //WebClient client = new WebClient();
            //string sResponse = client.DownloadString(uri);

            //// Step 3 - Exchange the Request Token for an Access Token
            string verifier = "3479615"; // <-- This is input into your application by your user
            OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

            // Step 4 - User authenticates using the Access Token
            service.AuthenticateWith(access.Token, access.TokenSecret);

            if (userID == 0)
            {
                TwitterStatus status = service.SendTweet(sMessage);
            }
            else
                service.SendDirectMessage(userID, sMessage);
        }
开发者ID:alpascual,项目名称:Unfollower,代码行数:30,代码来源:TwitterUtils.cs


注:本文中的TweetSharp.TwitterService.SendDirectMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。