Exemple #1
0
        void Load(FlightData data)
        {
            loaded = true;
            //Load waypoints

            List <Waypoint> waypoints = new List <Waypoint>();

            foreach (var val in data.StringData.data.Where(x => x.strId == 0x21))
            {
                //NP:1,WP,7.7571525E5,1.307072E6,-1E1,-1E1;
                string[] values = val.value.Split(',');
                if (values.Length > 3)
                {
                    waypoints.Add(new Waypoint(WaypointType.Waypoint, values[0].Substring(3),
                                               double.Parse(values[2], CultureInfo.InvariantCulture),
                                               double.Parse(values[3], CultureInfo.InvariantCulture),
                                               double.Parse(values[4], CultureInfo.InvariantCulture)
                                               ));
                }
            }

            Observable.Start(() =>
            {
                Waypoints.Clear();
                if (waypoints.Count > 0)
                {
                    Waypoints.AddRange(waypoints);
                }
            }, RxApp.MainThreadScheduler);
        }
Exemple #2
0
        public void Load()
        {
            Observable.Start(() =>
            {
                try
                {
                    Status = "Loading";

                    IEnumerable <Waypoint> fixes = null;
                    IEnumerable <Waypoint> navs  = null;

                    Task <IEnumerable <Waypoint> > fixresult = Task.Run(() => fixes = LoadFixes());
                    Task <IEnumerable <Waypoint> > navresult = Task.Run(() => navs = LoadNavs());

                    Task.WaitAll(fixresult, navresult);

                    Observable.Start(() =>
                    {
                        Waypoints.Clear();
                        Waypoints.AddRange(navs);
                        Waypoints.AddRange(fixes);
                    }, RxApp.MainThreadScheduler);

                    Status = "Loaded";
                }
                catch (Exception ex)
                {
                    Status = ex.Message;
                }
            }, RxApp.TaskpoolScheduler);
        }
Exemple #3
0
        private void OnDeleteSelectedItem(object obj)
        {
            WaypointList.Remove(SelectedWaypointItem);
            var availableWaipoints = new Waypoints();

            availableWaipoints.AddRange(WaypointList);
            Task.Run(() => _repository.SaveAsync(availableWaipoints));
            NotifyOfPropertyChange(() => WaypointList);
        }
Exemple #4
0
        public void AddWayPoints(List <ViewerWaypoint> waypoints)
        {
            Waypoints.AddRange(waypoints);

            UpdateViewer();
        }
 private void OnDeleteSelectedItem(object obj)
 {
     WaypointList.Remove(SelectedWaypointItem);
     var availableWaipoints = new Waypoints();
     availableWaipoints.AddRange(WaypointList);
     Task.Run(() => _repository.SaveAsync(availableWaipoints));
     NotifyOfPropertyChange(() => WaypointList);
 }