添加后台服务是否启动功能

This commit is contained in:
2025-07-07 21:15:27 +08:00
parent c473c500d8
commit 308c50fe15
7 changed files with 141 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using PMSWPF.Enums;
namespace PMSWPF.ViewModels.Dialogs;
public partial class IsActiveDialogViewModel : ObservableObject
{
[ObservableProperty]
private bool? _selectedIsActive;
public IsActiveDialogViewModel(bool? currentIsActive)
{
_selectedIsActive = currentIsActive;
}
[RelayCommand]
private void SelectIsActive(bool isActive)
{
SelectedIsActive = isActive;
}
[RelayCommand]
private void Cancel()
{
SelectedIsActive = null;
}
}

View File

@@ -106,6 +106,34 @@ public partial class SettingViewModel : ViewModelBase
}
}
public bool EnableS7Service
{
get => _connectionSettings.EnableS7Service;
set
{
if (_connectionSettings.EnableS7Service != value)
{
_connectionSettings.EnableS7Service = value;
OnPropertyChanged();
_connectionSettings.Save();
}
}
}
public bool EnableMqttService
{
get => _connectionSettings.EnableMqttService;
set
{
if (_connectionSettings.EnableMqttService != value)
{
_connectionSettings.EnableMqttService = value;
OnPropertyChanged();
_connectionSettings.Save();
}
}
}
[RelayCommand]
private async Task TestConnection()
{