コード例 #1
0
ファイル: BMSClient.cs プロジェクト: BeePerNet/UMFDExtractor
        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);
        }
コード例 #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);
        }
コード例 #3
0
        private void OnDeleteSelectedItem(object obj)
        {
            WaypointList.Remove(SelectedWaypointItem);
            var availableWaipoints = new Waypoints();

            availableWaipoints.AddRange(WaypointList);
            Task.Run(() => _repository.SaveAsync(availableWaipoints));
            NotifyOfPropertyChange(() => WaypointList);
        }
コード例 #4
0
ファイル: ViewerForm.cs プロジェクト: planee/WaypointCreator
        public void AddWayPoints(List <ViewerWaypoint> waypoints)
        {
            Waypoints.AddRange(waypoints);

            UpdateViewer();
        }
コード例 #5
0
 private void OnDeleteSelectedItem(object obj)
 {
     WaypointList.Remove(SelectedWaypointItem);
     var availableWaipoints = new Waypoints();
     availableWaipoints.AddRange(WaypointList);
     Task.Run(() => _repository.SaveAsync(availableWaipoints));
     NotifyOfPropertyChange(() => WaypointList);
 }