From 03f1669d98e1fad81bc4832900ae149ac6510ebc Mon Sep 17 00:00:00 2001 From: Rory& Date: Mon, 29 Jul 2024 22:45:36 +0200 Subject: Initial commit --- ModerationClient/ViewModels/LoginViewModel.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ModerationClient/ViewModels/LoginViewModel.cs (limited to 'ModerationClient/ViewModels/LoginViewModel.cs') diff --git a/ModerationClient/ViewModels/LoginViewModel.cs b/ModerationClient/ViewModels/LoginViewModel.cs new file mode 100644 index 0000000..32f0d6e --- /dev/null +++ b/ModerationClient/ViewModels/LoginViewModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Threading.Tasks; +using ModerationClient.Services; + +namespace ModerationClient.ViewModels; + +public partial class LoginViewModel(MatrixAuthenticationService authService) : ViewModelBase +{ + private Exception? _exception; + public string Username { get; set; } + public string Password { get; set; } + + public Exception? Exception { + get => _exception; + private set => SetProperty(ref _exception, value); + } + + public async Task LoginAsync() { + try { + Exception = null; + await authService.LoginAsync(Username, Password); + } catch (Exception e) { + Exception = e; + } + } +} \ No newline at end of file -- cgit 1.5.1