This commit is contained in:
xiang 2024-10-28 21:50:53 +08:00
parent 8220e07fe6
commit 9a844c02b9
3 changed files with 73 additions and 21 deletions

View File

@ -27,11 +27,12 @@ namespace VideoConcat
}
private void BtnLogin_Click(object sender, RoutedEventArgs e)
{ Video video = new();
video.Show();
{
Video video = new();
video.Show();
if (txtUserName.Text == "admin" && txtPassword.Password == "123456")
{
this.Close();
return;
}

View File

@ -1,16 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using System.IO;
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
{
@ -19,31 +10,33 @@ namespace VideoConcat
/// </summary>
public partial class Video : Window
{
public string text = "";
public Video()
{
InitializeComponent();
Check_Folder();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
startButton.IsEnabled = false;
await Task.Run(() =>
{
string text = "";
for (int i = 0; i <= 100; i++)
{
Application.Current.Dispatcher.Invoke(() =>
System.Windows.Application.Current.Dispatcher.Invoke(() =>
{
processVideoBar.Dispatcher.Invoke(() =>
{
processVideoBar.Value = i;
});
outputTxt.Dispatcher.Invoke(new Action(() =>
{
text += "正在生成第" + i + "个视频\r\n";
outputTxt.Text = text;
scrowText.ScrollToEnd();
WriteTxt("正在生成第" + i + "个视频");
}));
});
System.Threading.Thread.Sleep(50);
@ -56,5 +49,56 @@ namespace VideoConcat
});//ProcessVideo.RunTask(processVideoBar, startButton)
}
private void Check_Folder()
{
Boolean hasHead;
Boolean hasTail;
string currentPath = Directory.GetCurrentDirectory();
DirectoryInfo? parentPathInfo = Directory.GetParent(currentPath);
if (parentPathInfo == null)
{
WriteTxt("获取相关视频文件目录失败!");
return;
}
WriteTxt(parentPathInfo.FullName);
try
{
DirectoryInfo dirD = parentPathInfo as DirectoryInfo;
FileSystemInfo[] folders = dirD.GetDirectories();//获取文件夹下所有文件和文件夹
//对单个FileSystemInfo进行判断如果是文件夹则进行递归操作
foreach (FileSystemInfo folder in folders)
{
WriteTxt($"{folder.Name}");
if (folder.Name == "head")
{
hasHead = true;
}
if (folder.Name == "tail")
{
hasTail = true;
}
}
//if (hasHead)
//{
// WriteTxt("存在head文件夹");
//}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
private void WriteTxt(string str)
{
text += str + "\r\n";
outputTxt.Text = text;
scrowText.ScrollToEnd();
}
}
}

View File

@ -10,7 +10,14 @@
<ItemGroup>
<PackageReference Include="MaterialDesignXaml.DialogsHelper" Version="1.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="WPFDevelopers" Version="0.0.0.1" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</ApplicationDefinition>
</ItemGroup>
</Project>