示例#1
0
        private void OnDrawCompleted(MapViewEventArgs e)
        {
            IReadOnlyList <Layer> layers = e.MapView.Map.GetLayersAsFlattenedList();

            foreach (string name in _registry.GetNames())
            {
                // todo daro: need a more robust layer identifier
                // check first whether work list layer is in TOC
                FeatureLayer workListLayer = layers.OfType <FeatureLayer>()
                                             .FirstOrDefault(
                    layer => string.Equals(layer.Name, name));

                if (workListLayer == null)
                {
                    continue;
                }

                IWorkList workList = _registry.Get(name);
                Assert.NotNull(workList);

                // safety check, a new work list is already added
                if (_layerByWorkList.ContainsKey(workList))
                {
                    continue;
                }

                _layerByWorkList.Add(workList, workListLayer);

                WireEvents(workList);

                // todo daro: maybe we need a dictionary of synchronizers
                _synchronizer = new EditEventsRowCacheSynchronizer(workList);
            }
        }
示例#2
0
        // todo daro: move to OnMapViewInitialized?
        private void OnDrawCompleted(MapViewEventArgs e)
        {
            string uri = null;

            foreach (string name in _registry.GetNames()
                     .Where(name => _uriByWorklistName.TryGetValue(
                                name, out uri)))
            {
                // Can be null because it's from module settings and those cannot be deleted but only
                // set to null.
                if (string.IsNullOrEmpty(uri))
                {
                    continue;
                }

                var worklistLayer = e.MapView.Map.FindLayer(uri) as FeatureLayer;

                // todo daro Read the custom project settings and the URI of the created work list layers.
                //			 Don't do layer name comparison.
                //			 Stop giving the work list layer the name of the work list. The map (work list uri <> work list name)
                //			 is managed with the custom project settings.
                //			 For the moment the work list layers data source remains the work list file name. It feels the right way, e.g.
                //			 in ArcGIS the data source is broken too if its name changes.
                //LayerUtils.GetLayer("work list uri");

                if (worklistLayer == null)
                {
                    continue;
                }

                IWorkList workList = _registry.Get(name);
                Assert.NotNull(workList);

                // safety check, a new work list is already added
                if (_layersByWorklistName.ContainsKey(workList.Name))
                {
                    continue;
                }

                _layersByWorklistName.Add(workList.Name, worklistLayer);

                WireEvents(workList);

                // todo daro: maybe we need a dictionary of synchronizers
                _synchronizer = new EditEventsRowCacheSynchronizer(workList);
            }
        }