--- 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