| Name | Message | Date |
|---|---|---|
| 📁 Panels | 1 month ago | |
| 📄 MainViewModel.cs | 1 month ago | |
| 📄 ServiceCollectionExtensions.cs | 1 month ago | |
| 📄 ViewModelBase.cs | 1 month ago |
📄
src/App/ViewModels/MainViewModel.cs
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
64
65
66
67
using System; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using MMirror.App.ViewModels.Panels; using MMirror.Integrations.FaceCamera; namespace MMirror.App.ViewModels; public partial class MainViewModel : ViewModelBase { private readonly FaceDetectionService faceDetectionService; [ObservableProperty] public partial bool FaceNear { get; set; } public ViewModelBase Olskrokstorget { get; } public ViewModelBase Svingeln { get; } public ViewModelBase UpperRight { get; } public MainViewModel( FaceDetectionService faceDetectionService, VasttrafikPanelViewModel olskrokstorget, VasttrafikPanelViewModel svingeln, DateTimePanelViewModel dateTimePanelViewModel ) { this.faceDetectionService = faceDetectionService; olskrokstorget.StopName = "Olskrokstorget"; olskrokstorget.StopId = "9021014005160000"; Olskrokstorget = olskrokstorget; svingeln.StopName = "Svingeln"; svingeln.StopId = "9021014006480000"; svingeln.Platforms = ["C", "D", "E", "F", "G"]; Svingeln = svingeln; UpperRight = dateTimePanelViewModel; } public void Watch() { faceDetectionService.FaceDetected += OnFaceDetected; } private void OnFaceDetected(bool isFaceDetected) => FaceNear = isFaceDetected; public void UnWatch() { faceDetectionService.FaceDetected -= OnFaceDetected; } } internal static class MainViewModelServiceCollectionExtensions { extension(IServiceCollection services) { public IServiceCollection AddMainViewModel() { services.TryAddSingleton(TimeProvider.System); services.AddTransient<MainViewModel>(); return services; } } }