public MediaSearchViewmodel(IPreview preview, IEngine engine, TMediaType mediaType, VideoLayer layer,
                             bool closeAfterAdd, VideoFormatDescription videoFormatDescription)
 {
     Engine = engine;
     Layer  = layer;
     if (mediaType == TMediaType.Movie)
     {
         _videoFormatDescription = engine.FormatDescription;
         if (preview != null)
         {
             _preview = new PreviewViewmodel(preview, false, false)
             {
                 IsSegmentsVisible = true
             }
         }
         ;
     }
     else
     {
         _videoFormatDescription = videoFormatDescription;
     }
     _mediaType = mediaType;
     if (_preview != null)
     {
         _preview.PropertyChanged += _onPreviewViewModelPropertyChanged;
     }
     CommandAdd        = new UiCommand(_add, _allowAdd);
     _mediaCategory    = MediaCategories.FirstOrDefault();
     NewEventStartType = TStartType.After;
     SetupSearchDirectory(closeAfterAdd, mediaType);
 }
Exemplo n.º 2
0
 private void _chooseMedia(TMediaType mediaType, IEvent baseEvent, TStartType startType, VideoFormatDescription videoFormatDescription = null)
 {
     if (_mediaSearchViewModel == null)
     {
         _mediaSearchViewModel                     = new MediaSearchViewmodel(_engineViewModel.Engine, _event.Engine.MediaManager, mediaType, VideoLayer.Program, true, videoFormatDescription);
         _mediaSearchViewModel.BaseEvent           = baseEvent;
         _mediaSearchViewModel.NewEventStartType   = startType;
         _mediaSearchViewModel.MediaChoosen       += _mediaSearchViewModelMediaChoosen;
         _mediaSearchViewModel.SearchWindowClosed += _searchWindowClosed;
     }
 }
 internal AnimatedEvent(
     Engine engine,
     UInt64 idRundownEvent,
     UInt64 idEventBinding,
     VideoLayer videoLayer,
     TStartType startType,
     TPlayState playState,
     DateTime scheduledTime,
     TimeSpan duration,
     TimeSpan scheduledDelay,
     Guid mediaGuid,
     string eventName,
     DateTime startTime,
     bool isEnabled,
     IDictionary <string, string> fields,
     TemplateMethod method,
     int templateLayer
     ) : base(
         engine,
         idRundownEvent,
         idEventBinding,
         videoLayer,
         TEventType.Animation,
         startType,
         playState,
         scheduledTime,
         duration,
         scheduledDelay,
         TimeSpan.Zero,
         mediaGuid,
         eventName,
         startTime,
         TimeSpan.Zero,
         null,
         TimeSpan.Zero,
         TimeSpan.Zero,
         TTransitionType.Cut,
         TEasing.None,
         0,
         0,
         string.Empty,
         isEnabled,
         false,
         false,
         AutoStartFlags.None,
         false, 0, 0, 0
         )
 {
     _fields = new SimpleDictionary <string, string>(fields);
     _fields.DictionaryOperation += _fields_DictionaryOperation;
     _method        = method;
     _templateLayer = templateLayer;
 }
Exemplo n.º 4
0
 public void Remove()
 {
     lock ((Engine as Engine).RundownSync)
     {
         Event      parent    = Parent as Event;
         Event      next      = Next as Event;
         Event      prior     = Prior as Event;
         TStartType startType = _startType;
         if (next != null)
         {
             next.Parent    = parent;
             next.Prior     = prior;
             next.StartType = startType;
             if (prior == null)
             {
                 next._uppdateScheduledTime();
             }
         }
         if (parent != null)
         {
             parent._subEventsRemove(this);
             if (next != null)
             {
                 parent._subEvents.Value.Add(next);
             }
             if (parent.SetField(ref parent._duration, parent._computedDuration(), nameof(Duration)))
             {
                 parent._durationChanged();
             }
             if (next != null)
             {
                 parent.NotifySubEventChanged(next, TCollectionOperation.Insert);
             }
         }
         if (prior != null)
         {
             prior.Next = next;
             prior._durationChanged();
         }
         if (next != null)
         {
             next.Save();
         }
         Next            = null;
         Prior           = null;
         Parent          = null;
         _idEventBinding = 0;
         StartType       = TStartType.None;
     }
 }
