Exemplo n.º 1
0
        private bool RecordPoint()
        {
            if (paused || routePoint >= secretRoute.Count)
            {
                return(false);
            }

            Position curPos = secretRoute[routePoint]; routePoint++;

            if (RoutePoints.Count > 0)
            {
                jDistance += PositionUtils.DistanceBetween(RoutePoints.Last(), curPos, Settings.UseMetric);
                TimeSpan ts = DateTime.Now - lastStart;
                jTime    += ts.TotalSeconds;
                lastStart = DateTime.Now;
            }

            RoutePoints.Add(curPos);
            JourneyDistance = string.Format("{0:0.00} ", jDistance) + (Settings.UseMetric ? "km" : "mi");
            JourneyTime     = TimeUtils.FormatSecMultiple(jTime);
            IsRecording     = routePoint < secretRoute.Count;


            return(IsRecording);
        }
Exemplo n.º 2
0
        private void OnRoutePointAdded(RoutePointAddedEvent obj)
        {
            RoutePoints.Add(obj.AddedRoutePoint);
            AircraftRouteViewModel route = Routes.FirstOrDefault(x => x.AircraftId == obj.AircraftId);

            if (route != null)
            {
                Routes.Remove(route);
            }

            Aircraft aircraft = Aircrafts.FirstOrDefault(x => x.Id == obj.AircraftId);

            if (aircraft != null)
            {
                route            = _routeService.GetRouteLine(aircraft);
                route.IsSelected = true;
                Routes.Add(route);
            }
        }