Example #1
0
        public void FuncCheckMissions(double lat, double lon)
        {
            if (RequestTimerStop != null)
            {
                RequestTimerStop(this, EventArgs.Empty);
            }
            // Check for missions
            Nme2Ws.Nme2Ws ws = new Nme2Ws.Nme2Ws();
            _remoteMissions = ws.MissionServiceGetMissionsWithin(lat, lon);

            foreach (Mission mission in _remoteMissions)
            {
                bool exists = false;
                foreach (Mission local in _localMissions.Where(local => local.Id == mission.Id))
                {
                    exists = true;
                }
                if (exists)
                {
                    string locVersion = _localMissions.First(m => mission.Id == m.Id).Version;
                    string remVersion = mission.Version;
                    if (locVersion != remVersion)
                    {
                        FuncRemoveMissionFromFs(mission);
                        //FuncBuildMission(mission.Id.ToString());
                        FuncShowObjects(new[]{mission});
                    }
                }
                else
                {
                    //FuncBuildMission(mission.Id.ToString());
                    FuncShowObjects(new[] { mission });
                }
            }

            // Suche Missionen die nicht mehr Remote vorhanden sind und daher local gelöscht werden können.

            IList<Mission> deleteMissions = (from mission in _localMissions
                                             let found = _remoteMissions.Any(remMission => remMission.Id == mission.Id)
                                             where !found
                                             select mission).ToList();

            foreach (Mission toDelete in deleteMissions)
            {
                FuncRemoveMissionFromFs(toDelete);
            }
            deleteMissions.Clear();

            _localMissions = _remoteMissions.ToList();

            if (RequestTimerStart != null)
            {
                RequestTimerStart(this, EventArgs.Empty);
            }
        }
Example #2
0
        public void FuncCheckMissions(double lat, double lon)
        {
            if (RequestTimerStop != null)
            {
                RequestTimerStop(this, EventArgs.Empty);
            }
            // Check for missions
            Nme2Ws.Nme2Ws ws = new Nme2Ws.Nme2Ws();
            _remoteMissions = ws.MissionServiceGetMissionsWithin(lat, lon);

            foreach (Mission mission in _remoteMissions)
            {
                bool exists = false;
                foreach (Mission local in _localMissions.Where(local => local.Id == mission.Id))
                {
                    exists = true;
                }
                if (exists)
                {
                    string locVersion = _localMissions.First(m => mission.Id == m.Id).Version;
                    string remVersion = mission.Version;
                    if (locVersion != remVersion)
                    {
                        FuncRemoveMissionFromFs(mission);
                        //FuncBuildMission(mission.Id.ToString());
                        FuncShowObjects(new[] { mission });
                    }
                }
                else
                {
                    //FuncBuildMission(mission.Id.ToString());
                    FuncShowObjects(new[] { mission });
                }
            }

            // Suche Missionen die nicht mehr Remote vorhanden sind und daher local gelöscht werden können.

            IList <Mission> deleteMissions = (from mission in _localMissions
                                              let found = _remoteMissions.Any(remMission => remMission.Id == mission.Id)
                                                          where !found
                                                          select mission).ToList();

            foreach (Mission toDelete in deleteMissions)
            {
                FuncRemoveMissionFromFs(toDelete);
            }
            deleteMissions.Clear();

            _localMissions = _remoteMissions.ToList();

            if (RequestTimerStart != null)
            {
                RequestTimerStart(this, EventArgs.Empty);
            }
        }