<UserControl x:Class="VIZ.Package.Module.VizPreviewView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
             xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
             xmlns:local="clr-namespace:VIZ.Package.Module"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance Type=local:VizPreviewViewModel}" 
             d:DesignHeight="450" d:DesignWidth="800">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
                <ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/CheckBox/CheckBox_Preview.xaml"></ResourceDictionary>
                <ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/RadioButton/RadioButton_Preview.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
    </dxmvvm:Interaction.Behaviors>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <!-- 按钮组 -->
        <Grid IsEnabled="{Binding Path=IsVizPreviewReadly}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                <fcommon:IconButton Content="播放" Margin="5,0,0,0" 
                                    Style="{StaticResource IconButton_Preview}"
                                    Icon="/VIZ.Package.Module.Resource;component/Icons/play_36x36.png"
                                    IconHover="/VIZ.Package.Module.Resource;component/Icons/play_hover_36x36.png"
                                    Command="{Binding Path=PlayCommand}"></fcommon:IconButton>
                <fcommon:IconButton Content="继续" Margin="5,0,0,0" Style="{StaticResource IconButton_Preview}"
                                    Icon="/VIZ.Package.Module.Resource;component/Icons/continue_36x36.png"
                                    IconHover="/VIZ.Package.Module.Resource;component/Icons/continue_hover_36x36.png"
                                    Command="{Binding Path=ContinueCommand}"></fcommon:IconButton>
                <fcommon:IconButton Content="停止" Margin="5,0,0,0" Style="{StaticResource IconButton_Preview}"
                                    Icon="/VIZ.Package.Module.Resource;component/Icons/stop_36x36.png"
                                    IconHover="/VIZ.Package.Module.Resource;component/Icons/stop_hover_36x36.png"
                                    Command="{Binding Path=StopCommand}"></fcommon:IconButton>
            </StackPanel>

            <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
                <fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/preview_refresh_32x32.png"
                                    ToolTip="重启预览引擎"
                                    Style="{StaticResource IconButton_Menu_Mask}" Margin="0,0,40,0" 
                                    IconWidth="16" IconHeight="16" Height="30" Width="30"
                                    Command="{Binding Path=RestartPreviewCommand}"></fcommon:IconButton>

                <CheckBox Content="TA" Style="{StaticResource CheckBox_Preview_TA}" Margin="5,0,0,0"
                          ToolTip="Title Safe"
                          IsChecked="{Binding Path=IsShowTS,Mode=TwoWay}">
                </CheckBox>
                <CheckBox Content="SA" Style="{StaticResource CheckBox_Preview_SA}" Margin="5,0,0,0"
                          ToolTip="Safe Area"
                          IsChecked="{Binding Path=IsShowSA,Mode=TwoWay}">
                </CheckBox>
                <CheckBox Content="BB" Style="{StaticResource CheckBox_Preview_BB}" Margin="5,0,0,0"
                          ToolTip="Binding Box"
                          IsChecked="{Binding Path=IsShowBB,Mode=TwoWay}">
                </CheckBox>

                <RadioButton Content="RGB" Style="{StaticResource RadioButton_Preview_RGB}"
                             ToolTip="RGB"
                             Margin="5,0,0,0" IsChecked="True">
                    <dxmvvm:Interaction.Behaviors>
                        <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowRGBCommand}"></dxmvvm:EventToCommand>
                    </dxmvvm:Interaction.Behaviors>
                </RadioButton>
                <RadioButton Content="Key" Style="{StaticResource RadioButton_Preview_Key}"
                             ToolTip="Key"
                             Margin="5,0,0,0">
                    <dxmvvm:Interaction.Behaviors>
                        <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowKeyCommand}"></dxmvvm:EventToCommand>
                    </dxmvvm:Interaction.Behaviors>
                </RadioButton>
                <RadioButton Content="KeyedPreview"  Style="{StaticResource RadioButton_Preview_KeydPreview}"
                             ToolTip="Keyed Preview"
                             Margin="5,0,0,0">
                    <dxmvvm:Interaction.Behaviors>
                        <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowKeyPreviewCommand}"></dxmvvm:EventToCommand>
                    </dxmvvm:Interaction.Behaviors>
                </RadioButton>
            </StackPanel>
        </Grid>
        <!-- VIZ引擎 -->
        <fcommon:WindowHost x:Name="host" Grid.Row="1" Background="#FF222222" BackColor="#FF222222">
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EventToCommand PassEventArgsToCommand="True" EventName="SizeChanged" 
                                       Command="{Binding Path=WindowHostSizeChangedCommand}"></dxmvvm:EventToCommand>
            </dxmvvm:Interaction.Behaviors>
        </fcommon:WindowHost>
    </Grid>
</UserControl>
