Files
IOT/LAEPS/ViewModels/LoginViewModel.cs
2025-12-23 10:55:34 +08:00

41 lines
1.1 KiB
C#

using LAEPS.PubEvent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace LAEPS.ViewModels
{
public class LoginViewModel:BindableBase
{
#region
private string _Password;
public string Password
{
get => _Password;
set => SetProperty(ref _Password, value);
}
private string _Account;
public string Account
{
get => _Account;
set => SetProperty(ref _Account, value);
}
#endregion
public ICommand LoginCommand { get; set; }
private IEventAggregator _eventAggregator;
public LoginViewModel(IContainerProvider containerProvider)
{
_eventAggregator = containerProvider.Resolve<IEventAggregator>();
LoginCommand = new AsyncDelegateCommand(OnLogin);
}
private async Task OnLogin()
{
_eventAggregator.GetEvent<LoginSuccessEvent>().Publish();
}
}
}