Files
Better-Seewo/Manager/Pages/ConvertPage.xaml

576 lines
33 KiB
Plaintext
Raw Normal View History

<Page x:Class="Better_Seewo.Manager.Pages.ConvertPage"
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"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="900"
FontFamily="Microsoft YaHei UI"
Title="格式转换">
<!-- 页面资源字典 -->
<Page.Resources>
<!-- 转换按钮样式 -->
<Style x:Key="ConvertButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="32,12"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="btnBorder"
Background="{TemplateBinding Background}"
CornerRadius="8"
Padding="{TemplateBinding Padding}"
RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<ScaleTransform ScaleX="1.0" ScaleY="1.0"/>
</Border.RenderTransform>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="btnBorder" Property="Opacity" Value="0.5"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="btnBorder"
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
To="1.04" Duration="0:0:0.150">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="btnBorder"
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
To="1.04" Duration="0:0:0.150">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="btnBorder"
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
To="1.0" Duration="0:0:0.150">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="btnBorder"
Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
To="1.0" Duration="0:0:0.150">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 拖拽区域样式(带边框发光动画) -->
<Style x:Key="DropZoneStyle" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Padding" Value="24"/>
<Setter Property="Cursor" Value="Hand"/>
<Style.Triggers>
<!-- 拖拽区域悬停发光动画 -->
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color"
To="#FF5B9BD5" Duration="0:0:0.300">
<ColorAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</ColorAnimation.EasingFunction>
</ColorAnimation>
<DoubleAnimation Storyboard.TargetProperty="BorderBrush.Opacity"
To="0.8" Duration="0:0:0.300"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color"
Duration="0:0:0.300">
<ColorAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</ColorAnimation.EasingFunction>
</ColorAnimation>
<DoubleAnimation Storyboard.TargetProperty="BorderBrush.Opacity"
To="1.0" Duration="0:0:0.300"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
<!-- 自定义Tab样式 -->
<Style x:Key="TabHeaderStyle" TargetType="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="Padding" Value="20,10"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="GroupName" Value="ConvertMode"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="tabBorder"
Background="{TemplateBinding Background}"
CornerRadius="6"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="contentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="tabBorder" Property="Background"
Value="{DynamicResource AccentBrush}"/>
<Setter TargetName="contentPresenter" Property="TextBlock.Foreground"
Value="White"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="tabBorder" Property="Background"
Value="{DynamicResource AccentBrush}" x:Name="HoverBg"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 文件选择按钮样式 -->
<Style x:Key="FileSelectButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="Padding" Value="16,8"/>
<Setter Property="BorderThickness" Value="1.5"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="btnBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnBorder" Property="Background"
Value="{DynamicResource AccentBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<!-- 主背景 -->
<Grid Background="{DynamicResource BackgroundBrush}">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<StackPanel Margin="40,30,40,40">
<!-- ====== 顶部标题区域 ====== -->
<StackPanel Margin="0,0,0,25">
<TextBlock Text="格式转换"
FontSize="28"
FontWeight="Bold"
Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock Text="PPTX 与 ENBX 格式互转"
FontSize="13"
Foreground="{DynamicResource TextSecondaryBrush}"
Margin="0,4,0,0"/>
</StackPanel>
<!-- ====== Tab切换区域带滑动指示器 ====== -->
<Border Background="{DynamicResource CardBackgroundBrush}"
CornerRadius="12"
Padding="6"
Margin="0,0,0,20"
HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal">
<RadioButton x:Name="TabPptxToEnbx"
Content="PPTX → ENBX"
Style="{StaticResource TabHeaderStyle}"
IsChecked="True"
Checked="TabPptxToEnbx_Checked"/>
<RadioButton x:Name="TabEnbxToPptx"
Content="ENBX → PPTX"
Style="{StaticResource TabHeaderStyle}"
Margin="4,0,0,0"
Checked="TabEnbxToPptx_Checked"/>
<!-- 滑动指示器 -->
<Border x:Name="TabIndicator"
Width="100" Height="3"
Background="{DynamicResource AccentBrush}"
CornerRadius="1.5"
VerticalAlignment="Bottom"
Margin="-105,0,0,0"
HorizontalAlignment="Left"
RenderTransformOrigin="0,0.5">
<Border.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Border.RenderTransform>
</Border>
</StackPanel>
</Border>
<!-- ====== PPTX -> ENBX 转换面板 ====== -->
<StackPanel x:Name="PanelPptxToEnbx">
<!-- 文件拖拽/选择区域 -->
<Border Style="{StaticResource DropZoneStyle}"
Margin="0,0,0,16">
<StackPanel HorizontalAlignment="Center">
<!-- 文件图标 -->
<Path Data="M0,4 L0,48 L36,48 L36,14 L26,4 Z M26,4 L26,14 L36,14"
Stroke="{DynamicResource TextSecondaryBrush}"
StrokeThickness="1.5"
Fill="Transparent"
Stretch="Uniform"
HorizontalAlignment="Center"
Height="50" Width="50"
Margin="0,0,0,10"/>
<TextBlock x:Name="PptxFileNameText"
Text="拖拽 .pptx 文件到此处,或点击下方按钮选择"
FontSize="14"
Foreground="{DynamicResource TextSecondaryBrush}"
HorizontalAlignment="Center"
TextWrapping="Wrap"/>
<Button Content="选择 PPTX 文件"
Style="{StaticResource FileSelectButtonStyle}"
Margin="0,14,0,0"
Click="BtnSelectPptx_Click"/>
</StackPanel>
</Border>
<!-- 转换设置 -->
<Border Background="{DynamicResource CardBackgroundBrush}"
CornerRadius="12"
Padding="20"
Margin="0,0,0,16">
<StackPanel>
<TextBlock Text="转换设置"
FontSize="15"
FontWeight="SemiBold"
Foreground="{DynamicResource TextPrimaryBrush}"
Margin="0,0,0,14"/>
<!-- 保持动画 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<CheckBox x:Name="ChkKeepAnimation"
Content="保持动画效果"
IsChecked="True"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="转换时保留PPT中的动画"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
<!-- 嵌入图片 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<CheckBox x:Name="ChkEmbedImages"
Content="嵌入图片资源"
IsChecked="True"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="将图片直接嵌入ENBX文件"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
<!-- 转换备注 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<CheckBox x:Name="ChkConvertNotes"
Content="转换备注内容"
IsChecked="False"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="将演讲者备注转为白板备注"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 转换按钮 -->
<Button x:Name="BtnConvertPptxToEnbx"
Content="开始转换"
Style="{StaticResource ConvertButtonStyle}"
HorizontalAlignment="Center"
IsEnabled="False"
Click="BtnConvertPptxToEnbx_Click"/>
</StackPanel>
<!-- ====== ENBX -> PPTX 转换面板(默认隐藏) ====== -->
<StackPanel x:Name="PanelEnbxToPptx" Visibility="Collapsed">
<!-- 文件拖拽/选择区域 -->
<Border Style="{StaticResource DropZoneStyle}"
Margin="0,0,0,16">
<StackPanel HorizontalAlignment="Center">
<Path Data="M0,4 L0,48 L36,48 L36,14 L26,4 Z M26,4 L26,14 L36,14"
Stroke="{DynamicResource TextSecondaryBrush}"
StrokeThickness="1.5"
Fill="Transparent"
Stretch="Uniform"
HorizontalAlignment="Center"
Height="50" Width="50"
Margin="0,0,0,10"/>
<TextBlock x:Name="EnbxFileNameText"
Text="拖拽 .enbx 文件到此处,或点击下方按钮选择"
FontSize="14"
Foreground="{DynamicResource TextSecondaryBrush}"
HorizontalAlignment="Center"
TextWrapping="Wrap"/>
<Button Content="选择 ENBX 文件"
Style="{StaticResource FileSelectButtonStyle}"
Margin="0,14,0,0"
Click="BtnSelectEnbx_Click"/>
</StackPanel>
</Border>
<!-- 转换设置 -->
<Border Background="{DynamicResource CardBackgroundBrush}"
CornerRadius="12"
Padding="20"
Margin="0,0,0,16">
<StackPanel>
<TextBlock Text="转换设置"
FontSize="15"
FontWeight="SemiBold"
Foreground="{DynamicResource TextPrimaryBrush}"
Margin="0,0,0,14"/>
<!-- 保持动画 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<CheckBox x:Name="ChkKeepAnimation2"
Content="保持动画效果"
IsChecked="True"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="转换时保留ENBX中的动画"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
<!-- 嵌入图片 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<CheckBox x:Name="ChkExtractImages"
Content="提取图片资源"
IsChecked="True"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="将ENBX中的图片提取到PPTX"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
<!-- 保留墨迹 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<CheckBox x:Name="ChkPreserveInk"
Content="保留墨迹数据"
IsChecked="True"
Foreground="{DynamicResource TextPrimaryBrush}"
FontSize="13"
VerticalAlignment="Center"/>
<TextBlock Text="将白板墨迹转为PPT墨迹图层"
FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 转换按钮 -->
<Button x:Name="BtnConvertEnbxToPptx"
Content="开始转换"
Style="{StaticResource ConvertButtonStyle}"
HorizontalAlignment="Center"
IsEnabled="False"
Click="BtnConvertEnbxToPptx_Click"/>
</StackPanel>
<!-- ====== 转换进度区域 ====== -->
<Border x:Name="ConvertProgressPanel"
Background="{DynamicResource CardBackgroundBrush}"
CornerRadius="12"
Padding="20"
Margin="0,20,0,16"
Visibility="Collapsed">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<TextBlock Text="转换进度"
FontSize="15"
FontWeight="SemiBold"
Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock x:Name="ConvertStatusText"
Text="准备中..."
FontSize="13"
Foreground="{DynamicResource TextSecondaryBrush}"
Margin="12,0,0,0"
VerticalAlignment="Center"/>
</StackPanel>
<!-- 进度条(平滑填充) -->
<Border Background="{DynamicResource BackgroundBrush}"
CornerRadius="6"
Height="8"
ClipToBounds="True">
<Grid>
<Rectangle x:Name="ConvertProgressBar"
Fill="{DynamicResource AccentBrush}"
RadiusX="4" RadiusY="4"
HorizontalAlignment="Left"
Width="0"
Height="8"/>
<!-- 进度条光泽动画层 -->
<Rectangle Fill="Transparent" Height="8" RadiusX="4" RadiusY="4"
x:Name="ProgressGlow">
<Rectangle.OpacityMask>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="White" Offset="0.7"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
</Border>
<!-- 百分比显示 -->
<TextBlock x:Name="ConvertPercentText"
Text="0%"
FontSize="24"
FontWeight="Bold"
Foreground="{DynamicResource AccentBrush}"
HorizontalAlignment="Center"
Margin="0,12,0,0"/>
</StackPanel>
</Border>
<!-- ====== 转换完成文件列表 ====== -->
<Border x:Name="ConvertResultPanel"
Background="{DynamicResource CardBackgroundBrush}"
CornerRadius="12"
Padding="20"
Visibility="Collapsed">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
<TextBlock Text="转换结果"
FontSize="15"
FontWeight="SemiBold"
Foreground="{DynamicResource TextPrimaryBrush}"/>
<!-- 成功图标 -->
<Path Data="M0,12 L8,20 L24,4"
Stroke="#4CAF50"
StrokeThickness="2.5"
Fill="Transparent"
Stretch="Uniform"
HorizontalAlignment="Left"
Height="18" Width="24"
Margin="8,0,0,0"
VerticalAlignment="Center"/>
</StackPanel>
<!-- 输出文件信息 -->
<Border Background="{DynamicResource BackgroundBrush}"
CornerRadius="8"
Padding="14"
Margin="0,0,0,8">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
<TextBlock Text="输出文件:"
FontSize="13"
Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock x:Name="OutputFilePath"
Text="-"
FontSize="13"
FontWeight="Medium"
Foreground="{DynamicResource TextPrimaryBrush}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
<TextBlock Text="文件大小:"
FontSize="13"
Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock x:Name="OutputFileSize"
Text="-"
FontSize="13"
FontWeight="Medium"
Foreground="{DynamicResource TextPrimaryBrush}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="耗时:"
FontSize="13"
Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock x:Name="ConvertTime"
Text="-"
FontSize="13"
FontWeight="Medium"
Foreground="{DynamicResource TextPrimaryBrush}"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 打开文件按钮 -->
<Button Content="打开输出文件"
Style="{StaticResource FileSelectButtonStyle}"
HorizontalAlignment="Left"
Click="BtnOpenOutput_Click"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>