VideoConcat/ViewModels/MainWindowViewModel.cs
2024-12-23 15:00:52 +08:00

43 lines
1.1 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.Windows;
namespace VideoConcat.ViewModels
{
public partial class MainWindowViewModel : ObservableObject
{
private string? _username;
private string? _password;
public string Username
{
get => _username ?? "";
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("用户名或密码错误!");
}
});
}
}
}