コード例 #1
0
        /// <summary>
        /// Take a message and create a reply message for it with the routing information
        ///             set up to correctly route a reply to the source message
        ///
        /// </summary>
        /// <param name="text">text you want to reply with</param><param name="locale">language of your reply</param>
        /// <returns>
        /// message set up to route back to the sender
        /// </returns>
        public Activity CreateReply(string text = null, string locale = null)
        {
            Activity activity = new Activity();

            activity.Type = "message";
            DateTime?nullable = new DateTime?(DateTime.UtcNow);

            activity.Timestamp = nullable;
            ChannelAccount channelAccount1 = new ChannelAccount(this.Recipient.Id, this.Recipient.Name);

            activity.From = channelAccount1;
            ChannelAccount channelAccount2 = new ChannelAccount(this.From.Id, this.From.Name);

            activity.Recipient = channelAccount2;
            string id = this.Id;

            activity.ReplyToId = id;
            string serviceUrl = this.ServiceUrl;

            activity.ServiceUrl = serviceUrl;
            string channelId = this.ChannelId;

            activity.ChannelId = channelId;
            ConversationAccount conversationAccount = new ConversationAccount(this.Conversation.IsGroup, this.Conversation.Id, this.Conversation.Name);

            activity.Conversation = conversationAccount;
            string str1 = text ?? string.Empty;

            activity.Text = str1;
            string str2 = locale ?? this.Locale;

            activity.Locale = str2;
            return(activity);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the ConversationReference class.
 ///
 /// </summary>
 public ConversationReference(string activityId = null, ChannelAccount user = null, ChannelAccount bot = null, ConversationAccount conversation = null, string channelId = null, string serviceUrl = null)
 {
     this.ActivityId   = activityId;
     this.User         = user;
     this.Bot          = bot;
     this.Conversation = conversation;
     this.ChannelId    = channelId;
     this.ServiceUrl   = serviceUrl;
 }
コード例 #3
0
        public Activity(string type = null, string id = null, DateTime?timestamp = null, DateTime?localTimestamp = null, string serviceUrl = null, string channelId = null, ChannelAccount from = null, ConversationAccount conversation = null, ChannelAccount recipient = null, string textFormat = null, string attachmentLayout = null, IList <ChannelAccount> membersAdded = null, IList <ChannelAccount> membersRemoved = null, string topicName = null, bool?historyDisclosed = null, string locale = null, string text = null, string speak = null, string inputHint = null, string summary = null, SuggestedActions suggestedActions = null, IList <Attachment> attachments = null, IList <Entity> entities = null, object channelData = null, string action = null, string replyToId = null, object value = null, string name = null, ConversationReference relatesTo = null, string code = null)
            : this()
        {
            this.Type      = type;
            this.Id        = id;
            this.Timestamp = timestamp;
            DateTime?nullable = localTimestamp;

            this.LocalTimestamp   = nullable.HasValue ? new DateTimeOffset?((DateTimeOffset)nullable.GetValueOrDefault()) : new DateTimeOffset?();
            this.ServiceUrl       = serviceUrl;
            this.ChannelId        = channelId;
            this.From             = from;
            this.Conversation     = conversation;
            this.Recipient        = recipient;
            this.TextFormat       = textFormat;
            this.AttachmentLayout = attachmentLayout;
            this.TopicName        = topicName;
            this.HistoryDisclosed = historyDisclosed;
            this.Locale           = locale;
            this.Text             = text;
            this.Speak            = speak;
            this.InputHint        = inputHint;
            this.Summary          = summary;
            this.SuggestedActions = suggestedActions;
            this.ChannelData      = channelData;
            this.Action           = action;
            this.ReplyToId        = replyToId;
            this.Value            = value;
            this.Name             = name;
            this.RelatesTo        = relatesTo;
            this.Code             = code;
            this.MembersAdded     = membersAdded ?? (IList <ChannelAccount>) new List <ChannelAccount>();
            this.MembersRemoved   = membersRemoved ?? (IList <ChannelAccount>) new List <ChannelAccount>();
            this.Attachments      = attachments ?? (IList <Attachment>) new List <Attachment>();
            this.Entities         = entities ?? (IList <Entity>) new List <Entity>();
        }