diff options
author | Emma@Rory& <root@rory.gay> | 2023-07-26 21:02:50 +0200 |
---|---|---|
committer | Emma@Rory& <root@rory.gay> | 2023-07-26 21:02:50 +0200 |
commit | 2e89a0717a60598904c92499adb7e01b2075fbb9 (patch) | |
tree | 56b9b7f07180154d9d98dafa91d7c16a0a872100 /MatrixRoomUtils.Desktop/MainWindow.axaml.cs | |
parent | Start of nix flake (diff) | |
download | MatrixUtils-2e89a0717a60598904c92499adb7e01b2075fbb9.tar.xz |
MRU desktop start
Diffstat (limited to 'MatrixRoomUtils.Desktop/MainWindow.axaml.cs')
-rw-r--r-- | MatrixRoomUtils.Desktop/MainWindow.axaml.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Desktop/MainWindow.axaml.cs b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs index 41e0888..f89bbfa 100644 --- a/MatrixRoomUtils.Desktop/MainWindow.axaml.cs +++ b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs @@ -1,5 +1,7 @@ using Avalonia.Controls; +using Avalonia.Data; using Avalonia.Interactivity; +using MatrixRoomUtils.Web.Classes; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -7,13 +9,18 @@ namespace MatrixRoomUtils.Desktop; public partial class MainWindow : Window { private readonly ILogger<MainWindow> _logger; + private readonly IServiceScopeFactory _scopeFactory; private readonly MRUStorageWrapper _storageWrapper; private readonly MRUDesktopConfiguration _configuration; + public static MainWindow Instance { get; private set; } = null!; - public MainWindow(ILogger<MainWindow> logger, IServiceScopeFactory scopeFactory) { + public MainWindow(ILogger<MainWindow> logger, IServiceScopeFactory scopeFactory, SentryService _) { + Instance = this; _logger = logger; + _scopeFactory = scopeFactory; _configuration = scopeFactory.CreateScope().ServiceProvider.GetRequiredService<MRUDesktopConfiguration>(); _storageWrapper = scopeFactory.CreateScope().ServiceProvider.GetRequiredService<MRUStorageWrapper>(); + _logger.LogInformation("Initialising MainWindow"); InitializeComponent(); @@ -22,15 +29,19 @@ public partial class MainWindow : Window { _logger.LogInformation("Data location: " + _configuration.DataStoragePath); - for (int i = 0; i < 100; i++) { - roomList.Children.Add(new RoomListEntry()); - } + // for (int i = 0; i < 100; i++) { + // roomList.Children.Add(new RoomListEntry()); + // } } // ReSharper disable once AsyncVoidMethod protected override async void OnLoaded(RoutedEventArgs e) { _logger.LogInformation("async onloaded override"); var hs = await _storageWrapper.GetCurrentSessionOrPrompt(); + var rooms = await hs.GetJoinedRooms(); + foreach (var room in rooms) { + roomList.Children.Add(new RoomListEntry(_scopeFactory, new RoomInfo(room))); + } base.OnLoaded(e); } |