Exemplo n.º 5
0
 public IEvent CreateNewEvent(
     ulong idRundownEvent           = 0,
     ulong idEventBinding           = 0,
     VideoLayer videoLayer          = VideoLayer.None,
     TEventType eventType           = TEventType.Rundown,
     TStartType startType           = TStartType.None,
     TPlayState playState           = TPlayState.Scheduled,
     DateTime scheduledTime         = default(DateTime),
     TimeSpan duration              = default(TimeSpan),
     TimeSpan scheduledDelay        = default(TimeSpan),
     TimeSpan scheduledTC           = default(TimeSpan),
     Guid mediaGuid                 = default(Guid),
     string eventName               = "",
     DateTime startTime             = default(DateTime),
     TimeSpan startTC               = default(TimeSpan),
     TimeSpan?requestedStartTime    = null,
     TimeSpan transitionTime        = default(TimeSpan),
     TimeSpan transitionPauseTime   = default(TimeSpan),
     TTransitionType transitionType = TTransitionType.Cut,
     TEasing transitionEasing       = TEasing.Linear,
     double?audioVolume             = null,
     ulong idProgramme              = 0,
     string idAux     = "",
     bool isEnabled   = true,
     bool isHold      = false,
     bool isLoop      = false,
     bool isCGEnabled = false,
     byte crawl       = 0,
     byte logo        = 0,
     byte parental    = 0,
     AutoStartFlags autoStartFlags = AutoStartFlags.None,
     string command = null,
     IDictionary <string, string> fields = null,
     TemplateMethod method = TemplateMethod.Add,
     int templateLayer     = -1
     )
 {
     return(Query <Event>(parameters: new object[] { idRundownEvent, idEventBinding, videoLayer, eventType, startType, playState, scheduledTime, duration, scheduledDelay, scheduledTC, mediaGuid, eventName,
                                                     startTime, startTC, requestedStartTime, transitionTime, transitionPauseTime, transitionType, transitionEasing, audioVolume, idProgramme, idAux, isEnabled, isHold, isLoop, isCGEnabled,
                                                     crawl, logo, parental, autoStartFlags, command, fields, method, templateLayer }));
 }
 internal CommandScriptEvent(Engine engine, ulong idRundownEvent, ulong idEventBinding, TStartType startType, TPlayState playState, TimeSpan scheduledDelay, string eventName, DateTime startTime, bool isEnabled, string command)
     : base(engine, idRundownEvent, idEventBinding, VideoLayer.None, TEventType.CommandScript, startType, playState, DateTime.MinValue, TimeSpan.Zero, scheduledDelay, TimeSpan.Zero, Guid.Empty, eventName, startTime, TimeSpan.Zero, null, TimeSpan.Zero, TimeSpan.Zero, TTransitionType.Cut, TEasing.None, null, 0, string.Empty, isEnabled, false, false, AutoStartFlags.None, false, 0, 0, 0, -1, null)
 {
     _command = command;
 }
