void Service_GetMapDataCompleted(StarMap result)
        {
            StarMap = result;
            StarMap.Initialize();

            MapCanvas.Children.Clear();

            // add bodies and orbits to canvas
            foreach (var star in StarMap.CelestialObjects.Where(o => o.CelestialObjectType == CelestialObjectType.Star))
            {
                var starIcon = new StarIcon(star, this);
                MapCanvas.Children.Add(starIcon);
                MapCanvas.Children.Add(new OrbitIcon(starIcon, this));
                ProcessSatellites(starIcon, StarMap.CelestialObjects);
            }

            MapIcons = MapCanvas.Children.OfType <IMapIcon>().Where(icon => icon.Body != null).ToDictionary(icon => icon.Body.CelestialObjectID);

            // add links to canvas
            foreach (var link in result.ObjectLinks)
            {
                var linkIcon = new LinkIcon(MapIcons[link.FirstObjectID].Body, MapIcons[link.SecondObjectID].Body, this);
                MapCanvas.Children.Add(linkIcon);
            }

            // add transits to canvas
            foreach (var transit in e.Result.Transits)
            {
                MapCanvas.Children.Add(new TransitIcon(transit, this));
            }

            PlanetTree.ItemsSource = e.Result.CelestialObjects.Where(body => body.OrbitNestingLevel == 0);
        }
        void Service_GetMapDataCompleted(object sender, GetMapDataCompletedEventArgs e)
        {
            StarMap = e.Result;
            StarMap.Initialize();

            MapCanvas.Children.Clear();

            // add bodies and orbits to canvas
            foreach (var star in StarMap.CelestialObjects.Where(o => o.CelestialObjectType == CelestialObjectType.Star)) {
                var starIcon = new StarIcon(star, this);
                MapCanvas.Children.Add(starIcon);
                MapCanvas.Children.Add(new OrbitIcon(starIcon, this));
                ProcessSatellites(starIcon, StarMap.CelestialObjects);
            }

            MapIcons = MapCanvas.Children.OfType<IMapIcon>().Where(icon => icon.Body != null).ToDictionary(icon => icon.Body.CelestialObjectID);

            // add links to canvas
            foreach (var link in e.Result.ObjectLinks) {
                var linkIcon = new LinkIcon(MapIcons[link.FirstObjectID].Body, MapIcons[link.SecondObjectID].Body, this);
                MapCanvas.Children.Add(linkIcon);
            }

            // add transits to canvas
            foreach (var transit in e.Result.Transits) {
                MapCanvas.Children.Add(new TransitIcon(transit, this));
            }

            PlanetTree.ItemsSource = e.Result.CelestialObjects.Where(body => body.OrbitNestingLevel == 0);
        }