private urakawa.media.ExternalAudioMedia GetExternalAudioMedia(urakawa.core.TreeNode node)
        {
            List <urakawa.property.channel.Channel> channelsList = m_Presentation.ChannelsManager.GetChannelsByName(PUBLISH_AUDIO_CHANNEL_NAME);

            if (channelsList == null || channelsList.Count == 0)
            {
                return(null);
            }

            if (channelsList == null || channelsList.Count > 1)
            {
                throw new System.Exception("more than one publish channel cannot exist");
            }

            Channel publishChannel = channelsList[0];

            urakawa.property.channel.ChannelsProperty mediaProperty = node.GetProperty <ChannelsProperty>();

            if (mediaProperty == null)
            {
                return(null);
            }

            return((ExternalAudioMedia)mediaProperty.GetMedia(publishChannel));
        }
示例#2
0
文件: Presentation.cs 项目: daisy/obi
        /// <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);
        }
        public void PropertyRemoved_EventOccursAndBubble()
        {
            int beforeCount;
            int changedBeforeCount;

            urakawa.property.xml.XmlProperty newXmlProp = mPresentation.PropertyFactory.CreateXmlProperty();
            mRootNode.AddProperty(newXmlProp);
            beforeCount        = mPropertyRemovedEventCount;
            changedBeforeCount = mChangedEventCount;
            mRootNode.RemoveProperty(newXmlProp);
            AssertPropertyRemovedEventOccured(beforeCount, changedBeforeCount, 1);
            urakawa.property.channel.ChannelsProperty newChProp = mPresentation.PropertyFactory.CreateChannelsProperty();
            mRootNode.AddProperty(newXmlProp);
            mRootNode.AddProperty(newChProp);
            beforeCount        = mPropertyRemovedEventCount;
            changedBeforeCount = mChangedEventCount;
        }
 public void PropertyRemoved_EventArgsAndSenderCorrect()
 {
     urakawa.property.xml.XmlProperty newXmlProp = mPresentation.PropertyFactory.CreateXmlProperty();
     mRootNode.AddProperty(newXmlProp);
     newXmlProp.SetQName("dtbook", "");
     urakawa.property.channel.ChannelsProperty newChProp = mPresentation.PropertyFactory.CreateChannelsProperty();
     mRootNode.AddProperty(newChProp);
     mRootNode.RemoveProperty(newXmlProp);
     Assert.AreSame(
         newXmlProp, mLatestPropertyRemovedEventArgs.m_RemovedObject,
         "The PropertyRemovedEventArgs.RemovedProperty must be the Property that was removed");
     Assert.AreSame(
         mRootNode, mLatestPropertyRemovedEventArgs.SourceObject,
         "The PropertyRemovedEventArgs.SourceTreeNode must be the TreeNode from which the Property was removed");
     Assert.AreSame(
         mRootNode, mLatestPropertyRemovedSender,
         "The sender of the PropertyRemoved event must be the TreeNode from which the Property was removed");
 }