private void _onAnimationDirectoryMediaPropertyChanged(object o, MediaPropertyChangedEventArgs e)
        {
            var adirPri = AnimationDirectoryPRI as AnimationDirectory;
            var adirSec = AnimationDirectorySEC as AnimationDirectory;
            var media   = e.Media as AnimatedMedia;

            if (media != null &&
                (adirPri != null && adirSec != null && adirPri != adirSec) &&
                !string.IsNullOrEmpty(e.PropertyName) &&
                (e.PropertyName == nameof(IAnimatedMedia.MediaName) ||
                 e.PropertyName == nameof(IAnimatedMedia.Fields) ||
                 e.PropertyName == nameof(IAnimatedMedia.Method) ||
                 e.PropertyName == nameof(IAnimatedMedia.TemplateLayer)
                ))
            {
                AnimatedMedia compMedia = adirSec.FindMediaByMediaGuid(media.MediaGuid) as AnimatedMedia;
                if (compMedia != null)
                {
                    PropertyInfo sourcePi = media.GetType().GetProperty(e.PropertyName);
                    PropertyInfo destPi   = compMedia.GetType().GetProperty(e.PropertyName);
                    if (sourcePi != null && destPi != null)
                    {
                        destPi.SetValue(compMedia, sourcePi.GetValue(media, null), null);
                    }
                }
            }
        }
Example #2
0
        private void _animationDirectoryMediaPropertyChanged(object o, MediaPropertyChangedEventArgs e)
        {
            var media = e.Media as AnimatedMedia ?? throw new ArgumentException("Invalid media type provided");

            if (!(AnimationDirectoryPRI is AnimationDirectory adirPri &&
                  AnimationDirectorySEC is AnimationDirectory adirSec &&
                  adirPri != adirSec &&
                  (e.PropertyName == nameof(IAnimatedMedia.MediaName) ||
                   e.PropertyName == nameof(IAnimatedMedia.Fields) ||
                   e.PropertyName == nameof(IAnimatedMedia.Method) ||
                   e.PropertyName == nameof(IAnimatedMedia.TemplateLayer) ||
                   e.PropertyName == nameof(IAnimatedMedia.ScheduledDelay) ||
                   e.PropertyName == nameof(IAnimatedMedia.StartType) ||
                   e.PropertyName == nameof(IAnimatedMedia.MediaEmphasis)
                  )))
            {
                return;
            }
            if (!(adirSec.FindMediaByMediaGuid(media.MediaGuid) is AnimatedMedia compMedia))
            {
                return;
            }
            var sourcePi = media.GetType().GetProperty(e.PropertyName);
            var destPi   = compMedia.GetType().GetProperty(e.PropertyName);

            if (sourcePi != null && destPi != null)
            {
                destPi.SetValue(compMedia, sourcePi.GetValue(media, null), null);
            }
        }
Example #3
0
        private void _onAnimationDirectoryMediaPropertyChanged(object o, MediaPropertyChangedEventArgs e)
        {
            if (!(e.Media is AnimatedMedia media &&
                  AnimationDirectoryPRI is AnimationDirectory adirPri &&
                  AnimationDirectorySEC is AnimationDirectory adirSec &&
                  adirPri != adirSec &&
                  (e.PropertyName == nameof(IAnimatedMedia.MediaName) ||
                   e.PropertyName == nameof(IAnimatedMedia.Fields) ||
                   e.PropertyName == nameof(IAnimatedMedia.Method) ||
                   e.PropertyName == nameof(IAnimatedMedia.TemplateLayer) ||
                   e.PropertyName == nameof(IAnimatedMedia.ScheduledDelay) ||
                   e.PropertyName == nameof(IAnimatedMedia.StartType)
                  )))
            {
                return;
            }
            if (!(adirSec.FindMediaByMediaGuid(media.MediaGuid) is AnimatedMedia compMedia))
            {
                return;
            }
            var sourcePi = media.GetType().GetProperty(e.PropertyName);
            var destPi   = compMedia.GetType().GetProperty(e.PropertyName);

            if (sourcePi != null && destPi != null)
            {
                destPi.SetValue(compMedia, sourcePi.GetValue(media, null), null);
            }
        }
