private bool Unregister()
        {
            //Careful here - events have to be unregistered on the same
            //thread they were registered on...hence the use of the
            //Queued Task
            QueuedTask.Run(() =>
            {
                //One kvp per layer....of which there is only one in the sample
                //out of the box but you can add others and register for events
                foreach (var kvp in _rowevents)
                {
                    RowCreatedEvent.Unsubscribe(kvp.Value[0]);
                    RowChangedEvent.Unsubscribe(kvp.Value[1]);
                    RowDeletedEvent.Unsubscribe(kvp.Value[2]);
                    kvp.Value.Clear();
                }
                _rowevents.Clear();

                //Editing and Edit Completed.
                RowDeletedEvent.Unsubscribe(_editevents[0]);
                RowDeletedEvent.Unsubscribe(_editevents[1]);
                _editevents.Clear();
            });

            return(false);
        }
        private void onProjectClosed(ProjectEventArgs obj)
        {
            //Unsubscribe from events
            EditCompletedEvent.Unsubscribe(onEditCompleted);

            QueuedTask.Run(() =>
            {
                RowCreatedEvent.Unsubscribe(_rowCreateToken);
                RowDeletedEvent.Unsubscribe(_rowDeleteToken);
                RowChangedEvent.Unsubscribe(_rowChangedToken);
            });
        }
        public async Task DisposeAsync()
        {
            await QueuedTask.Run(() =>
            {
                if (_rowChanged != null)
                {
                    RowChangedEvent.Unsubscribe(_rowChanged);
                }

                if (_rowDeleted != null)
                {
                    RowDeletedEvent.Unsubscribe(_rowDeleted);
                }

                if (_rowCreated != null)
                {
                    RowCreatedEvent.Unsubscribe(_rowCreated);
                }
            });

            MapSelectionChangedEvent.Unsubscribe(OnMapSelectionChanged);
            DrawCompleteEvent.Unsubscribe(OnDrawCompleted);
        }