コード例 #1
0
 private void _onEngineEventLocated(object o, EventEventArgs e) // when new event was created
 {
     Debug.WriteLine(e.Event?.EventName, "EventLocated notified");
     if (e.Event == null)
     {
         return;
     }
     OnUiThread(() =>
     {
         var evm = Find(e.Event, true);
         if (evm != null)
         {
             evm.UpdateLocation();
         }
         else
         {
             EventPanelViewmodelBase vm = PlaceEventInRundown(e.Event, false);
             if (vm != null &&
                 e.Event.EventType != TEventType.StillImage &&
                 e.Event == EngineViewmodel.LastAddedEvent)
             {
                 vm.IsSelected = true;
                 EngineViewmodel.ClearSelection();
                 if (e.Event.EventType == TEventType.Rundown)
                 {
                     vm.IsExpanded = true;
                 }
             }
             (vm as EventPanelRundownElementViewmodelBase)?.VerifyIsInvalidInSchedule();
         }
     });
 }
コード例 #2
0
 public EventPanelRootViewmodel(EngineViewmodel engineViewmodel) : base(engineViewmodel)
 {
     _engine.EventSaved   += _onEngineEventSaved;
     _engine.EventDeleted += _engine_EventDeleted;
     foreach (var se in _engine.GetRootEvents())
     {
         _addRootEvent(se);
     }
 }
コード例 #3
0
 /// <summary>
 /// Constructor for root event
 /// </summary>
 /// <param name="engineViewmodel"></param>
 protected EventPanelViewmodelBase(EngineViewmodel engineViewmodel)
 {
     EngineViewmodel = engineViewmodel;
     Engine          = engineViewmodel.Engine;
     Level           = 0;
     _isExpanded     = true;
     _videoFormat    = engineViewmodel.VideoFormat;
     Root            = (EventPanelRootViewmodel)this;
 }
コード例 #4
0
 public EventPanelRootViewmodel(EngineViewmodel engineViewmodel) : base(engineViewmodel)
 {
     Engine.EventLocated += _onEngineEventLocated;
     Engine.EventDeleted += _engine_EventDeleted;
     foreach (var se in Engine.GetRootEvents())
     {
         AddRootEvent(se);
     }
 }
