--- a/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml Wed Nov 25 12:06:26 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml Mon Nov 30 10:20:35 2009 +0100
@@ -4,13 +4,13 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
-
+ xmlns:Converter="clr-namespace:Iri.Modernisation.Controls.Converter"
xmlns:Input="clr-namespace:SLExtensions.Input;assembly=SLExtensions"
xmlns:View="clr-namespace:Iri.Modernisation.Controls.View"
x:Class="Iri.Modernisation.Controls.View.VideoViewer" Width="240">
<UserControl.Resources>
-
- </UserControl.Resources>
+ <Converter:BoolToVisibility x:Key="BoolToVisibility"></Converter:BoolToVisibility>
+ </UserControl.Resources>
<StackPanel x:Name="VideoViewerPanel" Margin="0,2,8,0" Background="#FF323232">
<TextBlock x:Name="textBlock" Text="{Binding Info}" TextWrapping="Wrap"/>
@@ -19,13 +19,13 @@
</MediaElement>
<StackPanel x:Name="VideoViewerControlPanel" Orientation="Horizontal" Margin="8,0" VerticalAlignment="Bottom" HorizontalAlignment="Center">
- <Button Input:CommandService.Command="PreviousVideo" x:Name="VideoControlPreviousChapter" Content="<|"/>
- <Button Input:CommandService.Command="RecordVideo" x:Name="VideoControlRecord" Width="43" Content="O" />
- <Button Input:CommandService.Command="LoadVideo" x:Name="VideoControlLoad" Width="30" Content="_" />
- <Button Input:CommandService.Command="PlayVideo" Input:CommandService.CommandParameter="{Binding}" x:Name="VideoControlPlay" Content="|>"/>
- <Button Input:CommandService.Command="PauseVideo" x:Name="VideoControlPause" Content="||"/>
- <Button Input:CommandService.Command="NextVideo" x:Name="VideoControlNextChapter" Content=">>"/>
- <Button Input:CommandService.Command="CloseVideo" x:Name="VideoControlClose" Width="25" Content="X"/>
+ <Button Visibility="{Binding PlayControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="PreviousVideo" x:Name="VideoControlPreviousChapter" Content="<<"/>
+ <Button Visibility="{Binding RecordControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="RecordVideo" x:Name="VideoControlRecord" Width="43" Content="O" />
+ <Button Visibility="{Binding RecordControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="LoadVideo" x:Name="VideoControlLoad" Width="30" Content="_" />
+ <Button Visibility="{Binding PlayControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="PlayVideo" Input:CommandService.CommandParameter="{Binding}" x:Name="VideoControlPlay" Content="|>"/>
+ <Button Visibility="{Binding PlayControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="PauseVideo" x:Name="VideoControlPause" Content="||"/>
+ <Button Visibility="{Binding PlayControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="NextVideo" x:Name="VideoControlNextChapter" Content=">>"/>
+ <Button Visibility="{Binding RecordControl, Converter={StaticResource BoolToVisibility}}" Input:CommandService.Command="CloseVideo" x:Name="VideoControlClose" Width="25" Content="X"/>
</StackPanel>
</StackPanel>
</UserControl>
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml.cs Wed Nov 25 12:06:26 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/VideoViewer/VideoViewer.xaml.cs Mon Nov 30 10:20:35 2009 +0100
@@ -34,7 +34,7 @@
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("MediaSource", typeof(String), typeof(VideoViewer), new PropertyMetadata(""));
-
+ private bool _isPlayed = false;
public VideoViewer()
{
// Required to initialize variables
@@ -52,6 +52,7 @@
void VideoPositionTimer_Tick(object sender, EventArgs e)
{
+ if(_isPlayed)
Commands.VideoViewer.SendPosition.Execute(VideoScreen.Position);
}
public void ChangePosition(TimeSpan TS)
@@ -62,6 +63,7 @@
void Pause_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
{
VideoScreen.Pause();
+ _isPlayed = false;
Commands.VideoPositionTimer.Stop();
if (Commands.VideoPositionTimer.IsEnabled)
{
@@ -73,7 +75,7 @@
{
if (e.Parameter == DataContext || e.Parameter == null)
{
-
+ _isPlayed = true;
VideoScreen.Play();
Commands.VideoPositionTimer.Start();
}
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ConsultationBookView/ConsultationBookViewVM.cs Wed Nov 25 12:06:26 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ConsultationBookView/ConsultationBookViewVM.cs Mon Nov 30 10:20:35 2009 +0100
@@ -259,7 +259,7 @@
if (param.SelectedBook.Chapters[0].VideoSequences.Count != 0)
{ _actualVideoSource = param.SelectedBook.Chapters[0].VideoSequences[0].Path; }
SelectedIndex = param.SelectedBook.Chapters[0].Index[0];*/
- ActualVideoSourceVM = new VideoViewerVM();
+ ActualVideoSourceVM = new VideoViewerVM(true,false);
InitializeCommands();
@@ -274,7 +274,7 @@
//
if (param.SelectedBook.Chapters[0].VideoSequences.Count != 0)
{
- ActualVideoSourceVM = new VideoViewerVM() { Source = param.SelectedBook.MediaPath };
+ ActualVideoSourceVM = new VideoViewerVM(true,false) { Source = param.SelectedBook.MediaPath };
}
SelectedIndex = param.SelectedBook.Chapters[0].Index[0];
--- a/client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs Wed Nov 25 12:06:26 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs Mon Nov 30 10:20:35 2009 +0100
@@ -44,6 +44,7 @@
}
}
+
public String Info
{
get
@@ -52,6 +53,7 @@
}
}
+
private TimeSpan position = new TimeSpan(0,0,0);
public TimeSpan Position
{
@@ -67,12 +69,46 @@
}
}
- public VideoViewerVM()
+
+ private bool _playControl;
+ public bool PlayControl
+ {
+ get
+ {
+ return _playControl;
+ }
+ set
+ {
+ _playControl = value;
+ OnPropertyChanged("PlayControl");
+ }
+ }
+
+ private bool _recordControl;
+ public bool RecordControl
+ {
+ get
+ {
+ return _recordControl;
+ }
+ set
+ {
+ _recordControl = value;
+ OnPropertyChanged("RecordControl");
+ }
+ }
+ public VideoViewerVM(bool playControl,bool recordControl )
+ {
+ _playControl = playControl;
+ _recordControl = recordControl;
+ InitializeCommands();
+ }
+ 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)
{
//Position = (TimeSpan)(e.Parameter);