コード例 #1
0
 public bool AllowDelete()
 {
     if ((_playState == TPlayState.Fading || _playState == TPlayState.Paused || _playState == TPlayState.Playing) &&
         (_eventType == TEventType.Live || _eventType == TEventType.Movie || _eventType == TEventType.Rundown))
     {
         return(false);
     }
     if (_eventType == TEventType.Container && SubEvents.Any())
     {
         return(false);
     }
     foreach (IEvent se in this.SubEvents)
     {
         IEvent ne = se;
         while (ne != null)
         {
             if (!ne.AllowDelete())
             {
                 return(false);
             }
             ne = ne.Next;
         }
     }
     return(true);
 }
コード例 #2
0
 public EventEditViewmodel(EngineViewmodel engineViewModel)
 {
     _engineViewModel           = engineViewModel;
     _engine                    = engineViewModel.Engine;
     _engine.EventLocated      += OnLocated;
     _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 List <IEvent> {
                     _event
                 },
                                         _event.StartType == TStartType.After ? _event.Prior : _event.Parent);
                 _event.Delete();
             }
         },
         CanExecuteDelegate = o => _event?.AllowDelete() == true
     };
 }