client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
changeset 19 7d044e7562ea
parent 18 66911d0f0eb6
child 20 c2dd8119a6c1
equal deleted inserted replaced
18:66911d0f0eb6 19:7d044e7562ea
    11 using Iri.Modernisation.Data.Models;
    11 using Iri.Modernisation.Data.Models;
    12 using Iri.Modernisation.BaseMVVM.Commands;
    12 using Iri.Modernisation.BaseMVVM.Commands;
    13 using Iri.Modernisation.BaseMVVM.ViewModel;
    13 using Iri.Modernisation.BaseMVVM.ViewModel;
    14 using Iri.Modernisation.Controls.View;
    14 using Iri.Modernisation.Controls.View;
    15 using System.Collections.Generic;
    15 using System.Collections.Generic;
       
    16 using SLExtensions.Collections.ObjectModel;
    16 namespace Iri.Modernisation.Controls.ViewModel
    17 namespace Iri.Modernisation.Controls.ViewModel
    17 {
    18 {
    18     public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
    19     public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
    19     {
    20     {
    20 
    21 
    32                 OnPropertyChanged("IsIndexing");
    33                 OnPropertyChanged("IsIndexing");
    33             }
    34             }
    34         }
    35         }
    35 
    36 
    36         private VideoBook _newBook;
    37         private VideoBook _newBook;
    37         private List<VideoSequence>[] _listVideoSequences = new List<VideoSequence>[4];
    38         private ObservableCollection<VideoSequence>[] _listVideoSequences = new ObservableCollection<VideoSequence>[4];
    38         public List<VideoSequence> SelectedVideoSequences
    39         public ObservableCollection<VideoSequence>[] ListVideoSequences
    39         {
    40         {
    40             get
    41             get
    41             {
    42             {
       
    43                 return _listVideoSequences;
       
    44             }
       
    45             set
       
    46             {
       
    47                 _listVideoSequences = value;
       
    48                 OnPropertyChanged("ListVideoSequences");
       
    49             }
       
    50         }
       
    51         
       
    52         public ObservableCollection<VideoSequence> SelectedVideoSequences
       
    53         {
       
    54             get
       
    55             {
       
    56                 
    42                 return _listVideoSequences[SelectedChapter];
    57                 return _listVideoSequences[SelectedChapter];
    43             }
    58             }
    44             set
    59             set
    45             {
    60             {
    46                 _listVideoSequences[SelectedChapter] = value;
    61                 _listVideoSequences[SelectedChapter] = value;
    47                 _newBook.Chapters[SelectedChapter].VideoSequences = value;
    62                 //_newBook.Chapters[SelectedChapter].VideoSequences = value;
    48                 OnPropertyChanged("SelectedVideoSequences");
    63                 OnPropertyChanged("SelectedVideoSequences");
    49             }
    64             }
    50         }
    65         }
    51     
    66     
    52         public VideoChapter[] Chapters
    67         public VideoChapter[] Chapters
   113  
   128  
   114       
   129       
   115         public ProductionTimeLineVM()
   130         public ProductionTimeLineVM()
   116         {
   131         {
   117             _newBook = new VideoBook();
   132             _newBook = new VideoBook();
   118             
   133             _listVideoSequences = new ObservableCollection<VideoSequence>[4]
   119             
   134             {
       
   135                 new ObservableCollection<VideoSequence>(),
       
   136                 new ObservableCollection<VideoSequence>(),
       
   137                 new ObservableCollection<VideoSequence>(),
       
   138                 new ObservableCollection<VideoSequence>()
       
   139             };
       
   140            // PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged);
       
   141            // SelectedVideoSequences = new ObservableCollection<VideoSequence>();
   120             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
   142             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
   121             Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
   143             Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
   122             }
   144             _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
       
   145             _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
       
   146             _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
       
   147             _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
       
   148       
       
   149         }
       
   150 
       
   151         void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
       
   152         {
       
   153             Commands.ProductionView.VideoRecordUpdated.Execute();
       
   154         }
       
   155 
       
   156         void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
       
   157         {
       
   158             Commands.ProductionView.VideoRecordUpdated.Execute();
       
   159         }
   123 
   160 
   124         void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   161         void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   125         {
   162         {
   126             SelectedChapter = -1;
   163             SelectedChapter = -1;
   127      
       
   128         }
   164         }
   129 
   165 
   130         void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   166         void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   131         {
   167         {
   132            
   168