Files
HawkeyeVision/VisionBuilder.UI.Common/ViewModel/MainWindowVM.cs
2025-07-19 15:57:59 +02:00

52 lines
1.3 KiB
C#

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using VisionBuilder.UI.Common.Commands;
using VisionBuilder.UI.Common.Commands.Interfaces;
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
namespace VisionBuilder.UI.Common.ViewModel;
public partial class MainWindowVM:ObservableObject
{
private readonly ISettingsService _settingsService;
public event Action ProgramStarted = delegate { };
public event Action ProgramClosed = delegate { };
public event Action<bool> TestModeChanged = delegate { };
[ObservableProperty]
private bool _testMode;
public MainWindowVM(ISettingsService settingsService)
{
_settingsService = settingsService;
}
public ObservableCollection<SingleCameraVM> SingleCameraVms { get; set; } =
new ObservableCollection<SingleCameraVM>();
[RelayCommand]
public void Settings()
{
_settingsService.ShowSettingsDialog();
}
[RelayCommand]
public void ToggleTestMode()
{
TestMode = !TestMode;
TestModeChanged(TestMode);
}
public void OnProgramStarted()
{
ProgramStarted?.Invoke();
}
public void OnProgramClosed()
{
ProgramClosed?.Invoke();
}
}