update
This commit is contained in:
parent
546c248535
commit
b6788f4a37
@ -10,6 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="log4net" Version="3.0.2" />
|
<PackageReference Include="log4net" Version="3.0.2" />
|
||||||
<PackageReference Include="MaterialDesignXaml.DialogsHelper" Version="1.0.4" />
|
<PackageReference Include="MaterialDesignXaml.DialogsHelper" Version="1.0.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||||
|
|||||||
@ -1,21 +1,42 @@
|
|||||||
using System;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using System.Collections.Generic;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using System.Linq;
|
using System.Windows;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VideoConcat.Models;
|
|
||||||
|
|
||||||
namespace VideoConcat.ViewModels
|
namespace VideoConcat.ViewModels
|
||||||
{
|
{
|
||||||
internal class MainWindowViewModel
|
public partial class MainWindowViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
|
private string? _username;
|
||||||
|
private string? _password;
|
||||||
|
|
||||||
public MainWindowModel MainWindowsModel { get; set; } = new MainWindowModel();
|
public string Username
|
||||||
|
|
||||||
public void Login()
|
|
||||||
{
|
{
|
||||||
string? userName = MainWindowsModel.Username;
|
get => _username ?? "";
|
||||||
string? passWord = MainWindowsModel.Password;
|
set => SetProperty(ref _username, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get => _password ?? "";
|
||||||
|
set => SetProperty(ref _password, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task LoginAsync()
|
||||||
|
{
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
// 模拟登录逻辑
|
||||||
|
if (Username == "admin" && Password == "password")
|
||||||
|
{
|
||||||
|
MessageBox.Show("登录成功!");
|
||||||
|
// 这里可以导航到主页面或其他操作
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("用户名或密码错误!");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,8 +62,7 @@
|
|||||||
CaretBrush="#FFD94448"
|
CaretBrush="#FFD94448"
|
||||||
SelectionBrush="#FFD94448"
|
SelectionBrush="#FFD94448"
|
||||||
materialDesign:HintAssist.Hint="输入 密码"
|
materialDesign:HintAssist.Hint="输入 密码"
|
||||||
Password="{Binding MainWindowModel.Password}">
|
x:Name="PasswordBox"/>
|
||||||
</PasswordBox>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="10"
|
<StackPanel Margin="10"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|||||||
@ -12,12 +12,12 @@ namespace VideoConcat.Views
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new MainWindowModel();
|
DataContext = new MainWindowModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnExit_Click(object sender, RoutedEventArgs e)
|
private void BtnExit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnLogin_Click(object sender, RoutedEventArgs e)
|
private void BtnLogin_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user