This commit is contained in:
xiang 2024-10-27 12:00:50 +08:00
parent 1326c7385f
commit e6c09e2309
7 changed files with 117 additions and 38 deletions

View File

@ -2,8 +2,16 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VideoConcat" xmlns:local="clr-namespace:VideoConcat"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml"/>
<!--需要注意 wd:Resources 必须在配色主题后Theme="Dark" 为黑色皮肤-->
<wd:Resources Theme="Light"/>
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

View File

@ -6,9 +6,9 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:VideoConcat" xmlns:local="clr-namespace:VideoConcat"
mc:Ignorable="d" mc:Ignorable="d"
Title="登录" Height="450" Width="800" Title="登录" Height="300" Width="500"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
WindowStyle="None"> >
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
@ -20,63 +20,46 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
<Grid MouseDown="Grid_MouseDown"> <Grid >
<Grid.Background> <Border>
<LinearGradientBrush StartPoint="0.1,0" EndPoint="0.9,1">
<GradientStop Offset="1" Color="#FFE63070"/>
<GradientStop Offset="0" Color="#FFFE8704"/>
</LinearGradientBrush>
</Grid.Background>
<Border Height="390" VerticalAlignment="Top"
Background="#220000" CornerRadius="0 0 180 0">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<StackPanel Width="350"> <StackPanel Width="500">
<!-- <Image Width="300" Height="300" Margin="30" VerticalAlignment="Top" Stretch="Fill" Source="pack://application:,,,/VideoConcat;component/Images/left.png"/>--> <StackPanel >
</StackPanel>
<StackPanel Width="350">
<StackPanel Margin="20,40">
<TextBlock Margin="20" FontFamily="Great Vibes" <TextBlock Margin="20" FontFamily="Great Vibes"
FontSize="38" Foreground="White" TextAlignment="Center"> FontSize="38" TextAlignment="Center">
用户登录 用户登录
</TextBlock> </TextBlock>
<StackPanel Margin="10" Orientation="Horizontal"> <StackPanel Margin="10" Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon
Width="25" Height="25" Foreground="White" Width="30" Height="30"
Kind="User"/> Kind="User" Margin="10,0,10,0"/>
<TextBox x:Name="txtUserName" Width="250" <TextBox x:Name="txtUserName" Width="400"
Margin="10,0" BorderBrush="White" Margin="10,0" BorderBrush="White"
CaretBrush="#FFD94448" Foreground="White" CaretBrush="#FFD94448"
SelectionBrush="#FFD94448" SelectionBrush="#FFD94448"
materialDesign:HintAssist.Hint="输入 用户名"/> materialDesign:HintAssist.Hint="输入 用户名"/>
</StackPanel> </StackPanel>
<StackPanel Margin="10" Orientation="Horizontal"> <StackPanel Margin="10" Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon
Width="25" Height="25" Foreground="White" Width="30" Height="30"
Kind="Lock"/> Kind="Lock" Margin="10,0,10,0"/>
<PasswordBox x:Name="txtPassword" Width="250" <PasswordBox x:Name="txtPassword" Width="400"
Margin="10,0" BorderBrush="White" Margin="10,0" BorderBrush="White"
CaretBrush="#FFD94448" Foreground="White" CaretBrush="#FFD94448"
SelectionBrush="#FFD94448" SelectionBrush="#FFD94448"
materialDesign:HintAssist.Hint="输入 密码" materialDesign:HintAssist.Hint="输入 密码"
/> />
</StackPanel> </StackPanel>
<StackPanel Margin="10" HorizontalAlignment="Center"> <StackPanel Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="btnLogin" Width="100" Height="40" <Button x:Name="btnLogin" Width="100" Height="40"
materialDesign:ButtonAssist.CornerRadius="10" materialDesign:ButtonAssist.CornerRadius="10"
Background="#D94448" BorderBrush="#D94448" BorderThickness="2" Background="#D94448" BorderBrush="#D94448" BorderThickness="2"
Content="登录" Foreground="White" ToolTip="登录" Content="登录" ToolTip="登录"
Style="{StaticResource MaterialDesignRaisedButton}" Click="BtnLogin_Click"/> Style="{StaticResource MaterialDesignRaisedButton}" Click="BtnLogin_Click"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<StackPanel Width="100">
<Button x:Name="btnExit" Margin="5,10" Background="{x:Null}"
Click="BtnExit_Click" Style="{StaticResource MaterialDesignFloatingActionButton}"
ToolTip="关闭" Height="36" Width="36">
<materialDesign:PackIcon Width="20" Height="20"
Foreground="White" Kind="Close"/>
</Button>
</StackPanel>
</StackPanel> </StackPanel>
</Border> </Border>

View File

@ -27,10 +27,12 @@ namespace VideoConcat
} }
private void BtnLogin_Click(object sender, RoutedEventArgs e) private void BtnLogin_Click(object sender, RoutedEventArgs e)
{ { Video video = new();
video.Show();
if (txtUserName.Text == "admin" && txtPassword.Password == "123456") if (txtUserName.Text == "admin" && txtPassword.Password == "123456")
{ {
MessageBox.Show("登录成功");
this.Close();
return; return;
} }
MessageBox.Show("用户名或者密码错误!"); MessageBox.Show("用户名或者密码错误!");

34
Task.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace VideoConcat
{
public static class ProcessVideo
{
public static void RunTask(System.Windows.Controls.ProgressBar progressBar, System.Windows.Controls.Button btn)
{
for (int i = 0; i <= 100; i++)
{
Application.Current.Dispatcher.Invoke(() =>
{
progressBar.Dispatcher.Invoke(() =>
{
progressBar.Value = i;
});
});
System.Threading.Thread.Sleep(50);
}
btn.Dispatcher.Invoke(() =>
{
btn.IsEnabled = true;
});
}
}
}

18
Video.xaml Normal file
View File

@ -0,0 +1,18 @@
<Window x:Class="VideoConcat.Video"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:VideoConcat"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
mc:Ignorable="d"
Title="视频" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" >
<Grid>
<StackPanel>
<Button Content="开始拼接" VerticalAlignment="Top" Height="30" Click="Button_Click" x:Name="startButton" Margin="5"/>
<TextBlock Margin="5" TextWrapping="Wrap" Text="" Height="auto" x:Name="outputTxt"/>
</StackPanel>
<ProgressBar x:Name="processVideoBar" Minimum="0" Maximum="100" Value="0" VerticalAlignment="Bottom" Height="10" Margin="5"/>
</Grid>
</Window>

33
Video.xaml.cs Normal file
View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace VideoConcat
{
/// <summary>
/// Video.xaml 的交互逻辑
/// </summary>
public partial class Video : Window
{
public Video()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
startButton.IsEnabled = false;
await Task.Run(() => ProcessVideo.RunTask(processVideoBar, startButton));
}
}
}

View File

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignXaml.DialogsHelper" Version="1.0.4" /> <PackageReference Include="MaterialDesignXaml.DialogsHelper" Version="1.0.4" />
<PackageReference Include="WPFDevelopers" Version="0.0.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>