Esempio n. 1
0
        private void ItemDeleted([NotNull] object sender, [NotNull] ItemUri itemUri)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(itemUri, nameof(itemUri));

            var contentModel = ContentModel;

            if (!contentModel.IsSingle)
            {
                return;
            }

            if (contentModel.FirstItem.Uri.ItemUri == itemUri)
            {
                Pane.Close();
            }
        }
Esempio n. 2
0
        protected override async void OnClick()
        {
            // get the map container
            var container = ProjectModule.CurrentProject.GetProjectItemContainer <MapContainer>("Map");

            if (container == null)
            {
                return;
            }

            // get the first item
            MapProjectItem item = container.GetProjectItems().FirstOrDefault();

            if (item == null)
            {
                return;
            }

            // fimd the map
            Map map = MappingModule.FindMap(item.Path);

            if (map == null)
            {
                return;
            }

            // close if already open
            IList <IMapPane> mapPanes = MappingModule.GetMapPanes(map);

            if ((mapPanes != null) && (mapPanes.Count > 0))
            {
                for (int idx = mapPanes.Count - 1; idx >= 0; idx--)
                {
                    Pane pane = mapPanes[idx] as Pane;
                    pane.Close();
                }
            }

            // remove it from project
            await(ProjectModule.CurrentProject as IInternalGISProjectItem).RemoveProjectItemAsync("Map", item.Path);
        }
Esempio n. 3
0
        protected override async void OnClick()
        {
            // find the first map item
            MapProjectItem item = ProjectModule.CurrentProject.GetMaps().FirstOrDefault();

            if (item == null)
            {
                return;
            }

            // alternate example - find the map item using Name
            //IEnumerable<MapProjectItem> maps = ProjectModule.CurrentProject.GetMaps();
            //item = ProjectModule.CurrentProject.GetMaps().FirstOrDefault(m => m.Name == "Layers");

            // fimd the map
            Map map = MappingModule.FindMap(item.Path);

            if (map == null)
            {
                return;
            }

            // close if already open
            IList <IMapPane> mapPanes = MappingModule.GetMapPanes(map);

            if ((mapPanes != null) && (mapPanes.Count > 0))
            {
                for (int idx = mapPanes.Count - 1; idx >= 0; idx--)
                {
                    Pane pane = mapPanes[idx] as Pane;
                    pane.Close();
                }
            }

            // remove it from project
            await(ProjectModule.CurrentProject as IInternalGISProjectItem).RemoveProjectItemAsync("Map", item.Path);
        }