about summary refs log tree commit diff
path: root/MatrixRoomUtils.Desktop/MainWindow.axaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Desktop/MainWindow.axaml.cs')
-rw-r--r--MatrixRoomUtils.Desktop/MainWindow.axaml.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Desktop/MainWindow.axaml.cs b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs
new file mode 100644
index 0000000..41e0888
--- /dev/null
+++ b/MatrixRoomUtils.Desktop/MainWindow.axaml.cs
@@ -0,0 +1,41 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+
+namespace MatrixRoomUtils.Desktop;
+
+public partial class MainWindow : Window {
+    private readonly ILogger<MainWindow> _logger;
+    private readonly MRUStorageWrapper _storageWrapper;
+    private readonly MRUDesktopConfiguration _configuration;
+
+    public MainWindow(ILogger<MainWindow> logger, IServiceScopeFactory scopeFactory) {
+        _logger = logger;
+        _configuration = scopeFactory.CreateScope().ServiceProvider.GetRequiredService<MRUDesktopConfiguration>();
+        _storageWrapper = scopeFactory.CreateScope().ServiceProvider.GetRequiredService<MRUStorageWrapper>();
+        _logger.LogInformation("Initialising MainWindow");
+
+        InitializeComponent();
+
+        _logger.LogInformation("Cache location: " + _configuration.CacheStoragePath);
+        _logger.LogInformation("Data location: " + _configuration.DataStoragePath);
+
+
+        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();
+        base.OnLoaded(e);
+    }
+
+    // public Command
+    // protected void LoadedCommand() {
+        // _logger.LogInformation("async command");
+    // }
+}