コード例 #1
0
 public void UndoEdit()
 {
     RecordingInfoViewmodel?.Load();
     TemplatedEditViewmodel?.UndoEdit();
     EventRightsEditViewmodel?.UndoEdit();
     Load();
 }
コード例 #2
0
 protected override void Update(object destObject = null)
 {
     base.Update(Model);
     EventRightsEditViewmodel?.Save();
     TemplatedEditViewmodel?.Save();
     Model.Save();
 }
コード例 #3
0
 public MediaEditViewmodel(IMedia media, IMediaManager mediaManager, bool showButtons) : base(media)
 {
     CommandSaveEdit = new UICommand {
         ExecuteDelegate = o => Save(), CanExecuteDelegate = o => CanSave()
     };
     CommandCancelEdit = new UICommand {
         ExecuteDelegate = _undoEdit, CanExecuteDelegate = o => IsModified
     };
     CommandRefreshStatus = new UICommand {
         ExecuteDelegate = _refreshStatus
     };
     CommandCheckVolume = new UICommand
     {
         ExecuteDelegate    = _checkVolume,
         CanExecuteDelegate = o => !_isVolumeChecking
     };
     _mediaManager          = mediaManager;
     ShowButtons            = showButtons;
     Model.PropertyChanged += OnMediaPropertyChanged;
     if (Model is ITemplated templated)
     {
         TemplatedEditViewmodel = new TemplatedEditViewmodel(templated, false, false, media.VideoFormat);
         TemplatedEditViewmodel.ModifiedChanged += TemplatedEditViewmodel_ModifiedChanged;
     }
 }
コード例 #4
0
 protected override void Update(object destObject = null)
 {
     Model.RecordingInfo = RecordingInfoViewmodel?.GetRecordingInfo();
     base.Update(Model);
     EventRightsEditViewmodel?.Save();
     TemplatedEditViewmodel?.Save();
     Model.Save();
 }
コード例 #5
0
 public void Save()
 {
     TemplatedEditViewmodel?.Save();
     if (FileName != Model.FileName)
     {
         Model.RenameFileTo(FileName);
     }
     Update(Model);
 }
コード例 #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;
     }
     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;
     }
 }
コード例 #7
0
 public void UndoEdit()
 {
     TemplatedEditViewmodel?.UndoEdit();
     EventRightsEditViewmodel?.UndoEdit();
     Load();
 }
コード例 #8
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;
            }
        }
コード例 #9
0
 public void Save()
 {
     TemplatedEditViewmodel?.Save();
     Update(Model);
 }