예제 #1
0
 /// <summary>
 /// Load a TimelineEvent to the player to start playing it. The EventsController should be the responsible
 /// to Add the Events to the player
 /// </summary>
 /// <param name="viewModel">RATimelineEventVM ViewModel</param>
 /// <param name="playing">If set to <c>true</c> playing. Else starts paused</param>
 public void LoadEvent(TimelineEventVM viewModel, bool playing)
 {
     App.Current.EventsBroker.Publish(new LoadTimelineEventEvent <TimelineEventVM> {
         Object  = viewModel,
         Playing = playing
     });
 }
예제 #2
0
 void HandleEditPlay(TimelineEventVM eventVM)
 {
     App.Current.EventsBroker.Publish(
         new EditEventEvent {
         TimelineEvent = eventVM
     }
         );
 }
예제 #3
0
 void RemoveTimelineEventVM(TimelineEventVM viewModel)
 {
     foreach (Player player in viewModel.Model.Players)
     {
         if (playerToTimeline.ContainsKey(player))
         {
             playerToTimeline [player].ViewModels.Remove(viewModel);
         }
     }
     eventTypeToTimeline [viewModel.Model.EventType].ViewModels.Remove(viewModel);
 }
예제 #4
0
 void AddToPlayersTimeline(TimelineEventVM timelineEvent)
 {
     foreach (Player player in timelineEvent.Players)
     {
         if (!playerToTimeline.ContainsKey(player))
         {
             // FIXME: We are calling this a thousand times. This fix works because the first times
             // we don't have the teams, but the next ones we do. We should call this only when we do.
             continue;
         }
         playerToTimeline [player].ViewModels.Add(timelineEvent);
     }
 }
예제 #5
0
        /// <summary>
        /// Compare the specified TimelineEventVM with the calling one.
        /// </summary>
        /// <returns>The compare result.</returns>
        /// <param name="evt">Timeline event to be compared with.</param>
        public int CompareTo(object evt)
        {
            int             ret;
            TimelineEventVM timelineEventB = evt as TimelineEventVM;

            switch (Model.EventType.SortMethod)
            {
            case (SortMethodType.SortByName):
                ret = string.Compare(Name, timelineEventB.Name);
                if (ret == 0)
                {
                    ret = (Duration - timelineEventB.Duration).MSeconds;
                }
                break;

            case (SortMethodType.SortByStartTime):
                ret = (Start - timelineEventB.Start).MSeconds;
                if (ret == 0)
                {
                    ret = string.Compare(Name, timelineEventB.Name);
                }
                break;

            case (SortMethodType.SortByStopTime):
                ret = (Stop - timelineEventB.Stop).MSeconds;
                if (ret == 0)
                {
                    ret = string.Compare(Name, timelineEventB.Name);
                }
                break;

            case (SortMethodType.SortByDuration):
                ret = (Duration - timelineEventB.Duration).MSeconds;
                if (ret == 0)
                {
                    ret = string.Compare(Name, timelineEventB.Name);
                }
                break;

            default:
                return(0);
            }
            if (ret == 0)
            {
                ret = timelineEventB.GetHashCode() - GetHashCode();
            }
            return(ret);
        }
예제 #6
0
        void FullTimeline_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            TimelineEventVM timelineEvent = sender as TimelineEventVM;

            if (timelineEvent != null && e.PropertyName == $"Collection_{nameof (TimelineEvent.Players)}")
            {
                // It's a bit faster to remove all the existing events and add them again in AddToPlayersTimeline
                // than traversing the whole tree to add only the new ones.
                foreach (PlayerTimelineVM timeline in playerToTimeline.Values)
                {
                    if (timeline.ViewModels.Contains(timelineEvent))
                    {
                        timeline.ViewModels.Remove(timelineEvent);
                    }
                }
                AddToPlayersTimeline(timelineEvent);
            }
        }
예제 #7
0
        /// <summary>
        /// Loads a timeline event.
        /// The file set for this event comes from <see cref="e.Fileset"/>
        /// </summary>
        /// <param name="evt">The timeline event.</param>
        /// <param name="playing">If set to <c>true</c> playing.</param>
        public void LoadEvent(TimelineEventVM evt, bool playing)
        {
            LoadedElement = evt as IPlayable;

            if (evt?.Duration.MSeconds == 0)
            {
                // These events don't have duration, we start playing as if it was a seek
                Player.Switch(null, null, null);
                Player.UnloadCurrentEvent();
                Player.Seek(evt.EventTime, true);
                Player.Play();
            }
            else
            {
                if (evt != null)
                {
                    LoadEvent(evt, new Time(0), playing);
                }
                else if (Player != null)
                {
                    Player.UnloadCurrentEvent();
                }
            }
        }
예제 #8
0
        void AddToEventTypesTimeline(TimelineEventVM timelineEvent)
        {
            var timeline = FindTimelineForEventType(timelineEvent.EventType);

            timeline.ViewModels.Add(timelineEvent);
        }
예제 #9
0
 void AddTimelineEventVM(TimelineEventVM viewModel)
 {
     AddToEventTypesTimeline(viewModel);
     AddToPlayersTimeline(viewModel);
 }
예제 #10
0
 public PlaylistPlayElementVM(TimelineEventVM play) : this()
 {
     Play = play;
 }
예제 #11
0
 /// <summary>
 /// Loads a timeline event.
 /// The file set for this event comes from <see cref="e.Fileset"/>
 /// </summary>
 /// <param name="evt">The timeline event.</param>
 /// <param name="seekTime">Seek time.</param>
 /// <param name="playing">If set to <c>true</c> playing.</param>
 public void LoadEvent(TimelineEventVM evt, Time seekTime, bool playing)
 {
     LoadedElement = evt as IPlayable;
     Player.LoadEvent(evt, seekTime, playing);
 }