2025-07-17 17:27:16 +08:00
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2025-07-19 11:11:01 +08:00
|
|
|
using DMS.WPF.Models;
|
|
|
|
|
using DMS.WPF.Models;
|
2025-07-17 17:27:16 +08:00
|
|
|
|
2025-07-19 11:11:01 +08:00
|
|
|
namespace DMS.WPF.ViewModels.Dialogs;
|
2025-07-17 17:27:16 +08:00
|
|
|
|
|
|
|
|
public partial class MqttAliasBatchEditDialogViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string _title = "批量设置MQTT别名";
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private ObservableCollection<VariableMqtt> _variablesToEdit;
|
|
|
|
|
|
|
|
|
|
public Mqtt SelectedMqtt { get; private set; }
|
|
|
|
|
|
2025-07-17 20:13:21 +08:00
|
|
|
public MqttAliasBatchEditDialogViewModel(List<Variable> selectedVariables, Mqtt selectedMqtt)
|
2025-07-17 17:27:16 +08:00
|
|
|
{
|
|
|
|
|
SelectedMqtt = selectedMqtt;
|
|
|
|
|
Title=$"设置:{SelectedMqtt.Name}-MQTT服务器关联变量的别名";
|
|
|
|
|
VariablesToEdit = new ObservableCollection<VariableMqtt>(
|
|
|
|
|
selectedVariables.Select(v => new VariableMqtt(v, selectedMqtt))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MqttAliasBatchEditDialogViewModel()
|
|
|
|
|
{
|
|
|
|
|
// For design time
|
|
|
|
|
VariablesToEdit = new ObservableCollection<VariableMqtt>();
|
|
|
|
|
}
|
|
|
|
|
}
|