# HG changeset patch # User Matthieu Totet # Date 1260786301 -3600 # Node ID 69a2910ec6f9f265f6fb60b4cdc38a56e2cf92c2 # Parent 253f142174acf6b450edc97cf14c890f372e823c Update VideoViewer diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs --- a/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs Mon Dec 14 11:25:01 2009 +0100 @@ -7,11 +7,7 @@ /// public static class Commands { - /// - /// Horloge Interne, Principalement pour syncroniser la position d'une video avec sa barre de défilement - /// - public static System.Windows.Threading.DispatcherTimer VideoPositionTimer = new System.Windows.Threading.DispatcherTimer(); - + /// /// Commandes relatives au ConsultMenu /// @@ -463,7 +459,7 @@ TimeChange = new Command("TimeChange"); FlipView = new Command("FlipView"); GoToTime = new Command("GoToTime"); - VideoPositionTimer.Interval = new System.TimeSpan(0, 0,0,0,1000); + // VideoPositionTimer.Tick += new EventHandler(Each_Tick); diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml.cs --- a/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml.cs Mon Dec 14 11:25:01 2009 +0100 @@ -14,8 +14,10 @@ public partial class VideoViewer : UserControl { - + + public System.Windows.Threading.DispatcherTimer VideoPositionTimer = new System.Windows.Threading.DispatcherTimer(); + public String MediaSource { get @@ -38,8 +40,9 @@ public VideoViewer() { // Required to initialize variables - InitializeComponent(); - Commands.VideoPositionTimer.Tick += new EventHandler(VideoPositionTimer_Tick); + InitializeComponent(); /// + VideoPositionTimer.Interval = new System.TimeSpan(0, 0, 0, 0, 1000); + VideoPositionTimer.Tick += new EventHandler(VideoPositionTimer_Tick); Commands.GoToTime.Executed += new EventHandler(GoToTime_Executed); Commands.VideoViewer.Pause.Executed += new EventHandler(Pause_Executed); Commands.VideoViewer.Play.Executed +=new EventHandler(Play_Executed); @@ -52,8 +55,15 @@ void VideoPositionTimer_Tick(object sender, EventArgs e) { - if(_isPlayed) - Commands.VideoViewer.SendPosition.Execute(VideoScreen.Position); + if (_isPlayed) + { + if(Tick!=null) + { + Tick(this, new VideoViewerEventArgs(VideoScreen.Position)); + } + ((VideoViewerVM)DataContext).LaunchTick(VideoScreen.Position); + } + //Commands.VideoViewer.SendPosition.Execute(VideoScreen.Position); } public void ChangePosition(TimeSpan TS) { @@ -64,8 +74,8 @@ { VideoScreen.Pause(); _isPlayed = false; - Commands.VideoPositionTimer.Stop(); - if (Commands.VideoPositionTimer.IsEnabled) + VideoPositionTimer.Stop(); + if (VideoPositionTimer.IsEnabled) { MessageBox.Show("Click Time IS NOT STOPPED"); } @@ -77,7 +87,7 @@ { _isPlayed = true; VideoScreen.Play(); - Commands.VideoPositionTimer.Start(); + VideoPositionTimer.Start(); } } @@ -95,5 +105,15 @@ { MessageBox.Show("toto"); } + public event EventHandler Tick; } + public class VideoViewerEventArgs: EventArgs + { + + public TimeSpan Position { get; set; } + public VideoViewerEventArgs(TimeSpan pos) + { + Position = pos; + } + } } \ No newline at end of file diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.Controls/ViewModel/ConsultationBookView/ConsultationBookViewVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ConsultationBookView/ConsultationBookViewVM.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ConsultationBookView/ConsultationBookViewVM.cs Mon Dec 14 11:25:01 2009 +0100 @@ -284,30 +284,25 @@ } private void InitializeCommands() { - - Commands.VideoViewer.SendPosition.Executed += new EventHandler(SendPosition_Executed); - } + ActualVideoSourceVM.Tick += new EventHandler(ActualVideoSourceVM_Tick); + } - - - void SendPosition_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) + void ActualVideoSourceVM_Tick(object sender, VideoViewerVMEventArgs e) { - TimeSpan Pos = ((TimeSpan)e.Parameter); + TimeSpan Pos = e.Position; SelectedBookVM.Position = Pos.TotalMilliseconds; if (SelectedIndex.TimerOut < Pos || SelectedIndex.TimerIn > Pos) { - foreach(SegmentIndex Index in SelectedIndex.Chapter.Index) - { - if(Index.TimerIn <= Pos && Index.TimerOut>= Pos) - { - SelectedIndex = Index; - } - - } + foreach (SegmentIndex Index in SelectedIndex.Chapter.Index) + { + if (Index.TimerIn <= Pos && Index.TimerOut >= Pos) + { + SelectedIndex = Index; + } + + } } } - - } } diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.Controls/ViewModel/ProductionEditor/ProductionEditorVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionEditor/ProductionEditorVM.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionEditor/ProductionEditorVM.cs Mon Dec 14 11:25:01 2009 +0100 @@ -118,10 +118,22 @@ public ProductionEditorVM() { + InitializeCommands(); + } + public ProductionEditorVM(VideoSequence Vs) + { + ViewModelVideoViewer = new VideoViewerVM(true, false) + { + Source = Vs.Path + }; + InitializeCommands(); + } + private void InitializeCommands() + { + Commands.ProductionTimeLine.IndexSelected.Executed += new EventHandler(IndexSelected_Executed); } - void IndexSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) { IsEditableIndex = (bool)e.Parameter; diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs Mon Dec 14 11:25:01 2009 +0100 @@ -29,6 +29,7 @@ set { _selectedVideoSequence = value; + ViewModelProductionEditor = new ProductionEditorVM(value); OnPropertyChanged("SelectedVideoSequence"); } @@ -103,7 +104,7 @@ _recordedVideoSequences.Add(new VideoSequence() { - Path="/Pouet/Record_"+rndNumbers.Next(10, 60), + Path=Application.Current.Host.Source.Host+@"/video.mp4", RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0), BeginTrim = new TimeSpan(0, 0, 0), EndTrim = new TimeSpan(0, 0, 0), diff -r 253f142174ac -r 69a2910ec6f9 client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs Mon Dec 14 09:56:55 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs Mon Dec 14 11:25:01 2009 +0100 @@ -103,18 +103,29 @@ _recordControl = recordControl; InitializeCommands(); } + public event EventHandler Tick; + private void InitializeCommands() { - Commands.VideoViewer.SendPosition.Executed += new EventHandler(SendPosition_Executed); - //Commands.GoToTime.Executed += new EventHandler(GoToTime_Executed); - + } - void SendPosition_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) + + public void LaunchTick(TimeSpan Pos) { - //Position = (TimeSpan)(e.Parameter); + if(Tick!=null) + { + Tick(this, new VideoViewerVMEventArgs(Pos)); + } } - } + public class VideoViewerVMEventArgs : EventArgs + { + public TimeSpan Position { get; set; } + public VideoViewerVMEventArgs(TimeSpan pos) + { + Position = pos; + } + } }