about summary refs log tree commit diff
path: root/MatrixRoomUtils.Desktop/MainWindow.axaml
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/MainWindow.axaml
parentDebug validation api (diff)
downloadMatrixUtils-cf6f87bea88df3f90e33dfdc5bb16f47b8716054.tar.xz
Start of MRU Desktop
Diffstat (limited to '')
-rw-r--r--MatrixRoomUtils.Desktop/MainWindow.axaml17
-rw-r--r--MatrixRoomUtils.Desktop/MainWindow.axaml.cs41
2 files changed, 58 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Desktop/MainWindow.axaml b/MatrixRoomUtils.Desktop/MainWindow.axaml
new file mode 100644

index 0000000..bc01bee --- /dev/null +++ b/MatrixRoomUtils.Desktop/MainWindow.axaml
@@ -0,0 +1,17 @@ +<Window xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:Class="MatrixRoomUtils.Desktop.MainWindow" + Title="Rory&amp;::MatrixRoomUtils"> + <!-- <Interaction.Behaviors> --> + <!-- <EventTriggerBehavior EventName="Loaded"> --> + <!-- <InvokeCommandAction Command="{Binding LoadedCommand}"></InvokeCommandAction> --> + <!-- </EventTriggerBehavior> --> + <!-- </Interaction.Behaviors> --> + <StackPanel> + <Label FontSize="24">Rooms</Label> + <StackPanel x:Name="roomList" Orientation="Vertical"/> + </StackPanel> +</Window> 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"); + // } +}