<Window
    x:Class="HBLConsole.View.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:con="clr-namespace:HBLConsole.Converter"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:HBLConsole.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pry="clr-namespace:HBLConsole.PryUserControl;assembly=HBLConsole.PryUserControl"
    xmlns:vm="clr-namespace:HBLConsole.ViewModel"
    Title="MainView"
    Width="1400"
    Height="850"
    AllowsTransparency="True"
    Background="{x:Null}"
    Topmost="True"
    WindowStartupLocation="CenterScreen"
    WindowStyle="None"
    mc:Ignorable="d">

    <Window.DataContext>
        <vm:MainViewModel />
    </Window.DataContext>

    <Window.Resources>
        <con:ColorConverter x:Key="color" />
        <con:TextConverter x:Key="text" />
        <con:NetworkColorConvert x:Key="NetworkColorConvert" />
        <con:NetworkTextConvert x:Key="NetworkTextConvert" />

        <Style x:Key="BeveledRadioButtonStyle" TargetType="{x:Type RadioButton}">
            <Setter Property="FontFamily" Value="楷体" />
            <Setter Property="Width" Value="100" />
            <Setter Property="Height" Value="30" />
            <Setter Property="IsChecked" Value="False" />
            <Setter Property="FontSize" Value="13" />
            <Setter Property="Foreground" Value="#ddd" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RadioButton}">
                        <Grid x:Name="gr" SnapsToDevicePixels="True">

                            <pry:BeveledButton
                                x:Name="bb"
                                FillColor="#4B8EC4"
                                IsParallelogram="False"
                                StrokeThickness="1" />

                            <ContentPresenter
                                x:Name="contentPresenter"
                                Margin="0,0,10,0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Content="{TemplateBinding Content}"
                                ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Focusable="False"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter TargetName="bb" Property="FillColor" Value="#55007acc" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>

        </Style>

        <Style x:Key="ParallelogramRadioButtonStyle" TargetType="{x:Type RadioButton}">
            <Setter Property="FontFamily" Value="楷体" />
            <Setter Property="Width" Value="100" />
            <Setter Property="IsChecked" Value="False" />
            <Setter Property="FontSize" Value="13" />
            <Setter Property="Foreground" Value="#ddd" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RadioButton}">
                        <Grid x:Name="gr" SnapsToDevicePixels="True">

                            <pry:BeveledButton
                                x:Name="bb"
                                FillColor="#4B8EC4"
                                IsParallelogram="True"
                                StrokeThickness="1" />

                            <ContentPresenter
                                x:Name="contentPresenter"
                                Margin="0,0,10,0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Content="{TemplateBinding Content}"
                                ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Focusable="False"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />


                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter TargetName="bb" Property="FillColor" Value="#55007acc" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>

        </Style>


        <!--#region 标题栏按钮样式-->
        <Style x:Key="TitleBarStyle" TargetType="Button">
            <Setter Property="Foreground" Value="#5500c2f4" />
            <Setter Property="FontSize" Value="24" />
            <Setter Property="FontFamily" Value="../../Resources/Fonts/#iconfont" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="TitleBarBr" Background="Transparent">
                            <ContentPresenter
                                Margin="{TemplateBinding Margin}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="TitleBarBr" Property="Background" Value="#33ffffff" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!--#endregion-->

    </Window.Resources>

    <Border x:Name="br">
        <Border.Background>
            <ImageBrush ImageSource="../Resources/Images/背景.png" />
        </Border.Background>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.18*" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Image
                    Grid.RowSpan="2"
                    VerticalAlignment="Top"
                    Source="../Resources/Images/topTitle.png" />

                <TextBlock
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    FontSize="24"
                    Foreground="#00c2f4"
                    Text="上位机监控系统" />

                <Grid
                    Grid.Row="1"
                    Margin="10"
                    VerticalAlignment="Bottom">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="0.3*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal">

                        <RadioButton
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="MessageLogView"
                            Content="消息日志"
                            IsChecked="True"
                            Style="{StaticResource BeveledRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="OrderStatusView"
                            Content="订单状态"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="AlarmView"
                            Content="报警记录"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Content="参数设置"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="DebugContainer"
                            Content="调试模式"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="ProcessMonitoringView"
                            Content="流程监控"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="DeviceManageView"
                            Content="设备管理"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />

                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="VariableConfig"
                            Content="变量管理"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />


                        <RadioButton
                            Margin="-10,0,0,0"
                            Command="{Binding NavChangedCommand}"
                            CommandParameter="BatchingAddView"
                            Content="物料补充"
                            Style="{StaticResource ParallelogramRadioButtonStyle}" />
                    </StackPanel>

                    <StackPanel
                        Grid.Column="1"
                        Margin="0,0,10,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                        <TextBlock
                            FontSize="16"
                            Foreground="#00c2f4"
                            Text="当前订单量：" />
                        <TextBlock
                            FontSize="16"
                            Foreground="#00c2f4"
                            Text="{Binding OrderCount}" />

                        <TextBlock
                            Margin="10,0,0,0"
                            FontSize="16"
                            Foreground="#00c2f4"
                            Text="网络状态：" />
                        <TextBlock
                            FontSize="16"
                            Foreground="{Binding NetworkConnectState, Converter={StaticResource NetworkColorConvert}}"
                            Text="{Binding NetworkConnectState, Converter={StaticResource NetworkTextConvert}}" />
                    </StackPanel>
                </Grid>

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <UniformGrid HorizontalAlignment="Right" Columns="3">
                        <Button
                            Name="ButMin"
                            Width="40"
                            Content="&#xe664;"
                            Style="{StaticResource TitleBarStyle}" />
                        <Button
                            Name="ButMax"
                            Content="&#xe65d;"
                            Style="{StaticResource TitleBarStyle}" />
                        <Button
                            Name="ButClose"
                            Content="&#xe639;"
                            FontSize="26"
                            Style="{StaticResource TitleBarStyle}" />
                    </UniformGrid>

                </Grid>

            </Grid>

            <Grid Grid.Row="1" Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.06*" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock
                    Margin="10"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    FontSize="20"
                    Foreground="#00C2F4"
                    Text="{Binding WindowName}" />

                <Image
                    HorizontalAlignment="Center"
                    VerticalAlignment="Bottom"
                    Source="../Resources/Images/tittle.png" />

                <Image
                    Grid.RowSpan="2"
                    HorizontalAlignment="Center"
                    Source="../Resources/Images/阴影边框.png"
                    Stretch="Fill" />

                <Image
                    Grid.RowSpan="2"
                    HorizontalAlignment="Center"
                    Source="../Resources/Images/边角.png"
                    Stretch="Fill" />

                <ContentControl
                    Grid.Row="1"
                    Margin="15"
                    Content="{Binding MainContent}" />

            </Grid>
        </Grid>


    </Border>
</Window>
