/// <summary>
        /// Exports the channels property to a given destination <see cref="Presentation"/>,
        /// including exports of any attachedx <see cref="Media"/>
        /// </summary>
        /// <param name="destPres">Thre destination presentation of the export</param>
        /// <returns>The exported channels property</returns>
        protected override Property ExportProtected(Presentation destPres)
        {
            ChannelsProperty chExport = base.ExportProtected(destPres) as ChannelsProperty;

            if (chExport == null)
            {
                throw new exception.OperationNotValidException(
                          "The ExportProtected method of the base class unexpectedly did not return a ChannelsProperty");
            }
            foreach (Channel ch in UsedChannels)
            {
                Channel exportDestCh = null;
                foreach (Channel dCh in destPres.ChannelsManager.ManagedObjects.ContentsAs_Enumerable)
                {
                    if (ch.IsEquivalentTo(dCh))
                    {
                        exportDestCh = dCh;
                        break;
                    }
                }
                if (exportDestCh == null)
                {
                    exportDestCh = ch.Export(destPres);
                }
                chExport.SetMedia(exportDestCh, GetMedia(ch).Export(destPres));
            }
            return(chExport);
        }
Esempio n. 2
0
        /// <summary>
        /// Pre-visit action: If <see cref="Media"/> is present in <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// this is removed and the child <see cref="TreeNode"/>s are not visited
        /// </summary>
        /// <param name="node">The <see cref="TreeNode"/> to visit</param>
        /// <returns>
        /// <c>false</c> if <see cref="Media"/> is found if <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// <c>false</c> else
        /// </returns>
        public bool PreVisit(TreeNode node)
        {
            ChannelsProperty chProp = node.GetChannelsProperty();

            if (chProp != null)
            {
                urakawa.media.Media m = null;

                //try
                //{
                m = chProp.GetMedia(ChannelToClear);
//                }
//                catch (ChannelDoesNotExistException ex)
//                {
//#if DEBUG
//                    Debugger.Break();
//#endif
//                    return false;
//                }

                if (m != null)
                {
                    chProp.SetMedia(ChannelToClear, null);
                }
            }

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// Create a section node belonging to this presentation.
        /// </summary>
        public SectionNode CreateSectionNode()
        {
            SectionNode node = (SectionNode)m_ObiNodeFactory.createNode(XukAble.GetXukName(typeof(SectionNode)).z(PrettyFormat), DataModelFactory.NS); //sdk2 :local ObiNode factory used

            urakawa.property.channel.ChannelsProperty channelsProperty = PropertyFactory.CreateChannelsProperty();
            node.AddProperty(channelsProperty);
            // Create the text media object for the label with a default label
            TextMedia labelMedia = MediaFactory.CreateTextMedia();

            labelMedia.Text = Localizer.Message("default_section_label");
            channelsProperty.SetMedia(ChannelsManager.GetOrCreateTextChannel(), labelMedia);
            return(node);
        }
        /// <summary>
        /// Creates a "deep" copy of the <see cref="ChannelsProperty"/> instance
        /// - deep meaning that all associated are copies and not just referenced
        /// </summary>
        /// <returns>The deep copy</returns>
        /// <exception cref="exception.FactoryCannotCreateTypeException">
        /// TODO: Explain exception
        /// </exception>
        protected override Property CopyProtected()
        {
            ChannelsProperty theCopy = base.CopyProtected() as ChannelsProperty;

            if (theCopy == null)
            {
                throw new exception.FactoryCannotCreateTypeException(String.Format(
                                                                         "The property factory can not create a ChannelsProperty matching QName {0}:{1}",
                                                                         GetXukNamespace(),
                                                                         GetXukName()));
            }
            foreach (Channel ch in UsedChannels)
            {
                theCopy.SetMedia(ch, GetMedia(ch).Copy());
            }
            return(theCopy);
        }