about summary refs log tree commit diff
path: root/MatrixRoomUtils.Desktop/LoginWindow.axaml.cs
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-07-24 20:57:23 +0200
committerEmma@Rory& <root@rory.gay>2023-07-24 20:57:23 +0200
commitcf6f87bea88df3f90e33dfdc5bb16f47b8716054 (patch)
tree92605891ae683d91f1d71a725d1c94f6675be43b /MatrixRoomUtils.Desktop/LoginWindow.axaml.cs
parentDebug validation api (diff)
downloadMatrixUtils-cf6f87bea88df3f90e33dfdc5bb16f47b8716054.tar.xz
Start of MRU Desktop
Diffstat (limited to 'MatrixRoomUtils.Desktop/LoginWindow.axaml.cs')
-rw-r--r--MatrixRoomUtils.Desktop/LoginWindow.axaml.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Desktop/LoginWindow.axaml.cs b/MatrixRoomUtils.Desktop/LoginWindow.axaml.cs
new file mode 100644

index 0000000..1f31b05 --- /dev/null +++ b/MatrixRoomUtils.Desktop/LoginWindow.axaml.cs
@@ -0,0 +1,36 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; + +namespace MatrixRoomUtils.Desktop; + +public partial class LoginWindow : Window { + private readonly MRUStorageWrapper _storage; + + public LoginWindow(MRUStorageWrapper storage) { + _storage = storage; + InitializeComponent(); +#if DEBUG + this.AttachDevTools(); +#endif + } + + private void InitializeComponent() { + AvaloniaXamlLoader.Load(this); + } + + public string Username { get; set; } + public string Password { get; set; } + // ReSharper disable once AsyncVoidMethod + private async void Login(object? sender, RoutedEventArgs e) { + var res = await _storage.Login(Username.Split(':')[1], Username.Split(':')[0][1..], Password); + if (res is not null) { + await _storage.AddToken(res); + Close(); + } + else { + Password = ""; + } + } +}