DreamineVMS 1.0.0.0
Windows PC의 RTSP·USB 카메라 영상을 HLS로 변환해 원격 CCTV Viewer에 전달하는 데스크톱 에이전트입니다.
로딩중...
검색중...
일치하는것 없음
VmsLocalDashboardViewModel.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.Hybrid.Interfaces;
2using Dreamine.Hybrid.State;
5
7
24public sealed class VmsLocalDashboardViewModel : IDisposable
25{
34 private readonly IHybridStateStore<VmsDashboardState> _store;
43 private readonly IHybridMessageBus _bus;
52 private bool _isInitialized;
53
87 IHybridStateStore<VmsDashboardState> store,
88 IHybridMessageBus bus)
89 {
90 _store = store ?? throw new ArgumentNullException(nameof(store));
91 _bus = bus ?? throw new ArgumentNullException(nameof(bus));
92 }
93
102 public event EventHandler? StateChanged;
103
112 public int TotalCameraCount => _store.State.TotalCameraCount;
113
122 public int ConnectedCameraCount => _store.State.ConnectedCameraCount;
123
132 public int RecordingCameraCount => _store.State.RecordingCameraCount;
133
142 public string LastEvent => _store.State.LastEvent;
143
152 public string LastUpdatedText => _store.State.LastUpdated?.ToString("yyyy-MM-dd HH:mm:ss") ?? "-";
153
162 public void Initialize()
163 {
164 if (_isInitialized)
165 {
166 return;
167 }
168
169 _store.StateChanged += OnDashboardStateChanged;
170 _isInitialized = true;
171 }
172
189 public Task RefreshAsync()
190 {
192 }
193
210 public Task StartAllAsync()
211 {
213 }
214
231 public Task StopAllAsync()
232 {
234 }
235
252 public Task ClearLogsAsync()
253 {
255 }
256
281 private Task PublishAsync(string action)
282 {
283 return _bus.PublishAsync(new VmsDashboardActionRequestedMessage
284 {
285 Action = action
286 });
287 }
288
297 public void Dispose()
298 {
299 if (!_isInitialized)
300 {
301 return;
302 }
303
304 _store.StateChanged -= OnDashboardStateChanged;
305 _isInitialized = false;
306 }
307
333 object? sender,
334 HybridStateChangedEventArgs<VmsDashboardState> e)
335 {
337 }
338
347 private void NotifyStateChanged()
348 {
349 StateChanged?.Invoke(this, EventArgs.Empty);
350 }
351}
void OnDashboardStateChanged(object? sender, HybridStateChangedEventArgs< VmsDashboardState > e)
VmsLocalDashboardViewModel(IHybridStateStore< VmsDashboardState > store, IHybridMessageBus bus)
readonly IHybridStateStore< VmsDashboardState > _store