private void btnAddSound_Click(object sender, RoutedEventArgs e)
 {
     Sound lastSound = Sound;
     Sound = Sound.NewSound(false);
     if (Sound != null)
     {
         preview.RemoveIObject(lastSound);
         preview.SetObjectPositionOnCanvas(Sound, 0, 0);
         preview.AddIObject(Sound);
         btnAddTextBlock.IsDefault = true;
         _soundAdded = true;
     }
     else Sound = lastSound;
     CheckIfAllComponentsAdded();
 }
Exemplo n.º 2
0
        private void LoadObjects()
        {
            var objects = entities[OBJECTS];
            var maxObjId = 0;
            foreach (var obj in objects)
            {
                IObject newObject = null;
                var attributes = ConvertXmlAttributes(obj.Attributes());

                switch (obj.Name.ToString())
                {
                    case "image":
                        newObject = new Picture();
                        break;
                    case "video":
                        newObject = new Video(false);
                        break;
                    case "sound":
                        newObject = new Sound(false);
                        break;
                    case "text":
                        newObject = new Text();
                        break;
                    case "flash":
                        newObject = new FlashAnimation();
                        break;
                    case "area":
                        newObject = new Area();
                        break;
                    case "dropContainer":
                        newObject = new DropContainer();
                        break;
                }

                if (newObject == null) return;
                newObject.Load(attributes);
                if (newObject.ObjectId > maxObjId) maxObjId = newObject.ObjectId;
                Practice.GetInstance().GetSlideById(newObject.SlideId).AddObject(newObject);
            }   
            Practice.SetObjectIdCounter(maxObjId + 1);
        }
Exemplo n.º 3
0
 public IObject DeepCopy()
 {
     var newSound = new Sound(Autoplay)
         {
             SoundSource = DeepCopyMediaElem(SoundSource),
             ObjectPath = ObjectPath,
             ObjectName = Utilities.GiveUniqueName(SoundSource.Source),
             Autoplay = Autoplay,
             RemoteSource = RemoteSource
         };
     return newSound;
 }
Exemplo n.º 4
0
        public Sound OpenHiddenSound()
        {
            var sound = new Sound(false);
            var w = new AddListenMusicWindow();

            if (w.ShowDialog() == true)
            {
                var mainWin = DesignerMainWindow.GetInstance();
                int currentSlideNr = mainWin.GetCurrentSlideNr();

                sound.SoundSource.Source = w.TheElem.Source;
                sound.SoundSource.LoadedBehavior = MediaState.Stop;
                sound.ObjectName = Utilities.GiveUniqueName(sound.SoundSource.Source);

                SetZIndex(sound,
                          Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SlideObjects.Count);
                return sound;
            }
            return null;
        }
Exemplo n.º 5
0
        public static Sound NewSound(bool autoplay)
        {
            var sound = new Sound(autoplay);
            var w = new AddListenMusicWindow();

            if (w.ShowDialog() != true) return null;

            var mainWin = DesignerMainWindow.GetInstance();
            Point currentMousePosition = mainWin.GetCurrentMousePosition();

            sound.SoundSource.Source = w.TheElem.Source;
            sound.SoundSource.LoadedBehavior = MediaState.Stop;
            sound.ObjectName = Utilities.GiveUniqueName(sound.SoundSource.Source);
            sound.ObjectPath = w.ObjectPath;

            InkCanvas.SetTop(sound, currentMousePosition.Y);
            InkCanvas.SetLeft(sound, currentMousePosition.X);
            SetZIndex(sound, Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SlideObjects.Count);

            return sound;
        }