about summary refs log tree commit diff
path: root/ModerationClient/ViewModels/ClientViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ModerationClient/ViewModels/ClientViewModel.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/ModerationClient/ViewModels/ClientViewModel.cs b/ModerationClient/ViewModels/ClientViewModel.cs
new file mode 100644

index 0000000..340eb56 --- /dev/null +++ b/ModerationClient/ViewModels/ClientViewModel.cs
@@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using ArcaneLibs.Collections; +using LibMatrix.Helpers; +using LibMatrix.Responses; +using Microsoft.Extensions.Logging; +using ModerationClient.Services; + +namespace ModerationClient.ViewModels; + +public partial class ClientViewModel : ViewModelBase +{ + public ClientViewModel(ILogger<ClientViewModel> logger, MatrixAuthenticationService authService) { + this.logger = logger; + this.authService = authService; + _ = Task.Run(Run); + } + + private readonly ILogger<ClientViewModel> logger; + private readonly MatrixAuthenticationService authService; + + private Exception? _exception; + + public Exception? Exception { + get => _exception; + private set => SetProperty(ref _exception, value); + } + + public ObservableCollection<SpaceNode> DisplayedSpaces { get; } = [ + new SpaceNode { Name = "Root", Children = [ + new SpaceNode { Name = "Child 1" }, + new SpaceNode { Name = "Child 2" }, + new SpaceNode { Name = "Child 3" } + ] }, + new SpaceNode { Name = "Root 2", Children = [ + new SpaceNode { Name = "Child 4" }, + new SpaceNode { Name = "Child 5" }, + new SpaceNode { Name = "Child 6" } + ] } + ]; + + public async Task Run() { + var sh = new SyncStateResolver(authService.Homeserver, logger); + // var res = await sh.SyncAsync(); + while (true) { + var res = await sh.ContinueAsync(); + Console.WriteLine("mow"); + } + } + + private void ApplySpaceChanges(SyncResponse newSync) { + List<string> handledRoomIds = []; + + } +} + +public class SpaceNode { + public string Name { get; set; } + public ObservableCollection<SpaceNode> Children { get; set; } = []; +} \ No newline at end of file