Example #4
0
        private void _serverMediaPropertyChanged(object dir, MediaPropertyChangedEventArgs e)
        {
            var adirPri = MediaDirectoryPRI;
            var adirSec = MediaDirectorySEC;

            if (!(e.Media is ServerMedia media) ||
                adirPri == null || adirSec == null || adirPri == adirSec ||
                (
                    e.PropertyName != nameof(IServerMedia.DoNotArchive) &&
                    e.PropertyName != nameof(IServerMedia.IdAux) &&
                    e.PropertyName != nameof(IServerMedia.IdProgramme) &&
                    e.PropertyName != nameof(IServerMedia.KillDate) &&
                    e.PropertyName != nameof(IServerMedia.AudioVolume) &&
                    e.PropertyName != nameof(IServerMedia.MediaCategory) &&
                    e.PropertyName != nameof(IServerMedia.Parental) &&
                    e.PropertyName != nameof(IServerMedia.MediaEmphasis) &&
                    e.PropertyName != nameof(IServerMedia.FileName) &&
                    e.PropertyName != nameof(IServerMedia.MediaName) &&
                    e.PropertyName != nameof(IServerMedia.Duration) &&
                    e.PropertyName != nameof(IServerMedia.DurationPlay) &&
                    e.PropertyName != nameof(IServerMedia.TcStart) &&
                    e.PropertyName != nameof(IServerMedia.TcPlay) &&
                    e.PropertyName != nameof(IServerMedia.VideoFormat) &&
                    e.PropertyName != nameof(IServerMedia.AudioChannelMapping) &&
                    e.PropertyName != nameof(IServerMedia.AudioLevelIntegrated) &&
                    e.PropertyName != nameof(IServerMedia.AudioLevelPeak) &&
                    e.PropertyName != nameof(IServerMedia.IsProtected) &&
                    e.PropertyName != nameof(IServerMedia.FieldOrderInverted)
                ))
            {
                return;
            }
            var compMedia = _findComplementaryMedia(media);

            if (compMedia == null)
            {
                return;
            }
            var pi = typeof(ServerMedia).GetProperty(e.PropertyName);

            if (pi == null || !pi.CanWrite)
            {
                return;
            }
            if (e.PropertyName == nameof(IServerMedia.FileName) && pi.GetValue(media, null) is string newFileName)
            {
                compMedia.RenameFileTo(newFileName);
            }
            else
            {
                pi.SetValue(compMedia, pi.GetValue(media, null), null);
            }
        }
        private void _serverMediaPropertyChanged(object dir, MediaPropertyChangedEventArgs e)
        {
            var adirPri = MediaDirectoryPRI;
            var adirSec = MediaDirectorySEC;

            if (e.Media is ServerMedia &&
                (adirPri != null && adirSec != null && adirPri != adirSec) &&
                !string.IsNullOrEmpty(e.PropertyName) &&
                (e.PropertyName == nameof(IServerMedia.DoNotArchive) ||
                 e.PropertyName == nameof(IServerMedia.IdAux) ||
                 e.PropertyName == nameof(IServerMedia.IdProgramme) ||
                 e.PropertyName == nameof(IServerMedia.KillDate) ||
                 e.PropertyName == nameof(IServerMedia.AudioVolume) ||
                 e.PropertyName == nameof(IServerMedia.MediaCategory) ||
                 e.PropertyName == nameof(IServerMedia.Parental) ||
                 e.PropertyName == nameof(IServerMedia.MediaEmphasis) ||
                 e.PropertyName == nameof(IServerMedia.FileName) ||
                 e.PropertyName == nameof(IServerMedia.MediaName) ||
                 e.PropertyName == nameof(IServerMedia.Duration) ||
                 e.PropertyName == nameof(IServerMedia.DurationPlay) ||
                 e.PropertyName == nameof(IServerMedia.TcStart) ||
                 e.PropertyName == nameof(IServerMedia.TcPlay) ||
                 e.PropertyName == nameof(IServerMedia.VideoFormat) ||
                 e.PropertyName == nameof(IServerMedia.AudioChannelMapping) ||
                 e.PropertyName == nameof(IServerMedia.AudioLevelIntegrated) ||
                 e.PropertyName == nameof(IServerMedia.AudioLevelPeak) ||
                 e.PropertyName == nameof(IServerMedia.IsArchived) ||
                 e.PropertyName == nameof(IServerMedia.Protected) ||
                 e.PropertyName == nameof(IServerMedia.FieldOrderInverted) ||
                 e.PropertyName == nameof(IServerMedia.MediaSegments)
                ))
            {
                ServerMedia compMedia = _findComplementaryMedia(e.Media as ServerMedia);
                if (compMedia != null)
                {
                    PropertyInfo pi = typeof(ServerMedia).GetProperty(e.PropertyName);
                    if (pi != null)
                    {
                        pi.SetValue(compMedia, pi.GetValue(e.Media, null), null);
                    }
                }
            }
        }