/// <summary> /// Initializes a new instance of the <see cref="BaseCommentsBarPresenter"/> class. /// </summary> /// <param name="view">Instance of the <see cref="ICommentsBarView"/> interface.</param> /// <param name="eventAggregator">Instance of the <see cref="IEventAggregator"/> interface.</param> /// <param name="sequenceRegistry">Instance of the <see cref="ISequenceRegistry"/> interface.</param> /// /// <param name="timelineBarRegistry">Instance of the <see cref="ITimelineBarRegistry"/> interface.</param> protected BaseCommentsBarPresenter(ICommentsBarView view, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, ITimelineBarRegistry timelineBarRegistry) { this.eventAggregator = eventAggregator; this.sequenceRegistry = sequenceRegistry; this.sequenceRegistry.CurrentSequenceChanged += this.HandleCurrentSequenceChanged; this.timelineBarRegistry = timelineBarRegistry; this.View = view; if (this.sequenceRegistry.CurrentSequenceModel != null) { this.sequenceRegistry.CurrentSequenceModel.PropertyChanged += this.OnCurrentSequenceOnPropertyChanged; this.View.SetDuration(this.sequenceRegistry.CurrentSequenceModel.Duration); } this.timelineBarElements = new List <ITimelineBarElementModel>(); this.Options = new List <string>(); this.OptionSelectedCommand = new DelegateCommand <string>(this.AddSelectedOption); this.CloseCommand = new DelegateCommand <object>(this.CloseOptionsMenu); this.eventAggregator.GetEvent <PositionDoubleClickedEvent>().Subscribe(this.AddPreview, ThreadOption.PublisherThread, true, this.FilterPositionDoubleClickedEvent); this.eventAggregator.GetEvent <RefreshElementsEvent>().Subscribe(this.RefreshPreviews, ThreadOption.PublisherThread, true, this.FilterRefreshElements); this.eventAggregator.GetEvent <AddPreviewEvent>().Subscribe( this.AddPreview, ThreadOption.UIThread, true, this.FilterAddPreviewEvent); this.eventAggregator.GetEvent <RemovePreviewEvent>().Subscribe(this.RemovePreview, ThreadOption.UIThread, true, this.FilterRemovePreviewEvent); this.eventAggregator.GetEvent <DeleteAllPreviewsEvent>().Subscribe(this.DeleteAllPreviews, ThreadOption.PublisherThread, true, this.FilterDeleteAllPreviewsEvent); this.View.Model = this; }
public AdEditBoxPresentationModel(IAdEditBox view, IAdViewPreview preview, IConfigurationService configurationService, ISequenceRegistry sequenceRegistry) { this.View = view; this.preview = preview; this.configurationService = configurationService; this.sequenceRegistry = sequenceRegistry; this.CloseCommand = new DelegateCommand <object>(this.Close); this.SaveCommand = new DelegateCommand <object>(this.Save, this.CanSave); this.DeleteCommand = new DelegateCommand <object>(this.Delete); this.TemplateTypes = this.ParseTemplateTypes(); if (this.TemplateTypes.Count > 0) { this.SelectedTemplateType = this.TemplateTypes[0]; } this.adOpportunity = new AdOpportunity { TemplateType = this.SelectedTemplateType }; this.sequenceRegistry.CurrentSequence.AdOpportunities.Add(this.adOpportunity); this.View.Model = this; this.preview.Model = this; }
public SequencesViewModel(ISequencesView view, IProjectService projectService, ISequenceRegistry sequenceRegistry) { this.ChangeCurrentSequenceCommand = new DelegateCommand <object>(this.ChangeCurrentSequence); this.projectService = projectService; this.sequenceRegistry = sequenceRegistry; this.Sequences = this.GetSequencesFromProject(); this.projectService.ProjectRetrieved += this.RefreshSequences; this.view = view; this.view.SetViewModel(this); }
/// <summary> /// Initializes a new instance of the <see cref="CommentViewPresentationModel"/> class. /// </summary> /// <param name="view">The <see cref="ICommentView"/>.</param> /// <param name="eventAggregator">The event aggregator.</param> /// <param name="configurationService">The configuration service.</param> /// <param name="projectService">The project service.</param> /// <param name="sequenceRegistry">The seqeunce registry.</param> /// <param name="regionManager">The <see cref="IRegionManager"/> to activate the comment view.</param> /// <param name="thumbnailService">The <see cref="IThumbnailService"/> used to retrieve thumbnails.</param> public CommentViewPresentationModel( ICommentView view, IEventAggregator eventAggregator, IConfigurationService configurationService, IProjectService projectService, ISequenceRegistry sequenceRegistry, IRegionManager regionManager, IThumbnailService thumbnailService) { this.eventAggregator = eventAggregator; this.configurationService = configurationService; this.projectService = projectService; this.sequenceRegistry = sequenceRegistry; this.regionManager = regionManager; this.thumbnailService = thumbnailService; this.View = view; this.currentComment = new Comment(Guid.Empty); this.searchCommand = new DelegateCommand <string>(this.Search); this.deleteCommand = new DelegateCommand <object>(this.Delete); this.saveCommand = new DelegateCommand <Guid>(this.Save); this.cancelCommand = new DelegateCommand <string>(this.Cancel); this.editCommand = new DelegateCommand <object>(this.Edit); this.playCommentCommand = new DelegateCommand <object>(this.PlayComment); this.KeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.ExecuteKeyboardAction, this.CanExecuteKeyboardAction); this.EditMode = false; this.InkCommentStrokes = new StrokeCollection(); this.ShowGlobalComments = true; this.ShowTimelineComments = true; this.commentDuration = this.configurationService.GetCommentDuration() ?? DefaultCommentDuration; this.eventAggregator.GetEvent <ElementMovedEvent>().Subscribe(this.MoveComments, true); this.eventAggregator.GetEvent <DisplayMarkerBrowserWindowEvent>().Subscribe(this.DisplayView, ThreadOption.PublisherThread, true, this.FilterDisplayMarkerBrowserWindowEvent); this.eventAggregator.GetEvent <ResetWindowsEvent>().Subscribe(this.ResetWindow); this.CommentsTypes = this.GetCommentTypes(); this.PropertyChanged += this.CommentViewPresentationModel_PropertyChanged; if (sequenceRegistry.CurrentSequenceModel != null) { this.sequenceRegistry.CurrentSequence.CommentElements.CollectionChanged += this.CommentElements_CollectionChanged; this.sequenceRegistry.CurrentSequenceModel.ElementRemoved += this.OnCurrentSequenceOnElementRemoved; } this.sequenceRegistry.CurrentSequenceChanged += this.HandleCurrentSequenceChanged; this.LoadComments(); this.View.Model = this; }
public PlayByPlayDisplayBoxPresentationModel(IPlayByPlayDisplayBox view, IPlayByPlayViewPreview preview, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator) { this.View = view; this.preview = preview; this.sequenceRegistry = sequenceRegistry; this.eventAggregator = eventAggregator; this.CloseCommand = new DelegateCommand <object>(this.Close); this.playByPlay = new PlayByPlay(0); this.View.Model = this; this.preview.Model = this; }
public MarkersListViewModel( IMarkersListView view, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator, IRegionManager regionManager) { this.sequenceRegistry = sequenceRegistry; this.sequenceRegistry.CurrentSequenceChanged += this.CurrentSequenceChanged; this.view = view; this.LoadMarkers(); this.view.SetViewModel(this); this.regionManager = regionManager; eventAggregator.GetEvent <DisplayMarkerBrowserWindowEvent>().Subscribe(this.DisplayView, ThreadOption.PublisherThread, true, this.FilterDisplayMarkerBrowserWindowEvent); }
public MarkerEditBoxPresentationModel(IMarkerEditBox view, IMarkerViewPreview preview, ISequenceRegistry sequenceRegistry) { this.View = view; this.preview = preview; this.sequenceRegistry = sequenceRegistry; this.CloseCommand = new DelegateCommand <object>(this.Close); this.SaveCommand = new DelegateCommand <object>(this.Save, this.CanSave); this.DeleteCommand = new DelegateCommand <object>(this.Delete); this.marker = new Marker(); this.sequenceRegistry.CurrentSequence.Markers.Add(this.marker); this.View.Model = this; this.preview.Model = this; }
public ManifestMediaModel( IOutputServiceFacade outputServiceFacade, [Dependency("PrimaryCache")] ICache primaryCache, ISequenceRegistry sequenceRegistry, IPersistenceService persistenceService, Func <ITransitionsManager> transitionsManagerFactory, Func <IRubberBandingManager> rubberBandingManagerFactory, IConfigurationService configurationService) { this.outputServiceFacade = outputServiceFacade; this.primaryCache = primaryCache; this.sequenceRegistry = sequenceRegistry; this.persistenceService = persistenceService; this.outputServiceFacade.PersistManifestCompleted += this.OnPersistManifestCompleted; this.mediaDataByTrackId = new Dictionary <int, ManifestPlayableMediaData>(); this.maxNumberOfAudioTracks = configurationService.GetParameterValueAsInt("MaxNumberOfAudioTracks").GetValueOrDefault(1); this.transitionsManagers = new List <ITransitionsManager>(); this.rubberBandingManagers = new List <IRubberBandingManager>(); for (int i = 0; i < this.maxNumberOfAudioTracks + 1; i++) { ITransitionsManager transitionsManager = transitionsManagerFactory(); IRubberBandingManager rubberBandingManager = rubberBandingManagerFactory(); transitionsManager.IsAudioOnly = i != 0; VolumeOrchestrator.Bind(transitionsManager, rubberBandingManager); this.transitionsManagers.Add(transitionsManager); this.rubberBandingManagers.Add(rubberBandingManager); } this.InitializeMediaData(); this.SetPluginForManagers(); this.SubcribeToPlayingStateChanged(); this.pendingPersists = new List <int>(); this.timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(UtilityHelper.PositionUpdateIntervalMillis) }; this.timer.Tick += this.OnFrameRendered; this.timer.Start(); }
public AdsListViewPresentationModel( IAdsListView view, ISequenceRegistry sequenceRegistry, IRegionManager regionManager, IEventAggregator eventAggregator) { this.sequenceRegistry = sequenceRegistry; this.sequenceRegistry.CurrentSequenceChanged += this.CurrentSequenceChanged; eventAggregator.GetEvent <DisplayMarkerBrowserWindowEvent>().Subscribe(this.DisplayView, ThreadOption.PublisherThread, true, this.FilterDisplayMarkerBrowserWindowEvent); this.regionManager = regionManager; this.View = view; this.LoadAds(); this.View.Model = this; }
public SequenceMetadataViewModel(ISequenceMetadataView sequenceMetadataView, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator, IRegionManager regionManager) { this.sequenceRegistry = sequenceRegistry; this.eventAggregator = eventAggregator; this.DisplayCommentsCommand = new DelegateCommand <object>(this.DisplayComments); this.DisplayAdsCommand = new DelegateCommand <object>(this.DisplayAds); this.DisplayMarkersCommand = new DelegateCommand <object>(this.DisplayMarkers); this.RegisterSequencePropertyChangedHandlers(); this.sequenceRegistry.CurrentSequenceChanged += this.CurrentSequenceChanged; this.View = sequenceMetadataView; this.regionManager = regionManager; this.View.SetViewModel(this); }
public PlaybackManifestGenerator( ISequenceRegistry sequenceRegistry, IConfigurationService configurationSettings, IUserSettingsService userSettingsService) { this.dispatcher = Application.Current.RootVisual.Dispatcher; this.sequenceRegistry = sequenceRegistry; this.userSettingsService = userSettingsService; this.streamsByUri = new Dictionary <Uri, Stream>(); this.pendingDownloads = new List <Uri>(); this.downloaderManager = new RCE.Infrastructure.Services.DownloaderManager(); this.downloaderManager.DownloadCompleted += this.OnManifestDownloadCompleted; this.treatGapsAsError = configurationSettings.GetTreatGapAsError(); if (!this.treatGapsAsError) { this.GetGapAttributesFromUserSettings(configurationSettings); } }
public ProjectBrowserViewModel(IProjectBrowserView projectBrowserView, IProjectService projectService, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator, Func <IErrorView> errorViewResolver, IConfigurationService configurationService) { this.NewSequenceCommand = new DelegateCommand <object>(this.CreateNewSequence); this.SaveProjectCommand = new DelegateCommand <object>(this.SaveProject); this.handleKeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.HandleKeyboardAction); this.projectService = projectService; this.sequenceRegistry = sequenceRegistry; this.errorViewResolver = errorViewResolver; eventAggregator.GetEvent <StatusEvent>().Subscribe(this.UpdateStatus); eventAggregator.GetEvent <ResetWindowsEvent>().Subscribe(this.ResetWindow); this.eventAggregator = eventAggregator; this.projectService.ProjectRetrieved += this.HandleProjectChange; this.projectService.ProjectSaved += this.HandleProjectChange; projectBrowserView.SetViewModel(this); this.treatGapAsErrors = configurationService.GetTreatGapAsError(); this.View = projectBrowserView; }
public PlayByPlayBoxesPresentationModel(IPlayByPlayDisplayBox displayView, IPlayByPlayEditBox editView, IPlayByPlayViewPreview preview, ISequenceRegistry sequenceRegistry, IEventAggregator eventAggregator) { this.DisplayView = displayView; this.EditView = editView; this.preview = preview; this.sequenceRegistry = sequenceRegistry; this.eventAggregator = eventAggregator; this.CloseCommand = new DelegateCommand <object>(this.Close); this.SaveCommand = new DelegateCommand <object>(this.Save, this.CanSave); this.DeleteCommand = new DelegateCommand <object>(this.Delete); this.playByPlay = new RCE.Services.Contracts.PlayByPlay(0); this.DisplayView.Model = this; this.EditView.Model = this; this.preview.Model = this; }
/// <summary> /// Initializes a new instance of the <see cref="CommentsBarPresenter"/> class. /// </summary> /// <param name="view">Instance of the <see cref="ICommentsBarView"/> interface.</param> /// <param name="eventAggregator">Instance of the <see cref="IEventAggregator"/> interface.</param> /// <param name="timelineModel">Instance of the <see cref="ISequenceModel"/> interface.</param> public CommentsBarPresenter(ICommentsBarView view, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, ITimelineBarRegistry timelineBarRegistry) { this.eventAggregator = eventAggregator; this.sequenceRegistry = sequenceRegistry; this.sequenceRegistry.CurrentSequenceChanged += this.HandleCurrentSequenceChanged; this.sequenceRegistry.CurrentSequenceModel.PropertyChanged += this.OnCurrentSequenceOnPropertyChanged; this.timelineBarRegistry = timelineBarRegistry; this.View = view; this.View.SetDuration(this.sequenceRegistry.CurrentSequenceModel.Duration); this.timelineBarElements = new List <ITimelineBarElementModel>(); this.Options = new List <string>(); this.OptionSelectedCommand = new DelegateCommand <string>(this.AddSelectedOption); this.CloseCommand = new DelegateCommand <object>(this.CloseOptionsMenu); this.eventAggregator.GetEvent <PositionDoubleClickedEvent>().Subscribe(this.AddPreview, true); this.eventAggregator.GetEvent <RefreshElementsEvent>().Subscribe(this.RefreshPreviews, true); this.eventAggregator.GetEvent <AddPreviewEvent>().Subscribe(this.AddPreview, true); this.View.Model = this; }
public CommentEditBoxPresentationModel(ICommentEditBox view, ICommentViewPreview preview, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, IConfigurationService configurationService) { this.View = view; this.preview = preview; this.eventAggregator = eventAggregator; this.configurationService = configurationService; this.sequenceRegistry = sequenceRegistry; this.sequenceRegistry.CurrentSequence.CommentElements.CollectionChanged += this.CommentElements_CollectionChanged; this.preview.SetTimelineDuration(this.sequenceRegistry.CurrentSequenceModel.Duration); this.CloseCommand = new DelegateCommand <object>(this.Close); this.SaveCommand = new DelegateCommand <string>(this.Save, this.CanSave); this.DeleteCommand = new DelegateCommand <object>(this.Delete); this.PlayCommand = new DelegateCommand <object>(this.PlayComment); this.KeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.ExecuteKeyboardAction, this.CanExecuteKeyboardAction); this.comment = this.CreateComment(); this.sequenceRegistry.CurrentSequence.AddComment(this.comment); this.eventAggregator.GetEvent <CommentUpdatedEvent>().Subscribe(x => this.UpdateComment(), ThreadOption.PublisherThread, true, x => this.comment == x); this.View.Model = this; this.preview.Model = this; }
/// <summary> /// Initializes a new instance of the <see cref="PlayerViewPresenter"/> class. /// </summary> /// <param name="view">The <see cref="IPlayerView"/> instance as view.</param> /// <param name="eventAggregator">The event aggregator.</param> /// <param name="sequenceRegistry"></param> /// <param name="playbackManifestGenerator"></param> /// <param name="manifestMediaModel"></param> /// <param name="overlaysManager"></param> /// <param name="overlaysDisplayController"></param> /// <param name="configurationService"></param> public PlayerViewPresenter(IPlayerView view, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, IPlaybackManifestGenerator playbackManifestGenerator, IManifestMediaModel manifestMediaModel, IOverlaysManager overlaysManager, IOverlaysDisplayController overlaysDisplayController, IConfigurationService configurationService) { this.PropertyChanged += this.PlayerViewPresenter_PropertyChanged; this.PlayerMode = PlayerMode.Timeline; this.maxNumberOfAudioTracks = configurationService.GetParameterValueAsInt("MaxNumberOfAudioTracks").GetValueOrDefault(1); this.playbackManifestGenerator = playbackManifestGenerator; this.manifestMediaModel = manifestMediaModel; this.overlaysManager = overlaysManager; this.overlaysDisplayController = overlaysDisplayController; this.manifestMediaModel.PlayingStateChanged += this.OnPlayingStateChanged; this.manifestMediaModel.PositionUpdated += this.OnPositionUpdated; this.manifestMediaModel.FinishedPlaying += this.OnManifestMediaModelPlayFinished; this.manifestMediaModel.MediaElementFailed += this.OnManifestMediaModelMediaElementFailed; this.eventAggregator = eventAggregator; this.configurationService = configurationService; this.sequenceRegistry = sequenceRegistry; this.eventAggregator.GetEvent <KeyMappingEvent>().Subscribe(this.OnKeyAction, ThreadOption.PublisherThread, true, Filter); this.eventAggregator.GetEvent <SmpteTimeCodeChangedEvent>().Subscribe(this.UpdateSmpteFrameRate, true); this.eventAggregator.GetEvent <AspectRatioChangedEvent>().Subscribe(this.UpdatePlayerAspectRatio, true); this.eventAggregator.GetEvent <PauseEvent>().Subscribe(this.OnPauseEventPublished, true); this.eventAggregator.GetEvent <PlayEvent>().Subscribe(this.OnPlayEventPublished, true); this.eventAggregator.GetEvent <PlayerEvent>().Subscribe(this.OnPlayerEventPublished, true); this.eventAggregator.GetEvent <PlayheadMovedEvent>().Subscribe(this.UpdatePosition, true); this.eventAggregator.GetEvent <PlayCommentEvent>().Subscribe(this.PlayComment, ThreadOption.PublisherThread, true, CanPlayComment); this.eventAggregator.GetEvent <PickThumbnailEvent>().Subscribe(this.PickProjectThumbnail, true); this.eventAggregator.GetEvent <OperationUndoneInTimelineEvent>().Subscribe(this.OperationUndone, true); this.eventAggregator.GetEvent <OperationExecutedInTimelineEvent>().Subscribe(this.OperationExecuted, true); this.eventAggregator.GetEvent <ShowPreviewOverlayEvent>().Subscribe(this.ShowOverlayPreview, true); this.eventAggregator.GetEvent <HidePreviewOverlayEvent>().Subscribe(this.HideOverlayPreview, true); this.eventAggregator.GetEvent <ResetWindowsEvent>().Subscribe(this.ResetWindow); this.eventAggregator.GetEvent <RubberBandingStateChangedEvent>().Subscribe(this.ToggleRubberBanding, true); this.eventAggregator.GetEvent <CheckedTreatGapAsErrorEvent>().Subscribe(this.UpdateTreatGapAsErrorValue, true); this.eventAggregator.GetEvent <TrackMuteStateChangedEvent>().Subscribe(this.ToggleTrackMute, true); this.frameRewindForwardTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) }; this.frameRewindForwardTimer.Tick += this.FrameRewindForwardTimerTick; this.FastRewindCommand = new DelegateCommand <object>(this.FastRewind, this.CanFastRewindForward); this.FastForwardCommand = new DelegateCommand <object>(this.FastForward, this.CanFastRewindForward); this.MoveToStartCommand = new DelegateCommand <object>(this.MoveToStart); this.MoveToEndCommand = new DelegateCommand <object>(this.MoveToEnd); this.MediaRepeatCommand = new DelegateCommand <object>(this.ToggleLoopPlayback); this.MuteCommand = new DelegateCommand <object>(this.MutePlayer); this.AddTimelineElementCommand = new DelegateCommand <object>(this.AddTimelineElementAtCurrentPosition); this.KeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.ExecuteKeyboardAction); this.View = view; this.View.Model = this; var visualMediaPlugin = this.manifestMediaModel.GetVisualMediaData().MediaPlugin; this.overlaysManager.SetAdaptivePlugin(visualMediaPlugin as IAdaptiveMediaPlugin); this.overlaysDisplayController.OverlaysContainer = this.View.OverlaysContainer; this.overlaysManager.OverlayBeginReached += this.overlaysDisplayController.ShowOverlay; this.overlaysManager.OverlayEndReached += this.overlaysDisplayController.HideOverlay; this.overlaysManager.OverlayBeginSeeked += this.overlaysDisplayController.ShowStaticOverlay; visualMediaPlugin.SeekCompleted += this.overlaysDisplayController.PluginSeekCompleted; visualMediaPlugin.CurrentStateChanged += this.overlaysDisplayController.OnPlayerStateChangedHandler; this.manifestMediaModel.InvokeMethodForAllMediaData(md => this.View.AddElement(md, 512, 288)); this.View.AddOverlaysSupport(); this.UpdateSmpteFrameRate(SmpteFrameRate.Smpte2997NonDrop); this.View.FullScreenChanged += this.View_FullScreenChanged; this.View.PlayClicked += (sender, e) => this.TogglePlay(); this.View.PauseClicked += (sender, e) => this.TogglePlay(); this.View.FrameRewindStarted += (sender, e) => this.StartFrameRewindForward(-1); this.View.FrameRewindEnded += (sender, e) => this.EndFrameForwardRewind(); this.View.FrameForwardStarted += (sender, e) => this.StartFrameRewindForward(1); this.View.FrameForwardEnded += (sender, e) => this.EndFrameForwardRewind(); this.View.PickThumbnailClicked += (sender, e) => this.PickSequenceThumbnail(null); this.View.SlowMotionClicked += (sender, e) => this.ToggleSlowMotion(); this.TreatGapAsErrors = this.configurationService.GetTreatGapAsError(); HtmlPage.RegisterScriptableObject("Player", this); }
public TimelineCommentsBarPresenter(ICommentsBarView view, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, ITimelineBarRegistry timelineBarRegistry) : base(view, eventAggregator, sequenceRegistry, timelineBarRegistry) { }
public SubClipCommentsBarPresenter(ICommentsBarView view, IEventAggregator eventAggregator, ISequenceRegistry sequenceRegistry, ITimelineBarRegistry timelineBarRegistry) : base(view, eventAggregator, sequenceRegistry, timelineBarRegistry) { eventAggregator.GetEvent <DurationChangedEvent>().Subscribe(this.OnDurationChanged, ThreadOption.PublisherThread, false); this.View.SetEditBoxMargins(0, -93, 0, 0); this.View.SetEditBoxZeeIndex(1000); }