Example #1
0
        /// <summary>
        /// Reply the location user send.
        /// </summary>
        private async Task HandleLocationAsync(string replyToken, LocationEventMessage location, string userId)
        {
            dl.Activity sendMessage = new dl.Activity()
            {
                Type     = "message",
                Text     = location.Title,
                From     = new dl.ChannelAccount(userId, userId),
                Entities = new List <Entity>()
                {
                    new Entity()
                    {
                        Type       = "Place",
                        Properties = JObject.FromObject(new Place(address: location.Address,
                                                                  geo: new dl.GeoCoordinates(
                                                                      latitude: (double)location.Latitude,
                                                                      longitude: (double)location.Longitude,
                                                                      name: location.Title),
                                                                  name: location.Title))
                    }
                }
            };

            // Send the message, then fetch and reply messages,
            await dlClient.Conversations.PostActivityAsync(conversationId, sendMessage);

            await GetAndReplyMessages(replyToken, userId);
        }
 /// <summary>
 /// Reply the location user send.
 /// </summary>
 private async Task HandleLocationAsync(string replyToken, LocationEventMessage location)
 {
     await messagingClient.ReplyMessageAsync(replyToken, new[]
     {
         new LocationMessage("Location", location.Address, location.Latitude, location.Longitude)
     });
 }
Example #3
0
        private async Task SaveLocationAsync(MessageEvent ev, LocationEventMessage locMessage)
        {
            await SourceLocation.UpdateAsync(
                new EventSourceLocation()
            {
                SourceType = ev.Source.Type.ToString(),
                SourceId   = ev.Source.Id,
                Location   = $"{locMessage.Latitude},{locMessage.Longitude}"
            });

            await MessagingClient.ReplyMessageAsync(ev.ReplyToken, "Enter a search word for google map search.");
        }
Example #4
0
        private async Task HandleLocationAsync(string replyToken, LocationEventMessage location, string userId)
        {
            // Get an order
            var review = await reviewState.FindAsync("review", userId);

            // Save the address first
            review.Name = location.Address;
            review.Text = location.Title;
            await reviewState.UpdateAsync(review);

            await messagingClient.ReplyMessageAsync(replyToken, new[] {
                new TextMessage($"Thanks! We will add {review.Name}'s review and rating of {review.Rating} and {review.Text}!!")
            });
        }
        /// <summary>
        /// Reply the location user send.
        /// </summary>
        private IMessageActivity HandleLocation(LocationEventMessage location, string userId)
        {
            var activity = GetActivityBase(userId);
            var entity   = new Entity()
            {
                Type       = "Place",
                Properties = JObject.FromObject(new Place(address: location.Address,
                                                          geo: new GeoCoordinates(
                                                              latitude: (double)location.Latitude,
                                                              longitude: (double)location.Longitude,
                                                              name: location.Title),
                                                          name: location.Title))
            };

            activity.Text     = location.Title;
            activity.Entities = new List <Entity>()
            {
                entity
            };

            return(activity);
        }
 protected virtual Task <IResponseMessage> HandleLocationEvent(LocationEventMessage request)
 {
     return(DefaultResponse());
 }