Exemplo n.º 7
0
        internal Event(
            Engine engine,
            UInt64 idRundownEvent,
            UInt64 idEventBinding,
            VideoLayer videoLayer,
            TEventType eventType,
            TStartType startType,
            TPlayState playState,
            DateTime scheduledTime,
            TimeSpan duration,
            TimeSpan scheduledDelay,
            TimeSpan scheduledTC,
            Guid mediaGuid,
            string eventName,
            DateTime startTime,
            TimeSpan startTC,
            TimeSpan?requestedStartTime,
            TimeSpan transitionTime,
            TimeSpan transitionPauseTime,
            TTransitionType transitionType,
            TEasing transitionEasing,
            decimal?audioVolume,
            UInt64 idProgramme,
            string idAux,
            bool isEnabled,
            bool isHold,
            bool isLoop,
            AutoStartFlags autoStartFlags,
            bool isCGEnabled,
            byte crawl,
            byte logo,
            byte parental)
        {
            _engine              = engine;
            _id                  = idRundownEvent;
            _idEventBinding      = idEventBinding;
            _layer               = videoLayer;
            _eventType           = eventType;
            _startType           = startType;
            _playState           = playState == TPlayState.Paused ? TPlayState.Scheduled: playState == TPlayState.Fading ? TPlayState.Played : playState;
            _scheduledTime       = scheduledTime;
            _duration            = duration;
            _scheduledDelay      = scheduledDelay;
            _scheduledTc         = scheduledTC;
            _eventName           = eventName;
            _startTime           = startTime;
            _startTc             = startTC;
            _requestedStartTime  = requestedStartTime;
            _transitionTime      = transitionTime;
            _transitionPauseTime = transitionPauseTime;
            _transitionType      = transitionType;
            _transitionEasing    = transitionEasing;
            _audioVolume         = audioVolume;
            _idProgramme         = idProgramme;
            _idAux               = idAux;
            _isEnabled           = isEnabled;
            _isHold              = isHold;
            _isLoop              = isLoop;
            _isCGEnabled         = isCGEnabled;
            _crawl               = crawl;
            _logo                = logo;
            _parental            = parental;
            _autoStartFlags      = autoStartFlags;
            _setMedia(null, mediaGuid);
            _subEvents = new Lazy <SynchronizedCollection <Event> >(() =>
            {
                var result = new SynchronizedCollection <Event>();
                if (_id != 0)
                {
                    var seList = Engine.DbReadSubEvents(this);
                    foreach (Event e in seList)
                    {
                        e.Parent = this;
                        result.Add(e);
                    }
                }
                return(result);
            });

            _next = new Lazy <Event>(() =>
            {
                var next = (Event)Engine.DbReadNext(this);
                if (next != null)
                {
                    next.Prior = this;
                }
                return(next);
            });
            _prior = new Lazy <Event>(() =>
            {
                Event prior = null;
                if (startType == TStartType.After && _idEventBinding > 0)
                {
                    prior = (Event)Engine.DbReadEvent(_idEventBinding);
                }
                return(prior);
            });

            _parent = new Lazy <Event>(() =>
            {
                if ((startType == TStartType.WithParent || startType == TStartType.WithParentFromEnd) && _idEventBinding > 0)
                {
                    return((Event)Engine.DbReadEvent(_idEventBinding));
                }
                return(null);
            });
        }