コード例 #5
0
 public EventEditViewmodel(EngineViewmodel engineViewModel, PreviewViewmodel previewViewModel)
 {
     _engineViewModel  = engineViewModel;
     _previewViewModel = previewViewModel;
     if (previewViewModel != null)
     {
         previewViewModel.PropertyChanged += PreviewViewModel_PropertyChanged;
     }
     _engine = engineViewModel.Engine;
     _fields.CollectionChanged += _fields_or_commands_CollectionChanged;
     CommandSaveEdit            = new UICommand()
     {
         ExecuteDelegate = _save, CanExecuteDelegate = _canSave
     };
     CommandUndoEdit = new UICommand()
     {
         ExecuteDelegate = _load, CanExecuteDelegate = o => IsModified
     };
     CommandChangeMovie = new UICommand()
     {
         ExecuteDelegate = _changeMovie, CanExecuteDelegate = _canChangeMovie
     };
     CommandEditMovie = new UICommand()
     {
         ExecuteDelegate = _editMovie, CanExecuteDelegate = _canEditMovie
     };
     CommandCheckVolume = new UICommand()
     {
         ExecuteDelegate = _checkVolume, CanExecuteDelegate = _canCheckVolume
     };
     CommandEditField = new UICommand {
         ExecuteDelegate = _editField
     };
     CommandTriggerStartType = new UICommand {
         ExecuteDelegate = _triggerStartType, CanExecuteDelegate = _canTriggerStartType
     };
     CommandMoveUp = new UICommand()
     {
         ExecuteDelegate = o => _event?.MoveUp(), CanExecuteDelegate = _canMoveUp
     };
     CommandMoveDown = new UICommand()
     {
         ExecuteDelegate = o => _event?.MoveDown(), CanExecuteDelegate = _canMoveDown
     };
     CommandDelete = new UICommand
     {
         ExecuteDelegate = o =>
         {
             if (_event != null && MessageBox.Show(resources._query_DeleteItem, resources._caption_Confirmation, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
             {
                 EventClipboard.SaveUndo(new IEvent[] { _event }, _event.StartType == TStartType.After ? _event.Prior : _event.Parent);
                 _event.Delete();
             }
         },
         CanExecuteDelegate = o => _event?.AllowDelete() == true
     };
 }
コード例 #6
0
 /// <summary>
 /// Constructor for root event
 /// </summary>
 /// <param name="engineViewmodel"></param>
 public EventPanelViewmodelBase(EngineViewmodel engineViewmodel) : base()
 {
     _engineViewmodel = engineViewmodel;
     _engine          = engineViewmodel.Engine;
     _level           = 0;
     _isExpanded      = true;
     _videoFormat     = engineViewmodel.VideoFormat;
     _root            = (EventPanelRootViewmodel)this;
 }
コード例 #7
0
 public EventEditViewmodel(IEvent @event, EngineViewmodel engineViewModel) : base(@event)
 {
     _engineViewModel       = engineViewModel;
     Model.PropertyChanged += ModelPropertyChanged;
     if (@event.EventType == TEventType.Container)
     {
         EventRightsEditViewmodel = new EventRightsEditViewmodel(@event, engineViewModel.Engine.AuthenticationService);
         EventRightsEditViewmodel.ModifiedChanged += RightsModifiedChanged;
     }
     CommandSaveEdit         = new UiCommand(o => Save(), _canSave);
     CommandUndoEdit         = new UiCommand(o => UndoEdit(), o => IsModified);
     CommandChangeMovie      = new UiCommand(_changeMovie, _canChangeMovie);
     CommandEditMovie        = new UiCommand(_editMovie, _canEditMovie);
     CommandCheckVolume      = new UiCommand(_checkVolume, _canCheckVolume);
     CommandTriggerStartType = new UiCommand
                               (
         _triggerStartType,
         _canTriggerStartType
                               );
     CommandMoveUp = new UiCommand
                     (
         o => Model.MoveUp(),
         o => Model.CanMoveUp()
                     );
     CommandMoveDown = new UiCommand
                       (
         o => Model.MoveDown(),
         o => Model.CanMoveDown()
                       );
     CommandDelete = new UiCommand
                     (
         async o =>
     {
         if (MessageBox.Show(resources._query_DeleteItem, resources._caption_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK)
         {
             return;
         }
         await EventClipboard.SaveUndo(new List <IEvent> {
             Model
         },
                                       Model.StartType == TStartType.After ? Model.Prior : Model.Parent);
         Model.Delete();
     },
         o => Model.AllowDelete()
                     );
     if (@event is ITemplated templated)
     {
         TemplatedEditViewmodel = new TemplatedEditViewmodel(templated, true, true, engineViewModel.VideoFormat);
         TemplatedEditViewmodel.ModifiedChanged += TemplatedEditViewmodel_ModifiedChanged;
     }
 }
コード例 #8
0
 public ChannelViewmodel(IEngine engine, bool showEngine, bool showMedia)
 {
     DisplayName = engine.EngineName;
     if (showEngine)
     {
         Engine = new EngineViewmodel(engine, engine);
     }
     if (showMedia)
     {
         MediaManager = new MediaManagerViewmodel(engine, engine.HaveRight(EngineRight.Preview) ? engine : null);
     }
     CommandSwitchTab = new UiCommand(o => SelectedTabIndex = _selectedTabIndex == 0 ? 1 : 0, o => showEngine && showMedia);
     SelectedTabIndex = showEngine ? 0 : 1;
 }
コード例 #9
0
 public ChannelViewmodel(IEngine engine, bool showEngine, bool showMedia, bool allowPlayControl)
 {
     _channelName = engine.EngineName;
     if (showEngine)
     {
         Engine = new EngineViewmodel(engine, engine, allowPlayControl);
     }
     if (showMedia)
     {
         MediaManager = new MediaManagerViewmodel(engine.MediaManager, engine);
     }
     CommandSwitchTab = new UICommand {
         ExecuteDelegate = o => SelectedTabIndex = _selectedTabIndex == 0 ? 1 : 0, CanExecuteDelegate = o => showEngine && showMedia
     };
     SelectedTabIndex = showEngine ? 0 : 1;
 }
コード例 #10
0
 private EventPanelViewmodelBase _addRootEvent(IEvent e)
 {
     if (!e.IsDeleted)
     {
         EngineViewmodel evm    = _engineViewmodel;
         var             newEvm = CreateChildEventPanelViewmodelForEvent(e);
         _childrens.Add(newEvm);
         IEvent ne = e.Next;
         while (ne != null)
         {
             _childrens.Add(CreateChildEventPanelViewmodelForEvent(ne));
             Debug.WriteLine(ne, "Reading next for");
             ne = ne.Next;
         }
         return(newEvm);
     }
     return(null);
 }
コード例 #11
0
 /// <summary>
 /// Constructor for child events
 /// </summary>
 /// <param name="aEvent"></param>
 /// <param name="parent"></param>
 protected EventPanelViewmodelBase(IEvent aEvent, EventPanelViewmodelBase parent)
 {
     if (aEvent == null) // dummy child
     {
         return;
     }
     Engine       = aEvent.Engine;
     _videoFormat = Engine.VideoFormat;
     Event        = aEvent;
     if (parent != null)
     {
         _parent         = parent;
         Root            = parent.Root;
         EngineViewmodel = parent.EngineViewmodel;
         Level           = parent.Level + 1;
         if (aEvent.SubEventsCount > 0)
         {
             Childrens.Add(DummyChild);
         }
     }
     Event.PropertyChanged += OnEventPropertyChanged;
 }
コード例 #12
0
 /// <summary>
 /// Constructor for child events
 /// </summary>
 /// <param name="aEvent"></param>
 /// <param name="parent"></param>
 protected EventPanelViewmodelBase(IEvent aEvent, EventPanelViewmodelBase parent) : base()
 {
     if (aEvent == null) // dummy child
     {
         return;
     }
     _engine      = aEvent.Engine;
     _videoFormat = _engine.VideoFormat;
     _event       = aEvent;
     if (parent != null)
     {
         _parent          = parent;
         _root            = parent._root;
         _engineViewmodel = parent._engineViewmodel;
         _level           = (_parent == null) ? 0 : _parent._level + 1;
         if (aEvent.SubEventsCount > 0)
         {
             _childrens.Add(DummyChild);
         }
     }
     _event.PropertyChanged += OnEventPropertyChanged;
     _event.SubEventChanged += OnSubeventChanged;
     _event.Relocated       += OnRelocated;
 }
コード例 #13
0
 private void _addSubMovie(object obj)
 {
     EngineViewmodel.AddMediaEvent(Event, TStartType.WithParent, TMediaType.Movie, VideoLayer.Program, false);
 }
コード例 #14
0
 private void _addSubRundown(object obj)
 {
     EngineViewmodel.AddSimpleEvent(Event, TEventType.Rundown, true);
 }
コード例 #15
0
 private void _addSubLive(object obj)
 {
     EngineViewmodel.AddSimpleEvent(Event, TEventType.Live, true);
 }
コード例 #16
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)
            };
        }
