client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
author Matthieu Totet
Tue, 08 Dec 2009 11:39:27 +0100
changeset 19 7d044e7562ea
parent 18 66911d0f0eb6
child 20 c2dd8119a6c1
permissions -rw-r--r--
Update ProductionView
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     1
using System;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     2
using System.Net;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     3
using System.Windows;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     4
using System.Windows.Controls;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     5
using System.Windows.Documents;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     6
using System.Windows.Ink;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     7
using System.Windows.Input;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     8
using System.Windows.Media;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
     9
using System.Windows.Media.Animation;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    10
using System.Windows.Shapes;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    11
using Iri.Modernisation.Data.Models;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    12
using Iri.Modernisation.BaseMVVM.Commands;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    13
using Iri.Modernisation.BaseMVVM.ViewModel;
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    14
using Iri.Modernisation.Controls.View;
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    15
using System.Collections.Generic;
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    16
using SLExtensions.Collections.ObjectModel;
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    17
namespace Iri.Modernisation.Controls.ViewModel
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    18
{
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    19
    public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    20
    {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    21
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    22
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    23
        private bool _isIndexing;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    24
        public bool IsIndexing
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    25
        {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    26
            get
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    27
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    28
                return _isIndexing;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    29
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    30
            set
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    31
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    32
                _isIndexing = value;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    33
                OnPropertyChanged("IsIndexing");
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    34
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    35
        }
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    36
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    37
        private VideoBook _newBook;
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    38
        private ObservableCollection<VideoSequence>[] _listVideoSequences = new ObservableCollection<VideoSequence>[4];
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    39
        public ObservableCollection<VideoSequence>[] ListVideoSequences
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    40
        {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    41
            get
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    42
            {
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    43
                return _listVideoSequences;
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    44
            }
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    45
            set
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    46
            {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    47
                _listVideoSequences = value;
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    48
                OnPropertyChanged("ListVideoSequences");
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    49
            }
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    50
        }
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    51
        
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    52
        public ObservableCollection<VideoSequence> SelectedVideoSequences
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    53
        {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    54
            get
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    55
            {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    56
                
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    57
                return _listVideoSequences[SelectedChapter];
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    58
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    59
            set
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    60
            {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    61
                _listVideoSequences[SelectedChapter] = value;
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
    62
                //_newBook.Chapters[SelectedChapter].VideoSequences = value;
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    63
                OnPropertyChanged("SelectedVideoSequences");
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    64
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    65
        }
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    66
    
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    67
        public VideoChapter[] Chapters
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    68
        {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    69
            get
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    70
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    71
                return _newBook.Chapters;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    72
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    73
          
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    74
        
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    75
        }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    76
        public VideoChapter SelectedBookChapter
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    77
        {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    78
            get
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    79
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    80
                return _newBook.Chapters[SelectedChapter];
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    81
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    82
        }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
    83
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    84
        private int _selectedChapter=0;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    85
        public int SelectedChapter
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    86
        {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    87
            get
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    88
            {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    89
                return _selectedChapter;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    90
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    91
            set
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    92
            {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    93
                _selectedChapter = value;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    94
                OnPropertyChanged("SelectedChapter");
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    95
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    96
        }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    97
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    98
       
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
    99
    
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   100
        private List<SegmentIndex>[] _listSegmentIndex = new List<SegmentIndex>[4];
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   101
        public List<SegmentIndex> SelectedIndex
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   102
        {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   103
            get
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   104
            {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   105
                return _listSegmentIndex[SelectedChapter];
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   106
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   107
            set
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   108
            {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   109
                _listSegmentIndex[SelectedChapter] = value;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   110
                _newBook.Chapters[SelectedChapter].Index = value;
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   111
                OnPropertyChanged("SelectedIndex");
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   112
            }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   113
        }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   114
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   115
        private VideoChapterType _selectedChapterType;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   116
        public VideoChapterType SelectedChapterType
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   117
        {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   118
            get
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   119
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   120
                return _selectedChapterType;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   121
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   122
            set
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   123
            {
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   124
                _selectedChapterType = value;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   125
                OnPropertyChanged("SelectedChapterType");
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   126
            }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   127
        }
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   128
 
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   129
      
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   130
        public ProductionTimeLineVM()
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   131
        {
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   132
            _newBook = new VideoBook();
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   133
            _listVideoSequences = new ObservableCollection<VideoSequence>[4]
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   134
            {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   135
                new ObservableCollection<VideoSequence>(),
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   136
                new ObservableCollection<VideoSequence>(),
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   137
                new ObservableCollection<VideoSequence>(),
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   138
                new ObservableCollection<VideoSequence>()
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   139
            };
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   140
           // PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged);
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   141
           // SelectedVideoSequences = new ObservableCollection<VideoSequence>();
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   142
            Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
18
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   143
            Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
19
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   144
            _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   145
            _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   146
            _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   147
            _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   148
      
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   149
        }
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   150
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   151
        void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   152
        {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   153
            Commands.ProductionView.VideoRecordUpdated.Execute();
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   154
        }
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   155
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   156
        void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   157
        {
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   158
            Commands.ProductionView.VideoRecordUpdated.Execute();
7d044e7562ea Update ProductionView
Matthieu Totet
parents: 18
diff changeset
   159
        }
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   160
18
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   161
        void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   162
        {
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   163
            SelectedChapter = -1;
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   164
        }
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   165
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   166
        void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   167
        {
18
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   168
           
66911d0f0eb6 Update ProductionView
Matthieu Totet
parents: 17
diff changeset
   169
            SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType;
17
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   170
            SelectedChapterType = ((HeaderProductionEventArgs)e.Source).ChapterType ;
0e4e63f6f567 Update ProductinoView and Components
Matthieu Totet
parents: 0
diff changeset
   171
            IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart;
0
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   172
        }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   173
    }
249d70e7b32d Create Directories & Project
Matthieu Totet
parents:
diff changeset
   174
}