Esempio n. 1
0
        public void RemoveMetadata(AlternateContentProperty altProp, AlternateContent altContent,
                                   Metadata md)
        {
            Tuple <TreeNode, TreeNode> selection = m_UrakawaSession.GetTreeNodeSelection();
            TreeNode node = selection.Item2 ?? selection.Item1;

            if (node == null)
            {
                return;
            }

            var altProp_ = node.GetAlternateContentProperty();

            if (altProp_ == null)
            {
                return;
            }

            if (altProp != null && altProp_ != altProp)
            {
                return;
            }

            if (altContent != null && altProp_.AlternateContents.IndexOf(altContent) < 0)
            {
                return;
            }

            AlternateContentMetadataRemoveCommand cmd = node.Presentation.CommandFactory.CreateAlternateContentMetadataRemoveCommand(node, altProp, altContent, md, null);

            node.Presentation.UndoRedoManager.Execute(cmd);

            RaisePropertyChanged(() => Metadatas);
            RaisePropertyChanged(() => Descriptions);
        }
Esempio n. 2
0
        public void RemoveMetadataAttr(Metadata md, MetadataAttribute mdAttr)
        {
            Tuple <TreeNode, TreeNode> selection = m_UrakawaSession.GetTreeNodeSelection();
            TreeNode node = selection.Item2 ?? selection.Item1;

            if (node == null)
            {
                return;
            }

            var altProp = node.GetAlternateContentProperty();

            if (altProp == null)
            {
                return;
            }

            int index = altProp.Metadatas.IndexOf(md);

            if (index < 0)
            {
                return;
            }

            index = altProp.Metadatas.Get(index).OtherAttributes.IndexOf(mdAttr);
            if (index < 0)
            {
                return;
            }

            AlternateContentMetadataRemoveCommand cmd = node.Presentation.CommandFactory.CreateAlternateContentMetadataRemoveCommand(node, altProp, null, md, mdAttr);

            node.Presentation.UndoRedoManager.Execute(cmd);

            RaisePropertyChanged(() => Metadatas);
        }