设备编辑管理界面

This commit is contained in:
hsc
2026-06-12 10:00:13 +08:00
parent ffb22e1f20
commit 02d9923474
23 changed files with 2098 additions and 16 deletions

View File

@@ -0,0 +1,60 @@
using Prism.Commands;
using Prism.Mvvm;
using System;
namespace DeviceEditModule.ViewModels
{
/// <summary>
/// 弹窗管理器中单个 Tab 项的 ViewModel。
/// 由 <see cref="DialogMangerViewModel"/> 在收到 AddDialogTabEvent 时创建,
/// 通过构造函数注入选中/关闭的回调,保持与父 ViewModel 的低耦合。
/// </summary>
public class DialogTabItemVM : BindableBase
{
#region
private string _title = string.Empty;
/// <summary>Tab 标签页上显示的标题。</summary>
public string Title
{
get => _title;
set => SetProperty(ref _title, value);
}
private object? _content;
/// <summary>Tab 内容区域(通常为 UserControl 实例)。</summary>
public object? Content
{
get => _content;
set => SetProperty(ref _content, value);
}
private bool _isSelected;
/// <summary>是否为当前激活 Tab用于切换选中态样式。</summary>
public bool IsSelected
{
get => _isSelected;
set => SetProperty(ref _isSelected, value);
}
#endregion
#region
/// <summary>点击 Tab 标题激活该 Tab。</summary>
public DelegateCommand SelectCommand { get; }
/// <summary>点击 Tab 上的 × 关闭并移除该 Tab。</summary>
public DelegateCommand CloseCommand { get; }
#endregion
/// <param name="onSelect">父 VM 提供的激活回调。</param>
/// <param name="onClose">父 VM 提供的关闭回调。</param>
public DialogTabItemVM(Action<DialogTabItemVM> onSelect, Action<DialogTabItemVM> onClose)
{
SelectCommand = new DelegateCommand(() => onSelect(this));
CloseCommand = new DelegateCommand(() => onClose(this));
}
}
}