<UserControl
    x:Class="SHH.CameraDashboard.CameraPtz"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:SHH.CameraDashboard"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DataContext="{d:DesignInstance local:CameraPtzViewModel}"
    d:DesignHeight="600"
    d:DesignWidth="500"
    mc:Ignorable="d">

    <Grid Margin="20" Background="{DynamicResource Brush.Bg.Window}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <DockPanel Margin="0,0,0,20" LastChildFill="False">
            <TextBlock
                VerticalAlignment="Center"
                FontSize="18"
                FontWeight="Bold"
                Foreground="{DynamicResource Brush.Text.Primary}"
                Text="{Binding Title}" />
        </DockPanel>

        <Grid Grid.Row="1" Margin="0,0,0,30">
            <Grid
                Width="220"
                Height="220"
                Margin="50,0,0,0"
                HorizontalAlignment="Left">
                <Ellipse
                    Fill="{DynamicResource Brush.Bg.Input}"
                    Stroke="{DynamicResource Brush.Border}"
                    StrokeThickness="1" />

                <Button
                    Width="60"
                    Height="60"
                    Margin="0,10,0,0"
                    VerticalAlignment="Top"
                    local:TouchBehavior.Action="{x:Static local:PtzAction.Up}"
                    Style="{StaticResource Btn.Ghost.Secondary}">
                    <Path
                        Width="24"
                        Height="24"
                        Data="{StaticResource Icon.ChevronUp}"
                        Style="{StaticResource Style.IconPath}" />
                </Button>

                <Button
                    Width="60"
                    Height="60"
                    Margin="0,0,0,10"
                    VerticalAlignment="Bottom"
                    local:TouchBehavior.Action="{x:Static local:PtzAction.Down}"
                    Style="{StaticResource Btn.Ghost.Secondary}">
                    <Path
                        Width="24"
                        Height="24"
                        Data="{StaticResource Icon.ChevronUp}"
                        RenderTransformOrigin="0.5,0.5"
                        Style="{StaticResource Style.IconPath}">
                        <Path.RenderTransform>
                            <RotateTransform Angle="180" />
                        </Path.RenderTransform>
                    </Path>
                </Button>

                <Button
                    Width="60"
                    Height="60"
                    Margin="10,0,0,0"
                    HorizontalAlignment="Left"
                    local:TouchBehavior.Action="{x:Static local:PtzAction.Left}"
                    Style="{StaticResource Btn.Ghost.Secondary}">
                    <Path
                        Width="24"
                        Height="24"
                        Data="{StaticResource Icon.ChevronUp}"
                        RenderTransformOrigin="0.5,0.5"
                        Style="{StaticResource Style.IconPath}">
                        <Path.RenderTransform>
                            <RotateTransform Angle="-90" />
                        </Path.RenderTransform>
                    </Path>
                </Button>

                <Button
                    Width="60"
                    Height="60"
                    Margin="0,0,10,0"
                    HorizontalAlignment="Right"
                    local:TouchBehavior.Action="{x:Static local:PtzAction.Right}"
                    Style="{StaticResource Btn.Ghost.Secondary}">
                    <Path
                        Width="24"
                        Height="24"
                        Data="{StaticResource Icon.ChevronUp}"
                        RenderTransformOrigin="0.5,0.5"
                        Style="{StaticResource Style.IconPath}">
                        <Path.RenderTransform>
                            <RotateTransform Angle="90" />
                        </Path.RenderTransform>
                    </Path>
                </Button>

                <Button
                    Width="60"
                    Height="60"
                    IsHitTestVisible="False"
                    Opacity="0.8"
                    Style="{StaticResource Btn.Icon.Info}">
                    <Path
                        Width="28"
                        Height="28"
                        Data="{StaticResource Icon.Ptz}"
                        Style="{StaticResource Style.IconPath}" />
                </Button>
            </Grid>

            <WrapPanel
                Margin="300,0,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center">
                <Button
                    Width="150"
                    Height="48"
                    Margin="0,0,5,0"
                    Command="{Binding SyncTimeCommand}"
                    Style="{StaticResource Btn.Ghost.Info}">
                    <StackPanel Orientation="Horizontal">
                        <Path
                            Width="32"
                            Height="32"
                            Data="{StaticResource Icon.Action.Time}"
                            Style="{StaticResource Style.IconPath}" />
                        <TextBlock
                            Margin="8,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="18"
                            FontWeight="SemiBold"
                            Text="一键校时" />
                    </StackPanel>
                </Button>

                <Button
                    Width="150"
                    Height="48"
                    Margin="5,20,0,0"
                    Command="{Binding RebootCommand}"
                    Style="{StaticResource Btn.Ghost.Danger}">
                    <StackPanel Orientation="Horizontal">
                        <Path
                            Width="32"
                            Height="32"
                            Data="{StaticResource Icon.Action.Reboot}"
                            Style="{StaticResource Style.IconPath}" />
                        <TextBlock
                            Margin="8,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="18"
                            FontWeight="SemiBold"
                            Text="远程重启" />
                    </StackPanel>
                </Button>
            </WrapPanel>
        </Grid>

        <Border
            Grid.Row="2"
            Padding="15"
            Background="{DynamicResource Brush.Bg.Input}"
            CornerRadius="8">
            <StackPanel>
                <TextBlock
                    Margin="0,0,0,15"
                    FontSize="18"
                    FontWeight="Bold"
                    Foreground="{DynamicResource Brush.Text.Secondary}"
                    Text="镜头与辅助" />

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                        <RowDefinition Height="50" />
                        <RowDefinition Height="50" />
                        <RowDefinition Height="15" />
                        <RowDefinition Height="50" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
                        <TextBlock
                            Margin="8,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="16"
                            Foreground="{DynamicResource Brush.Text.Primary}"
                            Text="变倍" />
                    </StackPanel>
                    <Button
                        Grid.Column="1"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.ZoomOut}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Minus}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="缩小" />
                        </StackPanel>
                    </Button>

                    <Button
                        Grid.Column="2"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.ZoomIn}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Plus}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="放大" />
                        </StackPanel>
                    </Button>

                    <StackPanel
                        Grid.Row="1"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                        <TextBlock
                            Margin="8,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="16"
                            Foreground="{DynamicResource Brush.Text.Primary}"
                            Text="聚焦" />
                    </StackPanel>
                    <Button
                        Grid.Row="1"
                        Grid.Column="1"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.FocusNear}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Focus.Near}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="拉近" />
                        </StackPanel>
                    </Button>

                    <Button
                        Grid.Row="1"
                        Grid.Column="2"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.FocusFar}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Focus.Far}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="拉远" />
                        </StackPanel>
                    </Button>

                    <StackPanel
                        Grid.Row="2"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                        <TextBlock
                            Margin="6,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="16"
                            Foreground="{DynamicResource Brush.Text.Primary}"
                            Text="光圈" />
                    </StackPanel>
                    <Button
                        Grid.Row="2"
                        Grid.Column="1"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.IrisClose}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Iris.Small}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="变小" />
                        </StackPanel>
                    </Button>

                    <Button
                        Grid.Row="2"
                        Grid.Column="2"
                        Width="120"
                        local:TouchBehavior.Action="{x:Static local:PtzAction.IrisOpen}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Iris.Large}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="变大" />
                        </StackPanel>
                    </Button>

                    <Border
                        Grid.Row="3"
                        Grid.ColumnSpan="3"
                        Margin="0,5"
                        VerticalAlignment="Center"
                        BorderBrush="{DynamicResource Brush.Border}"
                        BorderThickness="0,0,0,1" />

                    <StackPanel
                        Grid.Row="4"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                        <TextBlock
                            Margin="6,0,0,0"
                            VerticalAlignment="Center"
                            FontSize="16"
                            Foreground="{DynamicResource Brush.Text.Primary}"
                            Text="雨刷" />
                    </StackPanel>

                    <Button
                        Grid.Row="4"
                        Grid.Column="1"
                        Width="120"
                        Command="{Binding StopCommand}"
                        CommandParameter="{x:Static local:PtzAction.Wiper}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Action.StopSmall}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="停止" />
                        </StackPanel>
                    </Button>

                    <Button
                        Grid.Row="4"
                        Grid.Column="2"
                        Width="120"
                        Command="{Binding StartCommand}"
                        CommandParameter="{x:Static local:PtzAction.Wiper}"
                        Style="{StaticResource Btn.Ghost.Secondary}">
                        <StackPanel Orientation="Horizontal">
                            <Path
                                Width="16"
                                Height="16"
                                Data="{StaticResource Icon.Action.PlaySmall}"
                                Style="{StaticResource Style.IconPath}" />
                            <TextBlock
                                Margin="12,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="启动" />
                        </StackPanel>
                    </Button>
                </Grid>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>