<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:NewLife.XCoder.Services"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
x:Class="NewLife.XCoder.Views.FileEncodingWindow"
x:DataType="vm:FileEncodingViewModel"
Title="{loc:Tr 'File encoding conversion'}" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
<Window.Styles>
<Style Selector="TextBox.ConfigTextBox">
<Setter Property="Margin" Value="2"/>
<Setter Property="Height" Value="32"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
</Style>
<Style Selector="Button.ActionButton">
<Setter Property="Height" Value="32"/>
<Setter Property="Padding" Value="12,0"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style Selector="Border.GroupBorder">
<Setter Property="Background" Value="{DynamicResource BgSurface2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="10"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Margin" Value="0"/>
</Style>
</Window.Styles>
<Grid Margin="16" RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 配置 -->
<Border Grid.Row="0" Classes="GroupBorder">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{loc:Tr 'Folder'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Column="1" Text="{Binding FolderPath}" Classes="ConfigTextBox"/>
<Button Grid.Column="2" Content="{loc:Tr 'Select'}" Classes="ActionButton" Width="60"/>
<Button Grid.Column="3" Content="{loc:Tr 'Scan'}" Command="{Binding ScanCommand}" Classes="ActionButton" Width="60"/>
<Button Grid.Column="4" Content="{loc:Tr 'Convert encoding'}" Command="{Binding ConvertCommand}" Classes="ActionButton" Width="80"/>
</Grid>
</Border>
<!-- 选项 -->
<Border Grid.Row="1" Classes="GroupBorder" Padding="4">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{loc:Tr 'Extension filter'}" VerticalAlignment="Center" Margin="4,0"/>
<TextBox Text="{Binding SuffixFilter}" Width="300" Classes="ConfigTextBox"/>
<TextBlock Text="{loc:Tr 'Target encoding'}" VerticalAlignment="Center" Margin="8,0,4,0"/>
<ComboBox ItemsSource="{Binding Encodings}" SelectedItem="{Binding TargetEncoding}" Width="120" Height="32"/>
</StackPanel>
</Border>
<!-- 扫描结果 -->
<Grid Grid.Row="2" Margin="0,4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="{loc:Tr 'Scan results'}" FontWeight="Bold" Margin="4,2"/>
<TextBox Grid.Row="1" Text="{Binding ScanResult}" AcceptsReturn="True" AcceptsTab="True"
FontFamily="{DynamicResource FontMono}" FontSize="12"
BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}"/>
</Grid>
<!-- 日志 -->
<TextBox Classes="console" Grid.Row="3" Text="{Binding Log, Converter={x:Static loc:LocalizedTextConverter.Instance}}" AcceptsReturn="True" AcceptsTab="True"
FontFamily="{DynamicResource FontMono}" FontSize="12" MinHeight="60" Margin="0,4"
BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}"/>
</Grid>
</Window>
|