--- 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 @@
/// </summary>
public static class Commands
{
- /// <summary>
- /// Horloge Interne, Principalement pour syncroniser la position d'une video avec sa barre de défilement
- /// </summary>
- public static System.Windows.Threading.DispatcherTimer VideoPositionTimer = new System.Windows.Threading.DispatcherTimer();
-
+
/// <summary>
/// Commandes relatives au ConsultMenu
/// </summary>
@@ -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);
--- 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(); /// <summary>
+ VideoPositionTimer.Interval = new System.TimeSpan(0, 0, 0, 0, 1000);
+ VideoPositionTimer.Tick += new EventHandler(VideoPositionTimer_Tick);
Commands.GoToTime.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(GoToTime_Executed);
Commands.VideoViewer.Pause.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Pause_Executed);
Commands.VideoViewer.Play.Executed +=new EventHandler<SLExtensions.Input.ExecutedEventArgs>(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<VideoViewerEventArgs> Tick;
}
+ public class VideoViewerEventArgs: EventArgs
+ {
+
+ public TimeSpan Position { get; set; }
+ public VideoViewerEventArgs(TimeSpan pos)
+ {
+ Position = pos;
+ }
+ }
}
\ No newline at end of file
--- 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<SLExtensions.Input.ExecutedEventArgs>(SendPosition_Executed);
- }
+ ActualVideoSourceVM.Tick += new EventHandler<VideoViewerVMEventArgs>(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;
+ }
+
+ }
}
}
-
-
}
}
--- 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<SLExtensions.Input.ExecutedEventArgs>(IndexSelected_Executed);
}
-
void IndexSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
{
IsEditableIndex = (bool)e.Parameter;
--- 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),
--- 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<VideoViewerVMEventArgs> Tick;
+
private void InitializeCommands()
{
- Commands.VideoViewer.SendPosition.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SendPosition_Executed);
- //Commands.GoToTime.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(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;
+ }
+ }
}