コード例 #17
0
        public EventEditViewmodel(IEvent @event, EngineViewmodel engineViewModel) : base(@event)
        {
            _engineViewModel       = engineViewModel;
            Model.PropertyChanged += ModelPropertyChanged;
            if (@event.EventType == TEventType.Container)
            {
                EventRightsEditViewmodel = new EventRightsEditViewmodel(@event, engineViewModel.Engine.AuthenticationService);
                EventRightsEditViewmodel.ModifiedChanged += RightsModifiedChanged;
            }
            Router     = engineViewModel.Router;
            InputPorts = new List <object>();

            if (Router != null)
            {
                InputPorts.Add(string.Empty); //default value in ComboBox
                foreach (var input in Router.InputPorts)
                {
                    InputPorts.Add(input);
                }
                _selectedInputPort = InputPorts?.FirstOrDefault(param => param is IRouterPort routerPort && routerPort.PortId == _routerPort) ?? InputPorts?[0];
            }

            if (@event.EventType == TEventType.Live && Model.Engine.MediaManager.Recorders.Count() > 0)
            {
                RecordingInfoViewmodel = new RecordingInfoViewModel(@event.Engine, @event.RecordingInfo);
                RecordingInfoViewmodel.ModifiedChanged += RecordingInfoViewmodel_ModifiedChanged;
            }

            CommandSaveEdit         = new UiCommand(o => Save(), o => CanSave);
            CommandUndoEdit         = new UiCommand(o => UndoEdit(), o => IsModified);
            CommandChangeMovie      = new UiCommand(_changeMovie, _canChangeMovie);
            CommandEditMovie        = new UiCommand(_editMovie, _canEditMovie);
            CommandCheckVolume      = new UiCommand(_checkVolume, _canCheckVolume);
            CommandTriggerStartType = new UiCommand
                                      (
                _triggerStartType,
                _canTriggerStartType
                                      );
            CommandMoveUp = new UiCommand
                            (
                o => Model.MoveUp(),
                o => Model.CanMoveUp()
                            );
            CommandMoveDown = new UiCommand
                              (
                o => Model.MoveDown(),
                o => Model.CanMoveDown()
                              );
            CommandDelete = new UiCommand
                            (
                async o =>
            {
                if (MessageBox.Show(resources._query_DeleteItem, resources._caption_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK)
                {
                    return;
                }
                await EventClipboard.SaveUndo(new List <IEvent> {
                    Model
                },
                                              Model.StartType == TStartType.After ? Model.Prior : Model.Parent);
                Model.Delete();
            },
                o => Model.HaveRight(EventRight.Delete) && Model.AllowDelete()
                            );
            if (@event is ITemplated templated)
            {
                TemplatedEditViewmodel = new TemplatedEditViewmodel(templated, true, true, engineViewModel.VideoFormat);
                TemplatedEditViewmodel.ModifiedChanged += TemplatedEditViewmodel_ModifiedChanged;
            }
        }
コード例 #18
0
 public EventPanelRootViewmodel(EngineViewmodel engineViewmodel) : base(engineViewmodel)
 {
     Engine.EventLocated += _onEngineEventLocated;
     Engine.EventDeleted += _engine_EventDeleted;
     AddRootEvents();
 }