示例#1
0
        private void OnMessageReceived(MessageGpxFileRepositoryContentsChanged message)
        {
            if (message.RemovedNodes != null)
            {
                foreach (var actRemovedNode in message.RemovedNodes)
                {
                    foreach (var actTour in actRemovedNode.GetAssociatedToursDeep())
                    {
                        _loadedTours.Remove(actTour);
                    }
                }
            }

            if (message.AddedNodes != null)
            {
                foreach (var actAddedNode in message.AddedNodes)
                {
                    foreach (var actTour in actAddedNode.GetAssociatedToursDeep())
                    {
                        _loadedTours.Add(actTour);
                    }
                }
            }

            this.UpdateLayer_LoadedGpxFiles();
            this.UpdateLayer_Points();
            this.ResetCamera(_loadedTours);
        }
示例#2
0
        private void OnMessageReceived(MessageGpxFileRepositoryContentsChanged message)
        {
            this.Command_CloseAll.RaiseCanExecuteChanged();

            // Search parent nodes which should be updated
            var nodesToUpdate = new HashSet <GpxFileRepositoryNode>();

            if (message.AddedNodes != null)
            {
                foreach (var actAddedNode in message.AddedNodes)
                {
                    var actParent = (actAddedNode as GpxFileRepositoryNode)?.Parent;
                    while (actParent != null)
                    {
                        nodesToUpdate.Add(actParent);
                        actParent = actParent.Parent;
                    }
                }
            }
            if (message.RemovedNodes != null)
            {
                foreach (var actRemovedNode in message.RemovedNodes)
                {
                    var actParent = (actRemovedNode as GpxFileRepositoryNode)?.Parent;
                    while (actParent != null)
                    {
                        nodesToUpdate.Add(actParent);
                        actParent = actParent.Parent;
                    }
                }
            }

            // Stop here if there is nothing to update
            if (nodesToUpdate.Count == 0)
            {
                return;
            }

            // Update all viewmodels that may have changed
            foreach (var actTopLevelNode in this.TopLevelNodes)
            {
                TriggerNodeUIUpdate(actTopLevelNode, nodesToUpdate);
            }
        }