/// <summary>
        /// Loads the bookmarks in the project
        /// </summary>
        /// <returns></returns>
        public async Task LoadBookmarks()
        {
            if (!_initialized)
            {
                //register for project events
                ArcGISProjectOpenedEvents.Unsubscribe(OnProjectOpened);
                ArcGISProjectCreatedEvents.Unsubscribe(OnProjectOpened);
                ArcGISProjectClosedEvents.Unsubscribe(OnProjectClosed);
                _initialized = true;
            }
            IList <Bookmark> bmks = await ProjectModule.CurrentProject.LoadBookmarksAsync();

            if (bmks.Count() == 0)
            {
                bmks = await LoadBookmarksFromMapxAsync();
            }
            lock (_lockObject)
            {
                _listBookmark = new ObservableCollection <BookmarkItem>();
                foreach (var bmk in bmks)
                {
                    _listBookmark.Add(new BookmarkItem(bmk));
                }
            }
            this.NotifyPropertyChanged(new PropertyChangedEventArgs("Cities"));
            this.NotifyPropertyChanged(new PropertyChangedEventArgs("HasBookmarksLoaded"));
        }
Esempio n. 2
0
        /// <summary>
        /// override to implement custom un-initialisation code for when this dockpane closes.
        /// </summary>
        /// <returns></returns>
        protected override Task UninitializeAsync()
        {
            // unsubscribe from all events
            // Step 2 - unsubscribe
            ArcGISProjectItemsChangedEvents.Unsubscribe(OnProjectCollectionChanged);
            ArcGISProjectClosedEvents.Unsubscribe(OnProjectClosed);

            return(base.UninitializeAsync());
        }
Esempio n. 3
0
        /// <summary>
        /// Override to implement custom initialisation code for this dockpane
        /// </summary>
        /// <returns></returns>
        protected override Task InitializeAsync()
        {
            // Step 2 - subscribe to the ProjectItem changed event
            ArcGISProjectItemsChangedEvents.Subscribe(OnProjectCollectionChanged);
            // project closed event
            ArcGISProjectClosedEvents.Unsubscribe(OnProjectClosed);

            return(base.InitializeAsync());
        }
        ///<summary>
        /// Performs initialization when dock pane is opened.
        ///</summary>
        protected async Task Initialize()
        {
            await base.InitializeAsync();

            ArcGISProjectOpenedEvents.Subscribe(OnProjectOpened);
            ArcGISProjectCreatedEvents.Subscribe(OnProjectOpened);
            ArcGISProjectClosedEvents.Subscribe(OnProjectClosed);
            OnProjectOpened(null);
            _initialized = true;
        }