private void _addSubLive(object obj)
 {
     EngineViewmodel.AddSimpleEvent(Event, TEventType.Live, true);
 }
 private void _addSubRundown(object obj)
 {
     EngineViewmodel.AddSimpleEvent(Event, TEventType.Rundown, true);
 }
Пример #3
0
        protected EventPanelRundownElementViewmodelBase(IEvent ev, EventPanelViewmodelBase parent) : base(ev, parent)
        {
            Media = ev.Media;
            ev.PositionChanged += EventPositionChanged;
            ev.SubEventChanged += OnSubeventChanged;

            CommandToggleHold = new UICommand
            {
                ExecuteDelegate = o =>
                {
                    Event.IsHold = !Event.IsHold;
                    Event.Save();
                },
                CanExecuteDelegate = _canToggleHold
            };
            CommandToggleEnabled = new UICommand
            {
                ExecuteDelegate = o =>
                {
                    Event.IsEnabled = !Event.IsEnabled;
                    Event.Save();
                },
                CanExecuteDelegate = o => Event.PlayState == TPlayState.Scheduled && Event.HaveRight(EventRight.Modify)
            };
            CommandToggleLayer = new UICommand
            {
                ExecuteDelegate = l =>
                {
                    if (!(l is string layerName) || !Enum.TryParse(layerName, true, out VideoLayer layer))
                    {
                        return;
                    }
                    if (_hasSubItemsOnLayer(layer))
                    {
                        var layerEvent = Event.SubEvents.FirstOrDefault(e => e.Layer == layer);
                        layerEvent?.Delete();
                    }
                    else
                    {
                        EngineViewmodel.AddMediaEvent(Event, TStartType.WithParent, TMediaType.Still, layer, true);
                    }
                },
                CanExecuteDelegate = _canToggleLayer
            };
            CommandAddNextRundown = new UICommand
            {
                ExecuteDelegate    = o => EngineViewmodel.AddSimpleEvent(Event, TEventType.Rundown, false),
                CanExecuteDelegate = _canAddNextItem
            };
            CommandAddNextEmptyMovie = new UICommand
            {
                ExecuteDelegate    = o => EngineViewmodel.AddSimpleEvent(Event, TEventType.Movie, false),
                CanExecuteDelegate = CanAddNextMovie
            };
            CommandAddNextLive = new UICommand
            {
                ExecuteDelegate    = o => EngineViewmodel.AddSimpleEvent(Event, TEventType.Live, false),
                CanExecuteDelegate = CanAddNewLive
            };
            CommandAddNextMovie = new UICommand
            {
                ExecuteDelegate = o => EngineViewmodel.AddMediaEvent(Event, TStartType.After, TMediaType.Movie,
                                                                     VideoLayer.Program, false),
                CanExecuteDelegate = CanAddNextMovie
            };
            CommandAddAnimation = new UICommand
            {
                ExecuteDelegate = o => EngineViewmodel.AddMediaEvent(Event, TStartType.WithParent,
                                                                     TMediaType.Animation, VideoLayer.Animation, true),
                CanExecuteDelegate = o => Event.PlayState == TPlayState.Scheduled && Event.HaveRight(EventRight.Modify)
            };
            CommandAddCommandScript = new UICommand
            {
                ExecuteDelegate    = o => EngineViewmodel.AddCommandScriptEvent(Event),
                CanExecuteDelegate = o => Event.PlayState == TPlayState.Scheduled && Event.HaveRight(EventRight.Modify)
            };
        }