<pi:UserControlBase x:Class="智慧物流软件系统.SetView"
             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:local="clr-namespace:智慧物流软件系统"
             mc:Ignorable="d"
             xmlns:hc="https://handyorg.github.io/handycontrol"
             xmlns:pi="https://github.com/ping9719/wpfex"
             d:DesignHeight="550" d:DesignWidth="800" LoadedVisible="loadedVisible">
    <!--资源-->
    <pi:UserControlBase.Resources>
        <ResourceDictionary>
            <Style TargetType="ToggleButton" BasedOn="{StaticResource ToggleButtonSwitch.Small}">
                <Setter Property="HorizontalAlignment" Value="Left"></Setter>
                <Setter Property="Margin" Value="0,5"></Setter>
                <Setter Property="Height" Value="20"></Setter>
            </Style>
            <Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockSubTitle}">
                <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            </Style>
            <Style TargetType="TextBox" BasedOn="{StaticResource TextBoxExtend}">
                <Setter Property="Margin" Value="0,5"></Setter>
            </Style>
            <Style TargetType="ComboBox" BasedOn="{StaticResource ComboBoxExtend}">
                <Setter Property="Margin" Value="0,5"></Setter>
            </Style>
            <Style TargetType="TextBlock" x:Key="TextBlockHint" BasedOn="{StaticResource TextBlockDefaultThiLight}">
                <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            </Style>
        </ResourceDictionary>
    </pi:UserControlBase.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <!--滚动条-->
        <hc:ScrollViewer Grid.Row="0" IsInertiaEnabled="True" hc:ScrollViewerAttach.AutoHide="False">
            <!--瀑布流-->
            <hc:WaterfallPanel VerticalAlignment="Top" Groups="2" hc:PanelElement.FluidMoveBehavior="{StaticResource BehaviorXY200}">
                <GroupBox Header="扫码枪串口号配置" Margin="5"  Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">

                            <Button Margin="5" Command="{Binding RefreshCOMListCommand}">选择串口号</Button>
                            <ComboBox Margin="5" Name="cbxComs" 
                                      ItemsSource="{Binding COMList}"
                                      SelectedItem="{Binding SelectedCOM}"
                                      IsEditable="False">
                            </ComboBox>
                            <Button Margin="5" Content="添加" Command="{Binding AddCOMCommand}"></Button>
                            <Button Margin="5" Content="删除" Command="{Binding DeleteCOMCommand}"></Button>
                        </StackPanel>
                        <ListBox ItemsSource="{Binding ScannerComList}"
                                  SelectedItem="{Binding SelectedScannerCom}"
                                 >
                        </ListBox>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="App" Margin="5"  Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <ComboBox ItemsSource="{Binding IPList}" SelectedValue="{Binding SelectedIP}">
                                
                            </ComboBox>
                            <Button Margin="5" Command="{Binding AppQRCodeCommand}">生成下载二维码</Button>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="软件" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <TextBlock>开机启动</TextBlock>
                        <ToggleButton IsChecked="{Binding Powerboot}"/>
                        <TextBlock>启动全屏</TextBlock>
                        <ToggleButton IsChecked="{Binding StartupFull}"/>
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="用户" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <TextBlock>登录记忆</TextBlock>
                        <TextBlock Style="{StaticResource TextBlockHint}">在登录成功后会记住账号</TextBlock>
                        <ToggleButton IsChecked="{Binding IsSaveLogin}"/>

                        <TextBlock>记忆数量</TextBlock>
                        <TextBlock Style="{StaticResource TextBlockHint}">在登录成功后记住的账号数量</TextBlock>
                        <ComboBox IsEnabled="{Binding IsSaveLogin}" ItemsSource="{Binding SaveLoginCountData}" SelectedItem="{Binding SaveLoginCount}" hc:InfoElement.Placeholder="登录记忆最大数量" hc:InfoElement.Title=""></ComboBox>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="缓存" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <TextBlock>日志缓存时间</TextBlock>
                        <TextBlock Style="{StaticResource TextBlockHint}">在软件每次打开的时候会执行清理缓存</TextBlock>
                        <ComboBox ItemsSource="{Binding LogTimeData}" SelectedValue="{Binding SaveLogDay}" SelectedValuePath="Key" DisplayMemberPath="Value" hc:InfoElement.Placeholder="日志缓存保存时间" hc:InfoElement.Title=""/>
                    </StackPanel>
                </GroupBox>
                <!--<GroupBox Header="其他列子" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
                    <StackPanel>
                        <TextBlock>文本框</TextBlock>
                        <TextBox hc:InfoElement.Placeholder="请输入值" hc:InfoElement.Title="" hc:InfoElement.TitlePlacement="Left"></TextBox>

                        <TextBlock>文本框（带描述）</TextBlock>
                        <TextBlock Style="{StaticResource TextBlockHint}">我是描述</TextBlock>
                        <TextBox hc:InfoElement.Placeholder="请输入值" hc:InfoElement.Title="" hc:InfoElement.TitlePlacement="Left"></TextBox>

                        <TextBlock>范围文本框</TextBlock>
                        <TextBlock Style="{StaticResource TextBlockHint}">我是描述</TextBlock>
                        <UniformGrid  Columns="2">
                            <TextBox hc:InfoElement.Placeholder="请输入值" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="" Margin="0,5,10,5"></TextBox>
                            <TextBox hc:InfoElement.Placeholder="请输入值" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="-" Margin="-5,5,0,5"></TextBox>
                        </UniformGrid>
                    </StackPanel>
                </GroupBox>-->
            </hc:WaterfallPanel>
        </hc:ScrollViewer>
        <Button Grid.Row="1" Margin="3" Content="保存" FontSize="16" Height="36" Padding="0" hc:IconElement.Geometry="{StaticResource SaveGeometry}" hc:IconElement.Height="16" Command="{Binding SaveCommand}" Style="{StaticResource ButtonPrimary}" HorizontalAlignment="Stretch"/>
    </Grid>
</pi:UserControlBase>
