blob: 340eb565fae092cde0111a4320598686dd651f23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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; } = [];
}
|