Esempio n. 1
0
        private void CollectCommandItems(MergeableNodeCollection <ICommandItem> nodes)
        {
            if (nodes == null || nodes.Count == 0)
            {
                return;
            }

            // Recursively get all nodes (excluding separators).
            foreach (var node in nodes)
            {
                if (node.Content is CommandSeparator)
                {
                    // Ignore
                }
                else if (node.Content is CommandGroup)
                {
                    // Ignore
                }
                else
                {
                    Debug.Assert(!CommandItems.Contains(node.Content), "Warning: Duplicate command items in toolbar.");
                    CommandItems.Add(node.Content);
                }

                CollectCommandItems(node.Children);
            }
        }