|
| 1 | +<CommonControls:BaseControl x:Class="TensorStack.WPF.Controls.AudioElement" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:i="http://schemas.microsoft.com/xaml/behaviors" |
| 7 | + xmlns:CommonControls="clr-namespace:TensorStack.WPF.Controls" |
| 8 | + xmlns:CommonConverters="clr-namespace:TensorStack.WPF.Converters" |
| 9 | + x:Name="AudioElementUI" > |
| 10 | + <Border DataContext="{Binding ElementName=AudioElementUI}" BorderThickness="1" BorderBrush="{StaticResource ComboBoxBorder}" Background="{StaticResource DefaultBackgroundColor}"> |
| 11 | + <DockPanel> |
| 12 | + |
| 13 | + <Grid> |
| 14 | + <MediaElement x:Name="AudioControl" |
| 15 | + Source="{Binding FileSource, Converter={StaticResource StringToUriConverter}}" |
| 16 | + Volume="{Binding Volume}" |
| 17 | + LoadedBehavior="Manual" |
| 18 | + UnloadedBehavior="Close" |
| 19 | + ScrubbingEnabled="True" |
| 20 | + Loaded="AudioControl_Loaded" |
| 21 | + MediaOpened="AudioControl_MediaOpened" |
| 22 | + MediaEnded="AudioControl_MediaEnded" |
| 23 | + MouseLeftButtonDown="AudioControl_MouseDown" /> |
| 24 | + <Image DockPanel.Dock="Left" Source="{StaticResource PlaceholderVideo}" Stretch="Uniform" MinWidth="{Binding ActualHeight}"/> |
| 25 | + </Grid> |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + <DockPanel LastChildFill="False"> |
| 31 | + <TextBlock Text="{Binding FileSource}" DockPanel.Dock="Top"/> |
| 32 | + |
| 33 | + <StackPanel DockPanel.Dock="Bottom"> |
| 34 | + |
| 35 | + <ProgressBar |
| 36 | + Height="10" |
| 37 | + Margin="1" |
| 38 | + Value="{Binding Progress.Value, Mode=OneWay}" |
| 39 | + Maximum="{Binding Progress.Maximum, Mode=OneWay}" > |
| 40 | + <ProgressBar.Style> |
| 41 | + <Style TargetType="{x:Type ProgressBar}" BasedOn="{StaticResource {x:Type ProgressBar}}"> |
| 42 | + <Setter Property="IsIndeterminate" Value="False"/> |
| 43 | + <Style.Triggers> |
| 44 | + <DataTrigger Binding="{Binding Progress.Value, ElementName=VideoElementUI}" Value="-1"> |
| 45 | + <Setter Property="IsIndeterminate" Value="True"/> |
| 46 | + </DataTrigger> |
| 47 | + </Style.Triggers> |
| 48 | + </Style> |
| 49 | + </ProgressBar.Style> |
| 50 | + </ProgressBar> |
| 51 | + |
| 52 | + <UniformGrid Columns="4" DockPanel.Dock="Bottom"> |
| 53 | + <Button Command="{Binding LoadCommand}" Visibility="{Binding IsLoadEnabled, Converter={StaticResource BooleanToVisibilityConverter}}" > |
| 54 | + <CommonControls:FontAwesome Icon="" /> |
| 55 | + </Button> |
| 56 | + <Button Command="{Binding SaveCommand}" Visibility="{Binding IsSaveEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"> |
| 57 | + <CommonControls:FontAwesome Icon="" /> |
| 58 | + </Button> |
| 59 | + <Grid> |
| 60 | + <Button Command="{Binding PlayCommand}" > |
| 61 | + <CommonControls:FontAwesome Icon="" Visibility="{Binding MediaState, Converter={StaticResource InverseEnumToVisibilityConverter}, ConverterParameter=Play}"/> |
| 62 | + </Button> |
| 63 | + <Button Command="{Binding PauseCommand}" Visibility="{Binding MediaState, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter=Play}"> |
| 64 | + <CommonControls:FontAwesome Icon="" /> |
| 65 | + </Button> |
| 66 | + </Grid> |
| 67 | + <Button Command="{Binding StopCommand}"> |
| 68 | + <CommonControls:FontAwesome Icon="" /> |
| 69 | + </Button> |
| 70 | + </UniformGrid> |
| 71 | + |
| 72 | + </StackPanel> |
| 73 | + </DockPanel> |
| 74 | + </DockPanel> |
| 75 | + </Border> |
| 76 | +</CommonControls:BaseControl> |
0 commit comments