完成修改选定变量的启用状态更改

This commit is contained in:
2025-09-02 18:29:58 +08:00
parent 94aa9b0485
commit 5ce3825fa9
6 changed files with 96 additions and 89 deletions

View File

@@ -1,31 +1,31 @@
using System;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using DMS.Core.Enums;
namespace DMS.WPF.ViewModels.Dialogs;
public partial class IsActiveDialogViewModel : ObservableObject
namespace DMS.WPF.ViewModels.Dialogs
{
[ObservableProperty]
private bool? _selectedIsActive;
public IsActiveDialogViewModel(bool? currentIsActive)
public partial class IsActiveDialogViewModel : DialogViewModelBase<bool?>
{
_selectedIsActive = currentIsActive;
}
[ObservableProperty]
private bool? _selectedIsActive;
[RelayCommand]
private void SelectIsActive(string isActiveString)
{
if (bool.TryParse(isActiveString, out bool isActive))
public IsActiveDialogViewModel(bool currentIsActive)
{
SelectedIsActive = isActive;
SelectedIsActive = currentIsActive;
Title = "修改启用状态";
PrimaryButText = "确定";
}
[RelayCommand]
private void PrimaryButton()
{
Close(SelectedIsActive);
}
[RelayCommand]
private void CancleButton()
{
Close(null);
}
}
[RelayCommand]
private void Cancel()
{
SelectedIsActive = null;
}
}