client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
author Matthieu Totet
Mon, 07 Dec 2009 10:36:55 +0100
changeset 18 66911d0f0eb6
parent 17 0e4e63f6f567
child 19 7d044e7562ea
permissions -rw-r--r--
Update ProductionView

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 ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
    {


        private bool _isIndexing;
        public bool IsIndexing
        {
            get
            {
                return _isIndexing;
            }
            set
            {
                _isIndexing = value;
                OnPropertyChanged("IsIndexing");
            }
        }

        private VideoBook _newBook;
        private List<VideoSequence>[] _listVideoSequences = new List<VideoSequence>[4];
        public List<VideoSequence> SelectedVideoSequences
        {
            get
            {
                return _listVideoSequences[SelectedChapter];
            }
            set
            {
                _listVideoSequences[SelectedChapter] = value;
                _newBook.Chapters[SelectedChapter].VideoSequences = value;
                OnPropertyChanged("SelectedVideoSequences");
            }
        }
    
        public VideoChapter[] Chapters
        {
            get
            {
                return _newBook.Chapters;
            }
          
        
        }
        public VideoChapter SelectedBookChapter
        {
            get
            {
                return _newBook.Chapters[SelectedChapter];
            }
        }

        private int _selectedChapter=0;
        public int SelectedChapter
        {
            get
            {
                return _selectedChapter;
            }
            set
            {
                _selectedChapter = value;
                OnPropertyChanged("SelectedChapter");
            }
        }

       
    
        private List<SegmentIndex>[] _listSegmentIndex = new List<SegmentIndex>[4];
        public List<SegmentIndex> SelectedIndex
        {
            get
            {
                return _listSegmentIndex[SelectedChapter];
            }
            set
            {
                _listSegmentIndex[SelectedChapter] = value;
                _newBook.Chapters[SelectedChapter].Index = value;
                OnPropertyChanged("SelectedIndex");
            }
        }

        private VideoChapterType _selectedChapterType;
        public VideoChapterType SelectedChapterType
        {
            get
            {
                return _selectedChapterType;
            }
            set
            {
                _selectedChapterType = value;
                OnPropertyChanged("SelectedChapterType");
            }
        }
 
      
        public ProductionTimeLineVM()
        {
            _newBook = new VideoBook();
            
            
            Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
            Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
            }

        void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
        {
            SelectedChapter = -1;
     
        }

        void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
        {
           
            SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType;
            SelectedChapterType = ((HeaderProductionEventArgs)e.Source).ChapterType ;
            IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart;
        }
    }
}