1

我有位置数据可以使用 .Net 推送用户时间线。我创建 Location Item 并将其分配给 TimeLine Item 中的 Location 字段,如下面的代码。但它没有在时间轴卡片中显示任何位置图或数据。但它显示了导航。我需要在卡片上显示位置图像。

MirrorService Service = new MirrorService(new BaseClientService.Initializer()
                                                          {
                                                              Authenticator = Utils.GetAuthenticatorFromState(state)
                                                          });
                TimelineItem timelineItem = new TimelineItem();
                timelineItem.Creator = new Contact()
                                           {
                                               Id = "MEETUP_LOC",
                                               DisplayName = "Meetup Updates",
                                           };



                Location location = new Location() {};
                location.Address = "Voice Lounge, Colombo";
                location.Latitude = 6.887035;
                location.Longitude = 79.866193;

                timelineItem.Location = location;
                timelineItem.Notification = new NotificationConfig() {Level = "DEFAULT"};
                timelineItem.MenuItems = new List<MenuItem>()
                                             {
                                                 new MenuItem() {Action = "NAVIGATE"},
                                                 new MenuItem() {Action = "DELETE"},
                                                 new MenuItem() {Action = "SHARE"},
                                             };

                Service.Timeline.Insert(timelineItem).Fetch();

我如何使用地图图像发送位置数据。我应该使用 HTML 吗?

4

1 回答 1

1

我想出了附加位置信息的方法。我们可以使用 html 内容将位置数据显示为图像,如下面的代码。

TimelineItem timelineItem = new TimelineItem();
                timelineItem.Creator = new Contact()
                                           {
                                               Id = "MEETUP_LOC",
                                               DisplayName = "Meetup Updates",
                                           };



                Location location = new Location() {};
                location.DisplayName = "Voice Lounge";
                location.Address = "Voice Lounge, Colombo";
                location.Latitude = 6.887035;
                location.Longitude = 79.866193;


                timelineItem.Html="<article>" +
                                  "<figure>" +
                                  "<img src=\"glass://map?w=240&h=360&marker=0;" +
                                   location.Latitude +
                                  "," +
                                   location.Longitude +
                                   "\"height=\"360\" width=\"240\">" +
                                  "</figure>" +
                                  "<section>" +
                                  "<div class=\"text-auto-size\"><p class=\"yellow\">" +
                                    location.DisplayName +
                                  "</p><p>" +
                                    location.Address +
                                  "</p>" +
                                  "</div>" +
                                  "</section>" +
                                  "</article>";
                timelineItem.Location = location;
                timelineItem.Notification = new NotificationConfig() {Level = "DEFAULT"};
                timelineItem.MenuItems = new List<MenuItem>()
                                             {
                                                 new MenuItem() {Action = "NAVIGATE"},
                                                 new MenuItem() {Action = "DELETE"},
                                                 new MenuItem() {Action = "SHARE"},
                                             };

                Service.Timeline.Insert(timelineItem).Fetch();
于 2013-10-04T09:51:29.433 回答