# HG changeset patch # User Matthieu Totet # Date 1260524938 -3600 # Node ID c2dd8119a6c10323200537dc56794426aa93525d # Parent 7d044e7562ea458d99797b34f6277e5567f076fa Update ProductionView diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs --- a/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs Fri Dec 11 10:48:58 2009 +0100 @@ -494,6 +494,19 @@ { ClickAddSelectedRecord = new Command("ClickAddSelectedRecord"); VideoRecordUpdated = new Command("VideoRecordUpdated"); + DelVideoSequence = new Command("DelVideoSequence"); + ClickAddIndex = new Command("ClickAddIndex"); + + } + public static Command ClickAddIndex + { + get; + private set; + } + public static Command DelVideoSequence + { + get; + private set; } public static Command ClickAddSelectedRecord { diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj --- a/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj Fri Dec 11 10:48:58 2009 +0100 @@ -85,6 +85,7 @@ + @@ -165,6 +166,9 @@ ProductionEditor.xaml + + CustomableIndexElement.xaml + CustomableVideoElement.xaml @@ -279,6 +283,10 @@ Designer MSBuild:MarkupCompilePass1 + + Designer + MSBuild:MarkupCompilePass1 + MSBuild:MarkupCompilePass1 Designer diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs --- a/client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs Fri Dec 11 10:48:58 2009 +0100 @@ -41,6 +41,7 @@ void MenuableUserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { + if(this.IsEnabled) ((MenuableViewModel)base.DataContext).MenuableUserControl_MouseLeftButtonDown(sender,e); } diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs --- a/client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs Fri Dec 11 10:48:58 2009 +0100 @@ -26,7 +26,6 @@ void PolemicElementControl_MouseEnter(object sender, MouseEventArgs e) { - //throw new NotImplementedException(); } diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml --- a/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml Fri Dec 11 10:48:58 2009 +0100 @@ -8,12 +8,10 @@ - + + + diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs --- a/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs Fri Dec 11 10:48:58 2009 +0100 @@ -24,9 +24,6 @@ //HeaderProductionElement.SelectedPart += new EventHandler(HeaderProductionElement_SelectedPart); } - void HeaderProductionElement_SelectedPart(object sender, HeaderProductionEventArgs e) - { - MessageBox.Show(e.ChapterType.ToString()); - } + } } diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableIndexElementVM.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableIndexElementVM.cs Fri Dec 11 10:48:58 2009 +0100 @@ -0,0 +1,96 @@ +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.Controls.View; +namespace Iri.Modernisation.Controls.ViewModel +{ + public class CustomableIndexElementVM : BaseMVVM.ViewModel.ViewModel + { + public CustomableIndexElementVM(SegmentIndex paramSeg) + { + + _segmentIndex = paramSeg; + + _timerIn = paramSeg.TimerIn; + _timerOut = paramSeg.TimerOut; + + + OnPropertyChanged("Duration"); + } + + private SegmentIndex _segmentIndex; + public SegmentIndex SegmentIndex + { + get + { + return _segmentIndex; + } + } + + private TimeSpan _timerIn; + public TimeSpan TimerIn + { + get + { + return _timerIn; + } + set + { + _timerIn = value; + _segmentIndex.TimerIn = value; + OnPropertyChanged(String.Empty); + } + } + + private TimeSpan _timerOut; + public TimeSpan TimerOut + { + get + { + return _timerOut; + } + set + { + _timerOut = value; + _segmentIndex.TimerOut = value; + OnPropertyChanged(String.Empty); + } + } + + + public double Duration + { + get + { + //MessageBox.Show(((TimeSpan)(TimerOut - TimerIn)).TotalMilliseconds.ToString()); + return ((TimeSpan)(TimerOut - TimerIn)).TotalMilliseconds * ProductionTimeLine.ScaleTime; + + } + + } + + private VideoChapterType _chapter; + public VideoChapterType Chapter + { + get + { + return _segmentIndex.Chapter.Type; + } + set + { + _chapter = value; + OnPropertyChanged("Chapter"); + } + } + + + } +} diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs Fri Dec 11 10:48:58 2009 +0100 @@ -28,6 +28,13 @@ } private VideoSequence _videoSequence; + public VideoSequence VideoSequence + { + get + { + return _videoSequence; + } + } private TimeSpan _runTime; public TimeSpan RunTime diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Fri Dec 11 10:48:58 2009 +0100 @@ -13,7 +13,8 @@ using Iri.Modernisation.BaseMVVM.ViewModel; using Iri.Modernisation.Controls.View; using System.Collections.Generic; -using SLExtensions.Collections.ObjectModel; +using System.Collections.ObjectModel; + namespace Iri.Modernisation.Controls.ViewModel { public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel @@ -95,10 +96,17 @@ } } - - - private List[] _listSegmentIndex = new List[4]; - public List SelectedIndex + + + private ObservableCollection[] _listSegmentIndex; + public ObservableCollection[] ListIndex + { + get + { + return _listSegmentIndex; + } + } + public ObservableCollection SelectedIndex { get { @@ -107,7 +115,7 @@ set { _listSegmentIndex[SelectedChapter] = value; - _newBook.Chapters[SelectedChapter].Index = value; + //_newBook.Chapters[SelectedChapter].Index = value; OnPropertyChanged("SelectedIndex"); } } @@ -139,13 +147,55 @@ }; // PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged); // SelectedVideoSequences = new ObservableCollection(); + Commands.ProductionView.DelVideoSequence.Executed += new EventHandler(DelVideoSequence_Executed); Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler(EditorPartSelected_Executed); Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler(EditorPartFinished_Executed); + Commands.ProductionView.ClickAddIndex.Executed += new EventHandler(ClickAddIndex_Executed); _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); - + + _listSegmentIndex = new ObservableCollection[4] + { + new ObservableCollection(), + new ObservableCollection(), + new ObservableCollection(), + new ObservableCollection() + }; + _listSegmentIndex[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); + _listSegmentIndex[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); + _listSegmentIndex[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); + _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); + } + + void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) + { + if(IsIndexing) + { + TimeSpan dur = TimeSpan.Zero; + // Permet de créer un Index avec une durée calé sur les videos. + foreach (VideoSequence Vs in SelectedVideoSequences) + { + dur += Vs.Duration; + } + foreach (SegmentIndex Si in SelectedIndex) + { + dur -= Si.Duration; + } + SelectedIndex.Add(new SegmentIndex(SelectedBookChapter) + { + TimerIn = TimeSpan.Zero, + TimerOut = dur, + Chapter = SelectedBookChapter + }); + } + + } + + void DelVideoSequence_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) + { + SelectedVideoSequences.Remove(((CustomableVideoElementVM)e.Parameter).VideoSequence); } void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) @@ -155,7 +205,7 @@ void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - Commands.ProductionView.VideoRecordUpdated.Execute(); + //Commands.ProductionView.VideoRecordUpdated.Execute(); } void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs Fri Dec 11 10:48:58 2009 +0100 @@ -92,7 +92,6 @@ RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0), BeginTrim = new TimeSpan(0, 0, 0), EndTrim = new TimeSpan(0, 0, 0), - }); } @@ -100,7 +99,15 @@ void ClickAddSelectedRecord_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) { - ViewModelProductionTimeLine.SelectedVideoSequences.Add(SelectedVideoSequence); + if (ViewModelProductionTimeLine.SelectedChapter != -1) + { + if (!ViewModelProductionTimeLine.IsIndexing) + { + if(SelectedVideoSequence!=null) + ViewModelProductionTimeLine.SelectedVideoSequences.Add(new VideoSequence(SelectedVideoSequence)); + } + + } } diff -r 7d044e7562ea -r c2dd8119a6c1 client/src/Iri.Modernisation.Data/Models/VideoSequence.cs --- a/client/src/Iri.Modernisation.Data/Models/VideoSequence.cs Tue Dec 08 11:39:27 2009 +0100 +++ b/client/src/Iri.Modernisation.Data/Models/VideoSequence.cs Fri Dec 11 10:48:58 2009 +0100 @@ -17,6 +17,22 @@ /// public class VideoSequence : SegmentElement { + + public VideoSequence(): + base() + { + } + + public VideoSequence(VideoSequence oldVs) + : base(oldVs) + { + Path = oldVs.Path; + RunTime = oldVs.RunTime; + BeginTrim = oldVs.BeginTrim; + EndTrim = oldVs.EndTrim; + + } + /// /// Chemin d'accès à la vidéo ///