/// <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="timelineModel">The timeline model.</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, ITimelineModel timelineModel, IRegionManager regionManager, IThumbnailService thumbnailService) { this.eventAggregator = eventAggregator; this.configurationService = configurationService; this.projectService = projectService; this.timelineModel = timelineModel; 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.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.CommentsTypes = this.GetCommentTypes(); this.PropertyChanged += this.CommentViewPresentationModel_PropertyChanged; this.timelineModel.CommentElements.CollectionChanged += this.CommentElements_CollectionChanged; this.timelineModel.ElementRemoved += (sender, e) => this.RemoveCommentsAssociatedToElement(e.Element); this.LoadComments(); this.View.Model = 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; }
protected override void Context() { _view = A.Fake <ICommentView>(); sut = new CommentPresenter(_view); }