client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs
author Matthieu Totet
Mon, 04 Jan 2010 10:29:39 +0100
changeset 27 f292db96b050
parent 20 c2dd8119a6c1
child 36 b6df6fce6e5d
permissions -rw-r--r--
Generalization of Book Structure

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Iri.Modernisation.Data.Models;
using Iri.Modernisation.BaseMVVM.Commands;
using Iri.Modernisation.BaseMVVM.ViewModel;
using Iri.Modernisation.Controls.View;
using System.Collections.Generic;
namespace Iri.Modernisation.Controls.ViewModel
{
    public class CustomableVideoElementVM : BaseMVVM.ViewModel.ViewModel
    {
        public CustomableVideoElementVM(VideoSequence paramSeq)
        {
            _videoSequence = paramSeq;
            _runTime = paramSeq.RunTime;
            _beginTrim = paramSeq.BeginTrim;
            _endTrim = paramSeq.EndTrim;
           
            OnPropertyChanged("Duration");
        }

        private VideoSequence _videoSequence;
        public VideoSequence VideoSequence
        {
            get
            {
                return _videoSequence;
            }
        }

        private TimeSpan _runTime;
        public TimeSpan RunTime 
        {
            get
            {
                return _runTime;
            }
            set
            {
                _runTime = value;
                _videoSequence.RunTime = value;
                OnPropertyChanged(String.Empty);
               
            }
        }

        private TimeSpan _beginTrim;
        public TimeSpan BeginTrim 
        {
            get
            {
                return _beginTrim;
            }
            set
            {
                _beginTrim = value;
                _videoSequence.BeginTrim = value;
                OnPropertyChanged(String.Empty);
            }
        }

        private TimeSpan _endTrim;
        public TimeSpan EndTrim 
        { 
            get
            {
                return _endTrim;
            }
            set
            {
                _endTrim = value;
                _videoSequence.EndTrim = value;
                OnPropertyChanged(String.Empty);
            }
        }

        
        public double Duration
        {
            get
            {
                return( RunTime.TotalMilliseconds - (BeginTrim.TotalMilliseconds + EndTrim.TotalMilliseconds))*ProductionTimeLine.ScaleTime;
            }

        }

        private VideoChapterType _chapter;
        public VideoChapterType Chapter
        {
            get
            {
                return _chapter;
            }
            set
            {
                _chapter = value;
                OnPropertyChanged("Chapter");
            }
        }

        private Color _chapterColor;
        public Color ChapterColor
        {
            get
            {
                return _chapterColor;
            }
            set
            {
                _chapterColor = value;
                OnPropertyChanged("ChapterColor");
            }
        }
        public SolidColorBrush ChapterSolidColorBrush
        {
            get
            {
                return new SolidColorBrush(this.ChapterColor);
            }
        }
        public TimeSpan DurationTimeSpan
        {
            get
            {
                return _videoSequence.Duration;
            }

        }

       
        
    }
}