private TreeViewItem GetLeaf([NotNull] ValidationIssue issue, [NotNull] string text, [CanBeNull] Icon icon)
        {
            Debug.ArgumentNotNull(issue, nameof(issue));
            Debug.ArgumentNotNull(text, nameof(text));

            var header = new LeafHeader
            {
                Text = text
            };

            header.DoubleClick += delegate
            {
                var itemVersionUri = new ItemVersionUri(issue.ItemUri, LanguageManager.CurrentLanguage, Data.Version.Latest);

                AppHost.OpenContentEditor(itemVersionUri);
            };

            if (icon != null)
            {
                header.Icon = icon;
            }

            var result = new TreeViewItem
            {
                Header = header,
                Tag    = issue
            };

            return(result);
        }
        private void RenderIssue([NotNull] string group, [NotNull] ValidationIssue issue)
        {
            Debug.ArgumentNotNull(group, nameof(group));
            Debug.ArgumentNotNull(issue, nameof(issue));

            var path = GetPath(group, issue);

            var collection = Issues.FindPath(path, GetNode);

            if (collection == null)
            {
                return;
            }

            var treeViewItem = GetLeaf(issue, issue.Text, issue.Icon);

            collection.Add(treeViewItem);
        }
        private IEnumerable <TreeViewPathItem> GetPath([NotNull] string group, [NotNull] ValidationIssue issue)
        {
            Debug.ArgumentNotNull(group, nameof(group));
            Debug.ArgumentNotNull(issue, nameof(issue));

            var result = new List <TreeViewPathItem>();

            foreach (var c in group.ToCharArray())
            {
                switch (c)
                {
                case 'c':
                    result.Add(new TreeViewPathItem
                    {
                        Tag  = issue.CategoryName,
                        Text = issue.CategoryName,
                        Icon = issue.CategoryIcon
                    });
                    break;

                case 'v':
                    result.Add(new TreeViewPathItem
                    {
                        Tag  = issue.ValidatorId,
                        Text = issue.ValidatorName,
                        Icon = issue.ValidatorIcon
                    });
                    break;

                case 'i':
                    result.Add(new TreeViewPathItem
                    {
                        Tag  = issue.ItemUri.ToString(),
                        Text = issue.Name,
                        Icon = issue.ItemIcon
                    });
                    break;
                }
            }

            return(result);
        }