Beispiel #1
0
        private void SetupQueueNodes(IEnumerable <Queue> queues)
        {
            if (MachineRoot == null)
            {
                return;
            }

            foreach (var queue in queues)
            {
                if (queue == null)
                {
                    continue;
                }

                QueueExplorerItem queueToAdd = null;
                var parentTreeNode           = MachineRoot;
                var systemQueue = GetMatchesSystemQueuesName(queue);

                if (systemQueue != null)
                {
                    var parentName = queue.Address.Queue.Replace(systemQueue, string.Empty);
                    var parentNode = MachineRoot.Children.FirstOrDefault(q => q.Name != null && q.Name == parentName);

                    if (parentNode != null)
                    {
                        parentTreeNode = parentNode;
                        queueToAdd     = new QueueExplorerItem(queue, systemQueue.Remove(0, 1));
                    }
                }

                if (queueToAdd == null)
                {
                    queueToAdd = new QueueExplorerItem(queue);
                }

                parentTreeNode.Children.Add(queueToAdd);
            }
        }
        public void should_track_selected_explorer()
        {
            var selected = new QueueExplorerItem(new Queue("Error"));

            shell.Handle(new SelectedExplorerItemChanged(selected));

            shell.SelectedExplorerItem.ShouldNotBe(null);
            shell.SelectedExplorerItem.ShouldBeSameAs(selected);
        }
        private void SetupQueueNodes(IEnumerable<Queue> queues)
        {
            if (MachineRoot == null)
                return;

            foreach (var queue in queues)
            {
                if (queue == null)
                    continue;

                QueueExplorerItem queueToAdd = null;
                var parentTreeNode = MachineRoot;
                var systemQueue = GetMatchesSystemQueuesName(queue);

                if (systemQueue != null)
                {
                    var parentName = queue.Address.Queue.Replace(systemQueue, string.Empty);
                    var parentNode = MachineRoot.Children.FirstOrDefault(q => q.Name != null && q.Name == parentName);

                    if (parentNode != null)
                    {
                        parentTreeNode = parentNode;
                        queueToAdd = new QueueExplorerItem(queue, systemQueue.Remove(0, 1));
                    }
                }

                if (queueToAdd == null)
                {
                    queueToAdd = new QueueExplorerItem(queue);
                }

                parentTreeNode.Children.Add(queueToAdd);
            }
        }