Exemplo n.º 8
0
        internal Event(
            Engine engine,
            UInt64 idRundownEvent,
            UInt64 idEventBinding,
            VideoLayer videoLayer,
            TEventType eventType,
            TStartType startType,
            TPlayState playState,
            DateTime scheduledTime,
            TimeSpan duration,
            TimeSpan scheduledDelay,
            TimeSpan scheduledTC,
            Guid mediaGuid,
            string eventName,
            DateTime startTime,
            TimeSpan startTC,
            TimeSpan?requestedStartTime,
            TimeSpan transitionTime,
            TimeSpan transitionPauseTime,
            TTransitionType transitionType,
            TEasing transitionEasing,
            double?audioVolume,
            UInt64 idProgramme,
            string idAux,
            bool isEnabled,
            bool isHold,
            bool isLoop,
            AutoStartFlags autoStartFlags,
            bool isCGEnabled,
            byte crawl,
            byte logo,
            byte parental,
            short routerPort,
            RecordingInfo recordingInfo)
        {
            _engine              = engine;
            _rundownSync         = engine.RundownSync;
            Id                   = idRundownEvent;
            IdEventBinding       = idEventBinding;
            _layer               = videoLayer;
            _eventType           = eventType;
            _startType           = startType;
            _playState           = playState == TPlayState.Paused ? TPlayState.Scheduled: playState == TPlayState.Fading ? TPlayState.Played : playState;
            _scheduledTime       = scheduledTime;
            _duration            = duration;
            _scheduledDelay      = scheduledDelay;
            _scheduledTc         = scheduledTC;
            _eventName           = eventName;
            _startTime           = startTime;
            _startTc             = startTC;
            _requestedStartTime  = requestedStartTime;
            _transitionTime      = transitionTime;
            _transitionPauseTime = transitionPauseTime;
            _transitionType      = transitionType;
            _transitionEasing    = transitionEasing;
            _audioVolume         = audioVolume;
            _idProgramme         = idProgramme;
            _idAux               = idAux;
            _isEnabled           = isEnabled;
            _isHold              = isHold;
            _isLoop              = isLoop;
            _isCGEnabled         = isCGEnabled;
            _crawl               = crawl;
            _logo                = logo;
            _parental            = parental;
            _autoStartFlags      = autoStartFlags;
            _mediaGuid           = mediaGuid;
            _subEvents           = new Lazy <SynchronizedCollection <Event> >(() =>
            {
                var result = new SynchronizedCollection <Event>();
                if (Id == 0)
                {
                    return(result);
                }
                var seList = DatabaseProvider.Database.ReadSubEvents(_engine, this);
                foreach (Event e in seList)
                {
                    e.Parent = this;
                    result.Add(e);
                }
                return(result);
            });

            _next = new Lazy <Event>(() =>
            {
                var next = (Event)DatabaseProvider.Database.ReadNext(_engine, this);
                if (next != null)
                {
                    next.Prior = this;
                }
                return(next);
            });

            _prior = new Lazy <Event>(() =>
            {
                Event prior = null;
                if (startType == TStartType.After && IdEventBinding > 0)
                {
                    prior = (Event)DatabaseProvider.Database.ReadEvent(_engine, IdEventBinding);
                }
                if (prior != null)
                {
                    prior.Next = this;
                }
                return(prior);
            });

            _parent = new Lazy <Event>(() =>
            {
                if ((startType == TStartType.WithParent || startType == TStartType.WithParentFromEnd) && IdEventBinding > 0)
                {
                    return((Event)DatabaseProvider.Database.ReadEvent(_engine, IdEventBinding));
                }
                return(null);
            });

            _rights = new Lazy <List <IAclRight> >(() =>
            {
                var rights = DatabaseProvider.Database.ReadEventAclList <EventAclRight>(this, _engine.AuthenticationService as IAuthenticationServicePersitency);
                rights.ForEach(r => ((EventAclRight)r).Saved += AclEvent_Saved);
                return(rights);
            });
            _routerPort    = routerPort;
            _recordingInfo = recordingInfo;

            FieldLengths = DatabaseProvider.Database.EventFieldLengths;
        }
        public MediaSearchViewmodel(EngineViewmodel engineVM, TMediaType mediaType, bool closeAfterAdd, TVideoFormat? videoFormat)
        {
            _manager = engineVM.Engine.MediaManager;
            _previewViewmodel = engineVM.PreviewViewmodel;
            if (_previewViewmodel != null)
                _previewViewmodel.PropertyChanged += OnPreviewPropertyChanged;
            _mediaType = mediaType;
            if (mediaType == TMediaType.AnimationFlash)
                _searchDirectory = _manager.AnimationDirectoryPGM;
            else
                _searchDirectory = _manager.MediaDirectoryPGM;
            _searchDirectory.MediaAdded += new EventHandler<MediaEventArgs>(_searchDirectory_MediaAdded);
            _searchDirectory.MediaRemoved += new EventHandler<MediaEventArgs>(_searchDirectory_MediaRemoved);
            _searchDirectory.MediaVerified += new EventHandler<MediaEventArgs>(_searchDirectory_MediaVerified);

            _videoFormat = videoFormat;
            _closeAfterAdd = closeAfterAdd;
            _mediaCategory = MediaCategories.FirstOrDefault();
            NewEventStartType = TStartType.After;
            if (!closeAfterAdd)
                OkButtonText = Properties.Resources._button_Add;
            _createCommands();
            _items = new ObservableCollection<MediaViewViewmodel>(_searchDirectory.Files
                .Where(m=> m.MediaType == mediaType && (videoFormat == null || m.VideoFormat == videoFormat))
                .Select(m => new MediaViewViewmodel(m)));
            _itemsView = CollectionViewSource.GetDefaultView(_items);
            _itemsView.SortDescriptions.Add(new SortDescription("MediaName", ListSortDirection.Ascending));
            _itemsView.Filter += _itemsFilter;

            _window = new MediaSearchView();
            _window.Owner = App.Current.MainWindow;
            _window.DataContext = this;
            _window.Closed += _windowClosed;
            _window.Show();
            //_window.Topmost = true;
        }