예제 #1
0
 public async Task SetupInit()
 {
     if (!await LetLocationStart())
     {
         MessengerService.Toast(this, "Unable to get current location", true);
     }
     MapDrawer.MoveCameraZoom(CurrentLocation, 8);
     try
     {
         var path = DatabaseService.GetInstance().GetClosestRiver();
         if (path.Points != null)
         {
             MapDrawer.DrawLine(path.Points.ToArray());
             var launchSites = from p in DatabaseService.GetInstance().Points where p.RiverId == DatabaseService.GetInstance().ClosestRiverId&& p.IsLaunchSite select p;
             foreach (var site in launchSites)
             {
                 MapDrawer.DrawMarker(site);
             }
         }
         else
         {
             MessengerService.Toast(this, "Failed to get nearest river", true);
         }
     }
     catch (Exception)
     {
         MessengerService.Toast(this, "Failed to get nearest river", true);
     }
 }
예제 #2
0
 public void SetupTripStart()
 {
     if (StartPoint.Id == int.MaxValue || EndPoint.Id == int.MaxValue)
     {
         MessengerService.Toast(this, "Start or end value not valid", true);
     }
     else
     {
         StartPoint = DatabaseService.GetInstance().GetPoint(StartPoint.Id);
         EndPoint   = DatabaseService.GetInstance().GetPoint(EndPoint.Id);
         var current = LocationService.GetInstance().CurrentLocation;
         MapDrawer.DrawMarker(StartPoint);
         MapDrawer.DrawMarker(EndPoint);
         MapDrawer.MoveCamera(current);
         MapDrawer.AnimateCameraBounds(new[] { StartPoint, EndPoint, current });
         MapDrawer.DrawLine(StartPoint, EndPoint);
     }
 }