public static void Reflect(TagManager dest, TagTreeViewItemModelManager source)
        {
            foreach (var deletedTag in source.DeletedTags)
            {
                dest.Remove(deletedTag.Id);
            }

            dest.ReconnectAllToBaseTag();

            foreach (var tag in source.AddedTags)
            {
                var addNewTag = new TagModel(tag.Id)
                {
                    Name = tag.Name
                };
                dest.Add(addNewTag);
                dest.ConnectTags(dest.GetBaseTag(), addNewTag);
            }

            foreach (var tag in dest.TagDictionary.Values)
            {
                if (tag.IsBase())
                {
                    continue;
                }

                var sourceTag = source.TagDictionary[tag.Id];

                var parent = dest.TagDictionary[sourceTag.Parent.Id];

                dest.DisconnectFromParent(tag);
                dest.ConnectTags(parent, tag);
                tag.Name = sourceTag.Name;
            }
        }
        public static void Reflect(TagManager dest, TagTreeViewItemModelManager source)
        {
            foreach (var deletedTag in source.DeletedTags)
            {
                dest.Remove(deletedTag.Id);
            }

            dest.ReconnectAllToBaseTag();

            foreach (var tag in source.AddedTags)
            {
                var addNewTag = new TagModel(tag.Id) { Name = tag.Name };
                dest.Add(addNewTag);
                dest.ConnectTags(dest.GetBaseTag(), addNewTag);
            }

            foreach (var tag in dest.TagDictionary.Values)
            {
                if (tag.IsBase())
                {
                    continue;
                }

                var sourceTag = source.TagDictionary[tag.Id];

                var parent = dest.TagDictionary[sourceTag.Parent.Id];

                dest.DisconnectFromParent(tag);
                dest.ConnectTags(parent, tag);
                tag.Name = sourceTag.Name;
            }
        }
        public void Init(TagManager tagManager)
        {
            _manager             = TagManagerConverter.Convert(tagManager);
            _manager.TagRemoved += _manager_TagRemoved;
            var baseTag = _manager.GetBaseTag();

            _tags = new ObservableCollection <TagTreeViewItemModel>();

            _tags.Add(baseTag as TagTreeViewItemModel);
        }
        public static void ExpandChild(TagTreeViewItemModel parentTag, TagModel baseTag, ref TagTreeViewItemModelManager manager)
        {
            foreach (var child in baseTag.Children)
            {
                var childTag = ConvertTagToTagTreeViewItemModel.ConvertTag(child);

                manager.Add(childTag);
                manager.ConnectTags(parentTag, childTag);

                ExpandChild(childTag, child, ref manager);
            }
        }
        public static TagTreeViewItemModelManager Convert(TagManager source)
        {
            TagTreeViewItemModelManager result = new TagTreeViewItemModelManager();

            var baseTag = source.GetBaseTag();

            var addBaseTag = ConvertTagToTagTreeViewItemModel.ConvertBaseTag(baseTag);

            result.Add(addBaseTag);
            ExpandChild(addBaseTag, baseTag, ref result);

            return(result);
        }
        public static TagTreeViewItemModelManager Convert(TagManager source)
        {
            TagTreeViewItemModelManager result = new TagTreeViewItemModelManager();

            var baseTag = source.GetBaseTag();

            var addBaseTag = ConvertTagToTagTreeViewItemModel.ConvertBaseTag(baseTag);

            result.Add(addBaseTag);
            ExpandChild(addBaseTag, baseTag, ref result);

            return result;
        }
        public void Init(TagManager tagManager)
        {
            _manager = TagManagerConverter.Convert(tagManager);
            _manager.TagRemoved += _manager_TagRemoved;
            var baseTag = _manager.GetBaseTag();

            _tags = new ObservableCollection<TagTreeViewItemModel>();

            _tags.Add(baseTag as TagTreeViewItemModel);
        }
        public static void ExpandChild(TagTreeViewItemModel parentTag, TagModel baseTag, ref TagTreeViewItemModelManager manager)
        {
            foreach (var child in baseTag.Children)
            {
                var childTag = ConvertTagToTagTreeViewItemModel.ConvertTag(child);

                manager.Add(childTag);
                manager.ConnectTags(parentTag, childTag);

                ExpandChild(childTag, child, ref manager);
            }
        }