mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-12-26 12:15:42 +08:00
212 lines
15 KiB
XML
212 lines
15 KiB
XML
<ui:Page
|
||
x:Class="BililiveRecorder.WPF.Pages.ToolboxAutoFixPage"
|
||
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:ui="http://schemas.modernwpf.com/2019"
|
||
xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
|
||
l:LocalizeDictionary.DesignCulture=""
|
||
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
|
||
l:ResxLocalizationProvider.DefaultDictionary="Strings"
|
||
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
|
||
xmlns:model="clr-namespace:BililiveRecorder.WPF.Models"
|
||
xmlns:c="clr-namespace:BililiveRecorder.WPF.Converters"
|
||
xmlns:t="clr-namespace:BililiveRecorder.ToolBox.Tool.Analyze;assembly=BililiveRecorder.ToolBox"
|
||
xmlns:tr="clr-namespace:BililiveRecorder.ToolBox.ProcessingRules;assembly=BililiveRecorder.ToolBox"
|
||
mc:Ignorable="d" DataContext="{x:Null}"
|
||
d:DesignHeight="600" d:DesignWidth="900"
|
||
Title="ToolboxAutoFixPage">
|
||
<Border Background="Transparent" AllowDrop="True" Drop="FileNameTextBox_Drop">
|
||
<Grid Margin="20" >
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<DockPanel Margin="0,0,0,10">
|
||
<Button VerticalAlignment="Bottom" DockPanel.Dock="Right" Content="{l:Loc Toolbox_AutoFix_ButtonNotFixed}">
|
||
<ui:FlyoutService.Flyout>
|
||
<ui:Flyout Placement="LeftEdgeAlignedTop">
|
||
<StackPanel l:ResxLocalizationProvider.DefaultDictionary="Strings">
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_NotFixed_Description}"/>
|
||
<ui:HyperlinkButton NavigateUri="https://rec.danmuji.org/link/fix_feedback/" Content="{l:Loc Toolbox_AutoFix_NotFixed_LearnMore}"/>
|
||
<Button Margin="0,15,0,10" HorizontalAlignment="Center" Click="Export_Button_Click">
|
||
<StackPanel Orientation="Horizontal">
|
||
<ui:PathIcon Margin="0,0,5,0" Style="{StaticResource PathIconDataExport}"/>
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_NotFixed_ButtonExportData}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
</StackPanel>
|
||
</ui:Flyout>
|
||
</ui:FlyoutService.Flyout>
|
||
</Button>
|
||
<Button VerticalAlignment="Bottom" DockPanel.Dock="Right" Margin="5,0" Click="Fix_Button_Click">
|
||
<StackPanel Orientation="Horizontal">
|
||
<ui:PathIcon Height="14" Margin="0,0,5,0" Style="{StaticResource PathIconDataAutoFix}"/>
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_ButtonFix}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
<Button VerticalAlignment="Bottom" DockPanel.Dock="Right" Click="Analyze_Button_Click">
|
||
<StackPanel Orientation="Horizontal">
|
||
<ui:PathIcon Height="14" Margin="0,0,5,0" Style="{StaticResource PathIconDataMagnifyScan}"/>
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_ButtonAnalyze}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
<Button VerticalAlignment="Bottom" DockPanel.Dock="Right" Margin="0,0,5,0" Content="{l:Loc Toolbox_AutoFix_ButtonSelectInput}" Click="SelectFile_Button_Click"/>
|
||
<TextBox ui:ControlHelper.PlaceholderText="{l:Loc Toolbox_AutoFix_InputPathPlaceholder}" ui:TextBoxHelper.IsDeleteButtonVisible="False" x:Name="FileNameTextBox" />
|
||
</DockPanel>
|
||
<Border Grid.Row="1" BorderThickness="1" CornerRadius="5" x:Name="analyzeResultDisplayArea" DataContext="{x:Null}"
|
||
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}">
|
||
<Border.Resources>
|
||
<DataTemplate x:Key="NullAnalyzeResult">
|
||
<StackPanel Margin="16">
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_NoDataTitle}" FontSize="26" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||
<TextBlock Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_NoDataNote}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||
</StackPanel>
|
||
</DataTemplate>
|
||
<DataTemplate x:Key="FlvStatsPanel" DataType="{x:Type tr:FlvStats}">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<TextBlock Grid.Row="0" HorizontalAlignment="Center">
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_Stats_FrameCountTemplate"/>
|
||
<Binding Path="FrameCount" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock Grid.Row="1" HorizontalAlignment="Center">
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_Stats_AvgFPS"/>
|
||
<Binding Path="FramePerSecond" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<ListView Grid.Row="2" ItemsSource="{Binding FrameDurations}" Margin="5" BorderThickness="1"
|
||
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}">
|
||
<ListView.Resources>
|
||
<!-- 忽略此处的一个 Error,是 Visual Studio 的 bug -->
|
||
<!-- Ignore the following Error, caused by Visual Studio bug -->
|
||
<ResourceDictionary Source="pack://application:,,,/ModernWpf;component/DensityStyles/Compact.xaml" />
|
||
</ListView.Resources>
|
||
<ListView.View>
|
||
<GridView AllowsColumnReorder="False">
|
||
<GridViewColumn Header="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_FrameDuration}" DisplayMemberBinding="{Binding Key,StringFormat=\{0\} ms}"/>
|
||
<GridViewColumn Header="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_FrameCount}" DisplayMemberBinding="{Binding Value}"/>
|
||
</GridView>
|
||
</ListView.View>
|
||
</ListView>
|
||
</Grid>
|
||
</DataTemplate>
|
||
<DataTemplate x:Key="NormalAnalyzeResult" DataType="{x:Type t:AnalyzeResponse}">
|
||
<Grid Margin="5">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<TextBox Grid.Row="0" IsReadOnly="True" Text="{Binding InputPath}"/>
|
||
<TextBlock Grid.Row="1" HorizontalAlignment="Center" FontSize="24" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_FixNotNeeded}" Foreground="Green"
|
||
Visibility="{Binding NeedFix,Converter={StaticResource InvertBooleanToVisibilityCollapsedConverter}}"/>
|
||
<TextBlock Grid.Row="1" HorizontalAlignment="Center" FontSize="24" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_FixNeeded}" Foreground="Red"
|
||
Visibility="{Binding NeedFix,Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"/>
|
||
<TextBlock Grid.Row="2" HorizontalAlignment="Center" FontSize="15" Foreground="Red"
|
||
Visibility="{Binding Unrepairable,Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
|
||
Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_ContainsUnrepairable}"/>
|
||
<StackPanel Grid.Row="3" HorizontalAlignment="Center" Margin="10">
|
||
<TextBlock Margin="0,0,0,5">
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_OutputFileCount"/>
|
||
<Binding Path="OutputFileCount" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeTimestampOffset"/>
|
||
<Binding Path="IssueTypeTimestampOffset" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeTimestampJump"/>
|
||
<Binding Path="IssueTypeTimestampJump" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeDecodingHeader"/>
|
||
<Binding Path="IssueTypeDecodingHeader" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeRepeatingData"/>
|
||
<Binding Path="IssueTypeRepeatingData" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeOther"/>
|
||
<Binding Path="IssueTypeOther" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
<TextBlock>
|
||
<TextBlock.Text>
|
||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_IssueTypeUnrepairable"/>
|
||
<Binding Path="IssueTypeUnrepairable" Mode="OneWay"/>
|
||
</MultiBinding>
|
||
</TextBlock.Text>
|
||
</TextBlock>
|
||
</StackPanel>
|
||
<Grid Grid.Row="4" Margin="10">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
<StackPanel HorizontalAlignment="Center" Grid.ColumnSpan="3">
|
||
<TextBlock HorizontalAlignment="Center" FontSize="20" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Title}"/>
|
||
<TextBlock HorizontalAlignment="Center" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Disclaimer}"/>
|
||
</StackPanel>
|
||
<Separator Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
|
||
<TextBlock Grid.Row="1" Grid.Column="0" TextAlignment="Center" FontSize="16" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Video}"/>
|
||
<TextBlock Grid.Row="1" Grid.Column="2" TextAlignment="Center" FontSize="16" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Audio}"/>
|
||
<ContentControl Grid.Row="2" Grid.Column="0" Content="{Binding VideoStats}" ContentTemplate="{StaticResource FlvStatsPanel}"/>
|
||
<ContentControl Grid.Row="2" Grid.Column="2" Content="{Binding AudioStats}" ContentTemplate="{StaticResource FlvStatsPanel}"/>
|
||
</Grid>
|
||
</Grid>
|
||
</DataTemplate>
|
||
<c:NullValueTemplateSelector x:Key="SelectorTemplate" Normal="{StaticResource NormalAnalyzeResult}" Null="{StaticResource NullAnalyzeResult}"/>
|
||
</Border.Resources>
|
||
<ContentControl Content="{Binding}" ContentTemplateSelector="{StaticResource SelectorTemplate}"/>
|
||
</Border>
|
||
</Grid>
|
||
</Border>
|
||
</ui:Page>
|