wp7如何使用我的当前位置通过电子邮件发送谷歌或bing超链接

时间:2012-04-05 11:23:30

标签: windows-phone-7 google-maps hyperlink location bing-maps

我只想用超链接发送(发送)我当前的位置(当你点击它时,它会打开google或bing地图的位置)而不是文字。

3 个答案:

答案 0 :(得分:0)

截至目前,EMailComposeTask发送的电子邮件中不支持HTML数据。
您可以参考this discussion

答案 1 :(得分:0)

简单:使用EmailComposeTask,在文本中只设置maps:11.111,22.222,其中11.111是纬度,22.222是经度。

Windows Phone电子邮件客户端会看到“maps:”文本并自动将其转换为使用Bing地图应用打开的链接!

答案 2 :(得分:0)

您可以尝试以下方法:

private void StartLocationButton_Click(object sender, RoutedEventArgs e)
{
    // The watcher variable should be scoped to the class
    if (watcher == null)  
    {
        watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); 
        watcher.MovementThreshold = 20; 
        watcher.StatusChanged += new 
                       EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);  
    }
    watcher.Start();
}


void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
{
    Dispatcher.BeginInvoke(() => MyStatusChanged(e)); //Call BeginInvoke as discussed below…
}


void MyStatusChanged(GeoPositionStatusChangedEventArgs e)
{
    if (e.Status == GeoPositionStatus.Ready)
    {
        var link = String.Format("http://www.google.com/maps?q={0}+{1}", 
            e.Position.Location.Latitude.ToString("0.000000"), 
            e.Position.Location.Longitude.ToString("0.000000"));

        EmailComposeTask emailComposeTask = new EmailComposeTask();
        emailComposeTask.To = "send@mail.com";

        emailComposeTask.Body = link;

        emailComposeTask.Subject = "GPS";
        emailComposeTask.Show();

        //Stop the Location Service to conserve battery power.
        watcher.Stop();
    }
}