BililiveRecorder/BililiveRecorder.WPF/Pages/ToolboxAutoFixPage.xaml

212 lines
15 KiB
Plaintext
Raw Normal View History

2021-02-23 18:03:37 +08:00
<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"
2021-02-27 20:44:04 +08:00
xmlns:model="clr-namespace:BililiveRecorder.WPF.Models"
2021-04-14 23:46:24 +08:00
xmlns:c="clr-namespace:BililiveRecorder.WPF.Converters"
2021-04-23 18:51:27 +08:00
xmlns:t="clr-namespace:BililiveRecorder.ToolBox.Commands;assembly=BililiveRecorder.ToolBox"
xmlns:tr="clr-namespace:BililiveRecorder.ToolBox.ProcessingRules;assembly=BililiveRecorder.ToolBox"
2021-02-27 20:44:04 +08:00
mc:Ignorable="d" DataContext="{x:Null}"
2021-02-27 13:24:18 +08:00
d:DesignHeight="600" d:DesignWidth="900"
2021-02-23 18:03:37 +08:00
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">
2021-05-01 23:18:22 +08:00
<Button VerticalAlignment="Bottom" DockPanel.Dock="Right" Content="{l:Loc Toolbox_AutoFix_ButtonNotFixed}">
<ui:FlyoutService.Flyout>
<ui:Flyout Placement="LeftEdgeAlignedTop">
2021-05-02 21:34:27 +08:00
<StackPanel l:ResxLocalizationProvider.DefaultDictionary="Strings">
2021-05-01 23:18:22 +08:00
<TextBlock Text="{l:Loc Toolbox_AutoFix_NotFixed_Description}"/>
<ui:HyperlinkButton NavigateUri="" 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}"/>
2021-05-01 23:18:22 +08:00
<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}"/>
2021-05-01 23:18:22 +08:00
<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}"/>
2021-05-01 23:18:22 +08:00
<TextBlock Text="{l:Loc Toolbox_AutoFix_ButtonAnalyze}"/>
</StackPanel>
</Button>
2021-05-01 23:18:22 +08:00
<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}"
2021-02-27 13:24:18 +08:00
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}">
<Border.Resources>
<DataTemplate x:Key="NullAnalyzeResult">
<StackPanel Margin="16">
2021-05-01 23:18:22 +08:00
<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>
2021-04-23 18:51:27 +08:00
<DataTemplate x:Key="FlvStatsPanel" DataType="{x:Type tr:FlvStats}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
2021-05-01 23:18:22 +08:00
<TextBlock Grid.Row="0" HorizontalAlignment="Center">
<TextBlock.Text>
<MultiBinding Converter="{l:StringFormatConverter}">
2021-05-02 01:04:31 +08:00
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_Stats_FrameCountTemplate"/>
2021-05-01 23:18:22 +08:00
<Binding Path="FrameCount" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Grid.Row="1" HorizontalAlignment="Center">
<TextBlock.Text>
<MultiBinding Converter="{l:StringFormatConverter}">
2021-05-02 01:04:31 +08:00
<l:BLoc Key="Toolbox_AutoFix_AnalyzeResult_Stats_AvgFPS"/>
2021-05-01 23:18:22 +08:00
<Binding Path="FramePerSecond" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
2021-04-23 18:51:27 +08:00
<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">
2021-05-02 01:04:31 +08:00
<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}"/>
2021-04-23 18:51:27 +08:00
</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"/>
2021-04-23 18:51:27 +08:00
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
2021-04-23 18:51:27 +08:00
<TextBox Grid.Row="0" IsReadOnly="True" Text="{Binding InputPath}"/>
2021-05-01 23:18:22 +08:00
<TextBlock Grid.Row="1" HorizontalAlignment="Center" FontSize="24" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_FixNotNeeded}" Foreground="Green"
2021-02-27 20:44:04 +08:00
Visibility="{Binding NeedFix,Converter={StaticResource InvertBooleanToVisibilityCollapsedConverter}}"/>
2021-05-01 23:18:22 +08:00
<TextBlock Grid.Row="1" HorizontalAlignment="Center" FontSize="24" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_FixNeeded}" Foreground="Red"
2021-02-27 20:44:04 +08:00
Visibility="{Binding NeedFix,Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"/>
2021-05-01 23:18:22 +08:00
<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">
2021-05-01 23:18:22 +08:00
<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>
2021-04-23 18:51:27 +08:00
<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">
2021-05-01 23:18:22 +08:00
<TextBlock HorizontalAlignment="Center" FontSize="20" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Title}"/>
<TextBlock HorizontalAlignment="Center" Text="{l:Loc Toolbox_AutoFix_AnalyzeResult_Stats_Disclaimer}"/>
2021-04-23 18:51:27 +08:00
</StackPanel>
<Separator Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
2021-05-07 23:21:53 +08:00
<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}"/>
2021-04-23 18:51:27 +08:00
<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>
2021-02-23 18:03:37 +08:00
</ui:Page>