Пример #1
0
        public void InsertElement(int index, IBackgroundSoundChoice element)
        {
            BackgroundSoundChoice bsc = element as BackgroundSoundChoice;

            m_Container.InsertGeneralElement(index, bsc.ParallelElement);
            m_Elements.Insert(index, bsc);
        }
Пример #2
0
        public IBackgroundSoundChoice AddElement(String title)
        {
            BackgroundSoundChoice choice = new BackgroundSoundChoice(
                DataModule.TheElementFactory.GetNextID(), title);
            IParallelElement parallelElement = m_Container.AddElement(choice);

            parallelElement.RepeatCount = -1;
            choice.ParallelElement      = parallelElement;
            m_Elements.Add(choice);
            return(choice);
        }
Пример #3
0
        internal BackgroundSounds(System.Xml.XmlReader reader)
            : base(reader)
        {
            m_Elements = new List <IBackgroundSoundChoice>();
            int id = reader.GetIntegerAttribute("ContainerId");

            m_Container = DataModule.TheElementFactory.CreateParallelContainer(Title + "_Parallel", id);

            if (reader.IsEmptyElement)
            {
                XmlHelpers.ThrowException(StringResources.ExpectedContent, reader);
            }
            reader.Read();
            while (reader.IsStartElement())
            {
                if (reader.IsStartElement("SubElements") && !reader.IsEmptyElement)
                {
                    reader.Read();
                    while (reader.IsStartElement())
                    {
                        if (reader.IsStartElement("BackgroundSoundChoice"))
                        {
                            BackgroundSoundChoice choice          = new BackgroundSoundChoice(reader);
                            IParallelElement      parallelElement = m_Container.AddElement(choice);
                            parallelElement.RepeatCount = -1;
                            choice.ParallelElement      = parallelElement;
                            if (reader.IsStartElement("ParallelElementData"))
                            {
                                AdditionalChoiceData data = ReadAdditionalData(reader);
                                parallelElement.FixedStartDelay                = data.FixedStartDelay;
                                parallelElement.MaximumRandomStartDelay        = data.MaximumRandomStartDelay;
                                parallelElement.FixedIntermediateDelay         = data.FixedIntermediateDelay;
                                parallelElement.MaximumRandomIntermediateDelay = data.MaximumRandomIntermediateDelay;
                                parallelElement.RepeatCount = data.RepeatCount;
                            }
                            m_Elements.Add(choice);
                        }
                        else
                        {
                            reader.ReadOuterXml();
                        }
                    }
                    reader.ReadEndElement();
                }
                else
                {
                    reader.ReadOuterXml();
                }
            }

            reader.ReadEndElement();
        }
Пример #4
0
        public IBackgroundSoundChoice AddImportedElement(IXmlWritable writable)
        {
            ImportedChoice choice = writable as ImportedChoice;

            if (choice == null)
            {
                return(null);
            }
            BackgroundSoundChoice bgChoice        = choice.SoundChoice;
            IParallelElement      parallelElement = m_Container.AddElement(bgChoice);

            parallelElement.FixedStartDelay                = choice.ChoiceData.FixedStartDelay;
            parallelElement.FixedIntermediateDelay         = choice.ChoiceData.FixedIntermediateDelay;
            parallelElement.MaximumRandomStartDelay        = choice.ChoiceData.MaximumRandomStartDelay;
            parallelElement.MaximumRandomIntermediateDelay = choice.ChoiceData.MaximumRandomIntermediateDelay;
            parallelElement.RepeatCount = choice.ChoiceData.RepeatCount;
            bgChoice.ParallelElement    = parallelElement;
            m_Elements.Add(bgChoice);
            return(bgChoice);
        }
Пример #5
0
 internal IElement CreateElement(System.Xml.XmlReader reader)
 {
     if (reader.IsStartElement("SequentialMusicList"))
     {
         return(new SequentialBackgroundMusicList(reader));
     }
     else if (reader.IsStartElement("RandomMusicList"))
     {
         return(new RandomBackgroundMusicList(reader));
     }
     else if (reader.IsStartElement("BackgroundSounds"))
     {
         return(new BackgroundSounds(reader));
     }
     else if (reader.IsStartElement("SequentialContainer"))
     {
         return(new SequentialContainer(reader));
     }
     else if (reader.IsStartElement("ChoiceContainer"))
     {
         return(new ChoiceContainer(reader));
     }
     else if (reader.IsStartElement("ParallelContainer"))
     {
         return(new ParallelContainer(reader));
     }
     else if (reader.IsStartElement("FileElement"))
     {
         return(new BasicFileElement(reader));
     }
     else if (reader.IsStartElement("WebRadio"))
     {
         return(new WebRadioElement(reader));
     }
     else if (reader.IsStartElement("BackgroundSoundChoice"))
     {
         BackgroundSoundChoice choice = new BackgroundSoundChoice(reader);
         if (reader.IsStartElement("ParallelElementData"))
         {
             BackgroundSounds.AdditionalChoiceData data = BackgroundSounds.ReadAdditionalData(reader);
             return(new BackgroundSounds.ImportedChoice(choice, data));
         }
         else
         {
             return(null);
         }
     }
     else if (reader.IsStartElement("Parallel"))
     {
         return(new ParallelElement(reader));
     }
     else if (reader.IsStartElement("Sequential"))
     {
         return(new SequentialElement(reader));
     }
     else if (reader.IsStartElement("Choice"))
     {
         return(new ChoiceElement(reader));
     }
     else if (reader.IsStartElement("Macro"))
     {
         return(new Macro(reader));
     }
     else if (reader.IsStartElement("ReferenceElement"))
     {
         return(new ReferenceElement(reader));
     }
     else if (reader.IsStartElement("MusicByTags"))
     {
         return(new MusicByTags(reader));
     }
     else
     {
         IMacroCommand macroCommand = DataModule.TheMacroFactory.CreateMacroCommand(reader);
         if (macroCommand != null)
         {
             return(macroCommand);
         }
         else
         {
             reader.ReadOuterXml();
             return(null);
         }
     }
 }
Пример #6
0
 public ImportedChoice(BackgroundSoundChoice soundChoice, AdditionalChoiceData choiceData)
 {
     SoundChoice = soundChoice;
     ChoiceData  = choiceData;
 }