From e6c09e2309576e1207d060583997379f863cd64c Mon Sep 17 00:00:00 2001 From: xiang Date: Sun, 27 Oct 2024 12:00:50 +0800 Subject: [PATCH] update --- App.xaml | 10 ++++++++- MainWindow.xaml | 53 ++++++++++++++++------------------------------ MainWindow.xaml.cs | 6 ++++-- Task.cs | 34 +++++++++++++++++++++++++++++ Video.xaml | 18 ++++++++++++++++ Video.xaml.cs | 33 +++++++++++++++++++++++++++++ VideoConcat.csproj | 1 + 7 files changed, 117 insertions(+), 38 deletions(-) create mode 100644 Task.cs create mode 100644 Video.xaml create mode 100644 Video.xaml.cs diff --git a/App.xaml b/App.xaml index 89636e1..04fef6d 100644 --- a/App.xaml +++ b/App.xaml @@ -2,8 +2,16 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:VideoConcat" + xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers" StartupUri="MainWindow.xaml"> - + + + + + + + + diff --git a/MainWindow.xaml b/MainWindow.xaml index 2342266..f89e377 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -6,9 +6,9 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:VideoConcat" mc:Ignorable="d" - Title="登录" Height="450" Width="800" + Title="登录" Height="300" Width="500" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" - WindowStyle="None"> + > @@ -20,63 +20,46 @@ - - - - - - - - + + - - - - - + + + FontSize="38" TextAlignment="Center"> 用户登录 - + - + - + - + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 6687c52..5f86e7b 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -27,10 +27,12 @@ namespace VideoConcat } private void BtnLogin_Click(object sender, RoutedEventArgs e) - { + { Video video = new(); + video.Show(); if (txtUserName.Text == "admin" && txtPassword.Password == "123456") { - MessageBox.Show("登录成功"); + + this.Close(); return; } MessageBox.Show("用户名或者密码错误!"); diff --git a/Task.cs b/Task.cs new file mode 100644 index 0000000..9e1f0ff --- /dev/null +++ b/Task.cs @@ -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; + }); + + } + } + +} diff --git a/Video.xaml b/Video.xaml new file mode 100644 index 0000000..f8a05f4 --- /dev/null +++ b/Video.xaml @@ -0,0 +1,18 @@ + + + +