Ejemplo n.º 1
0
        /// <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="ITimelineModel"/> interface.</param>
        public CommentsBarPresenter(ICommentsBarView view, IEventAggregator eventAggregator, ITimelineModel timelineModel, ITimelineBarRegistry timelineBarRegistry)
        {
            this.eventAggregator = eventAggregator;
            this.timelineModel   = timelineModel;
            this.timelineModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "Duration")
                {
                    this.View.SetDuration(this.timelineModel.Duration);
                }
            };

            this.timelineBarRegistry = timelineBarRegistry;
            this.View = view;
            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.View.SetDuration(this.timelineModel.Duration);

            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;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayerSnapshotCommand"/> class.
 /// </summary>
 /// <param name="timelineModel">The timeline model.</param>
 /// <param name="layer">The layer where the snapshot is being took.</param>
 /// <param name="currentMemento">The current state of the layer.</param>
 /// <param name="newMemento">The new state of the layer.</param>
 public LayerSnapshotCommand(ITimelineModel timelineModel, Track layer, IList <TimelineElement> currentMemento, IList <TimelineElement> newMemento)
 {
     this.timelineModel  = timelineModel;
     this.layer          = layer;
     this.currentMemento = currentMemento;
     this.newMemento     = newMemento;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ToggleLinkElementCommand"/> class.
 /// </summary>
 /// <param name="timelineModel">The timeline model.</param>
 /// <param name="layer">The layer of the element.</param>
 /// <param name="element">The element being linked/unliked.</param>
 /// <param name="linkPosition">The <see cref="LinkPosition"/> of the link.</param>
 public ToggleLinkElementCommand(ITimelineModel timelineModel, Track layer, TimelineElement element, LinkPosition linkPosition)
 {
     this.timelineModel = timelineModel;
     this.layer         = layer;
     this.element       = element;
     this.linkPosition  = linkPosition;
 }
Ejemplo n.º 4
0
        /// <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;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoveElementCommand"/> class.
 /// </summary>
 /// <param name="timelineModel">The timeline model.</param>
 /// <param name="layer">The layer where the element is being removed.</param>
 /// <param name="editMode">The current <see cref="EditMode"/>.</param>
 /// <param name="timelineElement">The element being removed.</param>
 public RemoveElementCommand(ITimelineModel timelineModel, Track layer, EditMode editMode, TimelineElement timelineElement)
 {
     this.timelineModel   = timelineModel;
     this.layer           = layer;
     this.editMode        = editMode;
     this.timelineElement = timelineElement;
     this.memento         = new List <TimelineElement>();
 }
Ejemplo n.º 6
0
        public TimelineView(ITimelineModel model, INodeRenderer renderer)
        {
            m_model = model;
            m_renderer = renderer;

            foreach (INode node in m_model.Nodes)
            {
                Widget widget = m_renderer.Render(node);
                if (widget == null)
                    throw new NotImplementedException("Renderer returned null");
                widget.Show();
                Console.WriteLine("{0}, {1}", node.Position.X, node.Position.Y);
                Put(widget, (int) node.Position.X, (int) node.Position.Y);
            }
        }
Ejemplo n.º 7
0
        public TimelineView(ITimelineModel model, INodeRenderer renderer)
        {
            m_model    = model;
            m_renderer = renderer;

            foreach (INode node in m_model.Nodes)
            {
                Widget widget = m_renderer.Render(node);
                if (widget == null)
                {
                    throw new NotImplementedException("Renderer returned null");
                }
                widget.Show();
                Console.WriteLine("{0}, {1}", node.Position.X, node.Position.Y);
                Put(widget, (int)node.Position.X, (int)node.Position.Y);
            }
        }
Ejemplo n.º 8
0
        public CommentEditBoxPresentationModel(ICommentEditBox view, ICommentViewPreview preview, IEventAggregator eventAggregator, ITimelineModel timelineModel, IConfigurationService configurationService)
        {
            this.View                 = view;
            this.preview              = preview;
            this.eventAggregator      = eventAggregator;
            this.timelineModel        = timelineModel;
            this.configurationService = configurationService;
            this.timelineModel.CommentElements.CollectionChanged += this.CommentElements_CollectionChanged;
            this.preview.SetTimelineDuration(this.timelineModel.Duration);

            this.CloseCommand  = new DelegateCommand <object>(this.Close);
            this.SaveCommand   = new DelegateCommand <object>(this.Save, this.CanSave);
            this.DeleteCommand = new DelegateCommand <object>(this.Delete);
            this.PlayCommand   = new DelegateCommand <object>(this.PlayComment);

            this.comment = this.CreateComment();
            this.timelineModel.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;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddElementCommand"/> class.
 /// </summary>
 /// <param name="timelineModel">The timeline model.</param>
 /// <param name="layer">The layer where the element is beign added.</param>
 /// <param name="element">The element beign added.</param>
 public AddElementCommand(ITimelineModel timelineModel, Track layer, TimelineElement element)
 {
     this.timelineModel = timelineModel;
     this.layer         = layer;
     this.element       = element;
 }
Ejemplo n.º 10
0
 public TimelineLayoutManager(ITimelineModel model)
 {
     m_model = model;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestableLayerSnapshotCommand"/> class.
 /// </summary>
 /// <param name="timelineModel">The timeline model.</param>
 /// <param name="layer">The layer where the snapshot is being took.</param>
 /// <param name="currentMemento">The current state of the layer.</param>
 /// <param name="newMemento">The new state of the layer.</param>
 public TestableLayerSnapshotCommand(ITimelineModel timelineModel, Track layer, IList <TimelineElement> currentMemento, IList <TimelineElement> newMemento) : base(timelineModel, layer, currentMemento, newMemento)
 {
 }