本文整理汇总了C#中MapControl.FindMapElementsAtOffset方法的典型用法代码示例。如果您正苦于以下问题:C# MapControl.FindMapElementsAtOffset方法的具体用法?C# MapControl.FindMapElementsAtOffset怎么用?C# MapControl.FindMapElementsAtOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapControl
的用法示例。
在下文中一共展示了MapControl.FindMapElementsAtOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMapTapped
private void OnMapTapped(MapControl sender, MapInputEventArgs args)
{
var icon = sender.FindMapElementsAtOffset(args.Position).OfType<MapIcon>().FirstOrDefault();
if (icon != null)
{
CafeSummaryViewModel cafe;
if (this.cafeMapIcons.TryGetValue(icon, out cafe))
{
this.ViewModel.SelectCafe.Execute(cafe);
}
}
}
示例2: MyMap_MapTapped
private async void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
{
List<BusStop> startStopList;
List<BusStop> endStopList;
var resultText = new StringBuilder();
resultText.AppendLine(string.Format("Position={0},{1}", args.Position.X, args.Position.Y));
resultText.AppendLine(string.Format("Location={0:F9},{1:F9}", args.Location.Position.Latitude, args.Location.Position.Longitude));
foreach (var mapObject in sender.FindMapElementsAtOffset(args.Position))
{
//resultText.AppendLine("Found: " + mapObject.ReadData<PointList>().Name);
}
//MessageDialogHelper.Show(resultText.Tostring(), "");
if (wayPoints1 == null)
{
wayPoints1 = new Geopoint(new BasicGeoposition { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude });
MessageDialogHelper.Show("Chọn điểm đến", "");
}
else if (wayPoints2 == null)
{
wayPoints2 = new Geopoint(new BasicGeoposition { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude });
try
{
startStopList = findNearbyBusStop(wayPoints1, MyConstants.RADIUS);
endStopList = findNearbyBusStop(wayPoints2, MyConstants.RADIUS);
List<List<BusNode>> foundAnswerList = new List<List<BusNode>>();
foreach (BusStop ss in startStopList)
{
foreach (BusStop es in endStopList)
{
// Begin Algorithm
AStarAlgo AS1 = new AStarAlgo(ss, es);
AS1.algorithm();
if (AS1.answer.Count() != 0)
{
// We found an answer
foundAnswerList.Add(AS1.answer);
}
}
}
foreach(List<BusNode> ans in foundAnswerList)
{
// print to map
/*
for (int i = 0; i < foundAnswer.Count(); i++)
{
findShortestRoute(SampleDataSource.FindBusStopByCode(foundAnswer[i].stopCode).geo,
SampleDataSource.FindBusStopByCode(foundAnswer[i + 1].stopCode).geo);
}
*/
// print to string
string detail = AStarResultToString(ans);
}
}
catch (Exception exc)
{
string msg = exc.Message;
}
wayPoints2 = null;
wayPoints1 = null;
}
}
示例3: MyMap_MapTapped
//MapTapped - not Map.Tapped!!
private async void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
{
var resultText = new StringBuilder();
resultText.AppendLine(string.Format("Position={0},{1}", args.Position.X, args.Position.Y));
resultText.AppendLine(string.Format("Location={0:F9},{1:F9}", args.Location.Position.Latitude, args.Location.Position.Longitude));
foreach( var mapObject in sender.FindMapElementsAtOffset(args.Position))
{
resultText.AppendLine("Found: " + mapObject.ReadData<PointList>().Name);
}
var dialog = new MessageDialog(resultText.ToString());
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => await dialog.ShowAsync());
}