Exemplo n.º 1
0
 protected override void Update(object destObject = null)
 {
     base.Update(Model);
     EventRightsEditViewmodel?.Save();
     TemplatedEditViewmodel?.Save();
     Model.Save();
 }
Exemplo n.º 2
0
 public void UndoEdit()
 {
     RecordingInfoViewmodel?.Load();
     TemplatedEditViewmodel?.UndoEdit();
     EventRightsEditViewmodel?.UndoEdit();
     Load();
 }
Exemplo n.º 3
0
 protected override void Update(object destObject = null)
 {
     Model.RecordingInfo = RecordingInfoViewmodel?.GetRecordingInfo();
     base.Update(Model);
     EventRightsEditViewmodel?.Save();
     TemplatedEditViewmodel?.Save();
     Model.Save();
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
0
 public void UndoEdit()
 {
     TemplatedEditViewmodel?.UndoEdit();
     EventRightsEditViewmodel?.UndoEdit();
     Load();
 }
Exemplo n.º 6
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;
            }
        }