예제 #1
0
        public void OnReply(Tweet tweet, string screenName)
        {
            if (tweet == null)
            {
                return;
            }
            if (tweet.IsDirectMessage)
            {
                Compose.ShowDirectMessage(tweet.ScreenName);
            }
            else
            {
                var matches = new Regex(@"(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9_]+)")
                              .Matches(tweet.Text);

                var names = matches
                            .Cast <Match>()
                            .Where(m => m.Groups[1].Value != tweet.ScreenName)
                            .Where(m => m.Groups[1].Value != screenName)
                            .Select(m => "@" + m.Groups[1].Value)
                            .Distinct();

                var replyTos = string.Join(" ", names);
                var message  = string.Format("@{0} {1}{2}", tweet.ScreenName, replyTos, (replyTos.Length > 0) ? " " : "");
                Compose.Show(message, tweet.StatusId);
            }
        }