<Window x:Class="SmartScanner.DownloadData"
|
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:SmartScanner"
|
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:Properties="clr-namespace:SmartScanner.Properties"
|
mc:Ignorable="d"
|
Width="490" Height="320"
|
Title="图像设置">
|
|
<Grid Background="#3C3C3C">
|
<Grid.Resources>
|
<Style x:Key="TextBoxStyle" TargetType="TextBox">
|
<Style.Setters>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
<Setter Property="Background" Value="#6C6C6C"/>
|
<Setter Property="BorderBrush" Value="#1F0000"/>
|
<Setter Property="Foreground" Value="White"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
</Style.Setters>
|
</Style>
|
<Style TargetType="RadioButton" x:Key="RadioButtonStyle">
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="RadioButton">
|
<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
<VisualStateManager.VisualStateGroups>
|
<VisualStateGroup x:Name="CheckStates">
|
<VisualState x:Name="Checked">
|
<Storyboard>
|
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="contentPresenter">
|
<EasingColorKeyFrame KeyTime="0" Value="White"/>
|
</ColorAnimationUsingKeyFrames>
|
</Storyboard>
|
</VisualState>
|
<VisualState x:Name="Unchecked"/>
|
<VisualState x:Name="Indeterminate"/>
|
</VisualStateGroup>
|
</VisualStateManager.VisualStateGroups>
|
<Ellipse Width="{Binding ActualHeight, ElementName=contentPresenter}" Height="{Binding ActualHeight, ElementName=contentPresenter}" Fill="{TemplateBinding Background}"/>
|
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
</Grid>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
<Style x:Key="BtnLabelStyle">
|
<Style.Triggers>
|
<Trigger Property="Button.IsFocused" Value="False">
|
<Setter Property="Button.Background" Value="Transparent"/>
|
<Setter Property="Button.BorderThickness" Value="0"/>
|
</Trigger>
|
<Trigger Property="Button.IsFocused" Value="True">
|
<Setter Property="Button.Background" Value="#4D0000"/>
|
<Setter Property="Button.BorderThickness" Value="0"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
<Style x:Key="LabelStyle">
|
<Style.Triggers>
|
<Trigger Property="Label.IsFocused" Value="False">
|
<Setter Property="Label.Background" Value="Transparent"/>
|
<Setter Property="Label.Foreground" Value="White"/>
|
</Trigger>
|
<Trigger Property="Label.IsFocused" Value="True">
|
<Setter Property="Label.Background" Value="#FFBEE6FD"/>
|
<Setter Property="Label.Foreground" Value="#4F4F4F"/>
|
</Trigger>
|
<Trigger Property="Label.IsMouseOver" Value="True">
|
<Setter Property="Label.Background" Value="#FFBEE6FD"/>
|
<Setter Property="Label.Foreground" Value="#4F4F4F"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
<Style x:Key="FocusVisual">
|
<Setter Property="Control.Template">
|
<Setter.Value>
|
<ControlTemplate>
|
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
<!--按钮静态时背景颜色-->
|
<SolidColorBrush x:Key="Button.Static.Background" Color="#4F4F4F"/>
|
<!--按钮静态时边框颜色-->
|
<SolidColorBrush x:Key="Button.Static.Border" Color="#2F0000"/>
|
<!--按钮静态时文字颜色-->
|
<SolidColorBrush x:Key="Button.Static.Foreground" Color="White"/>
|
<!--鼠标移入时背景颜色-->
|
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#4D0000"/>
|
<!--鼠标移入时边框颜色-->
|
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#2F0000"/>
|
<!--鼠标按下时背景颜色-->
|
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#4D0000"/>
|
<!--鼠标按下时边框颜色-->
|
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#2F0000"/>
|
<!--按钮不使用时背景颜色-->
|
<SolidColorBrush x:Key="Button.Disabled.Background" Color="Gray"/>
|
<!--按钮不使用时边框颜色-->
|
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
|
<!--按钮不使用时文字颜色-->
|
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="White"/>
|
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
|
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
<Setter Property="Foreground" Value="{StaticResource Button.Static.Foreground}"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
<!--边框宽度,设置为0 即:无边框-->
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="Padding" Value="1"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type Button}">
|
<Border x:Name="border" CornerRadius="5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
|
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
</Border>
|
<!--触发器:根据依赖属性的值去控制控件的状态-->
|
<ControlTemplate.Triggers>
|
<!--默认属性-->
|
<Trigger Property="IsDefaulted" Value="true">
|
<!--<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>-->
|
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Static.Background}"/>
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Static.Border}"/>
|
<Setter Property="TextElement.Foreground" TargetName="border" Value="{StaticResource Button.Static.Foreground}"/>
|
</Trigger>
|
<!--鼠标移入属性-->
|
<Trigger Property="IsMouseOver" Value="true">
|
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
|
</Trigger>
|
<!--鼠标按下属性-->
|
<Trigger Property="IsPressed" Value="true">
|
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
|
</Trigger>
|
<!--按钮可用状态属性-->
|
<Trigger Property="IsEnabled" Value="false">
|
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
|
<!--<Setter Property="Foreground" TargetName="border" Value="{StaticResource Button.Disabled.Foreground}"/>-->
|
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</Grid.Resources>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="70"/>
|
<RowDefinition Height="160"/>
|
<RowDefinition Height="40"/>
|
</Grid.RowDefinitions>
|
<StackPanel Grid.Row="0">
|
<Label Content="路径选择:" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Height="35"/>
|
<StackPanel Orientation="Horizontal" Height="35">
|
<TextBox Name="SetDataSavingRoad" Text="{Binding Source={x:Static Properties:Settings.Default}, Path=DataSavingRoad, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}"
|
HorizontalContentAlignment="Left" Height="30" FontSize="14" ToolTip="文件存储路径" Width="400" Margin="10,0,0,0" MouseDoubleClick="SetDataSavingRoad_MouseDoubleClick"/>
|
<Button Name="SelectFilePath" Content="浏览…" Width="50" Height="30" Click="SelectFilePath_Click" Style="{DynamicResource ButtonStyle}"/>
|
</StackPanel>
|
</StackPanel>
|
<StackPanel Grid.Row="1">
|
<StackPanel Orientation="Horizontal" Height="35">
|
<Label Content="保存设置:" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Width="100"/>
|
</StackPanel>
|
<StackPanel Orientation="Horizontal" Height="35">
|
<CheckBox Name="ImageDeleteCheck" Content="定期清图" IsChecked="{Binding Source={x:Static Properties:Settings.Default}, Path=ImageDeleteEnabled, Mode=TwoWay}" Unchecked="ImageDeleteCheck_Unchecked" Checked="ImageDeleteCheck_Checked" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Width="130" Margin="20,0,0,0"/>
|
<toolkit:IntegerUpDown x:Name="Data_deleteImage" FormatString="N" Increment="1" Maximum="200000"
|
Value="{Binding Source={x:Static Properties:Settings.Default}, Path=DeleteImageDays, Mode=TwoWay}"
|
LostFocus="Data_deleteImage_LostFocus" Width="100" Height="25"/>
|
<Label Content="天" Foreground="White" VerticalAlignment="Center"/>
|
</StackPanel>
|
<StackPanel Orientation="Horizontal" Height="35">
|
<StackPanel Orientation="Horizontal" Width="300">
|
<CheckBox Name="ImageSaveCheck" Content="启用图像保存" IsChecked="{Binding Source={x:Static Properties:Settings.Default}, Path=ImageSaveEnabled, Mode=TwoWay}"
|
Unchecked="ImageSaveCheck_Unchecked" Checked="ImageSaveCheck_Checked"
|
HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Width="130" Margin="20,0,0,0"/>
|
<Label Content="保存格式" Foreground="White" VerticalAlignment="Center"/>
|
<ComboBox Name="ImageFormat" SelectedIndex="{Binding Source={x:Static Properties:Settings.Default}, Path=ImageFormatSelect, Mode=TwoWay}"
|
Height="25" SelectionChanged="ImageFormat_SelectionChanged" LostFocus="ImageFormat_LostFocus">
|
<ComboBoxItem Content=".BMP"/>
|
<ComboBoxItem Content=".JPG"/>
|
<ComboBoxItem Content=".PNG"/>
|
</ComboBox>
|
</StackPanel>
|
<StackPanel x:Name="CompressionVisible" Orientation="Horizontal" Visibility="Visible">
|
<Label Content="压缩比率" Foreground="White" VerticalAlignment="Center"/>
|
<toolkit:IntegerUpDown x:Name="ImageCompressionRatio" FormatString="N" Increment="1" Maximum="10" Minimum="0" UpdateValueOnEnterKey="True"
|
Value="{Binding Source={x:Static Properties:Settings.Default}, Path=CompressionRatio, Mode=TwoWay}"
|
Watermark="取值[0-10]" Width="85" Height="25" LostFocus="ImageCompressionRatio_LostFocus"/>
|
</StackPanel>
|
</StackPanel>
|
<StackPanel Orientation="Horizontal" Height="35">
|
<CheckBox Name="MemoryAlarmCheck" Content="存储空间预警" IsChecked="{Binding Source={x:Static Properties:Settings.Default}, Path=MemoryAlarmEnabled, Mode=TwoWay}"
|
Unchecked="MemoryAlarmCheck_Unchecked" Checked="MemoryAlarmCheck_Checked" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Foreground="White" Width="130" Margin="20,0,0,0"/>
|
<toolkit:IntegerUpDown x:Name="MemoryAlarm" FormatString="N" Maximum="90" Minimum="10" UpdateValueOnEnterKey="True"
|
Value="{Binding Source={x:Static Properties:Settings.Default}, Path=MemoryAlarmSetting, Mode=TwoWay}"
|
Width="100" Height="25" LostFocus="MemoryAlarm_LostFocus"/>
|
<Label Content="%" Foreground="White" VerticalAlignment="Center"/>
|
</StackPanel>
|
</StackPanel>
|
<StackPanel Grid.Row="2">
|
<Button Content="确定" Width="300" Height="30" Name="Confirm_Btn" Click="Confirm_Btn_Click" Margin="5" Style="{DynamicResource ButtonStyle}"/>
|
</StackPanel>
|
</Grid>
|
</Window>
|