2025-07-17 17:27:16 +08:00
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
|
|
2025-07-19 11:11:01 +08:00
|
|
|
|
namespace DMS.WPF.ViewModels.Dialogs;
|
2025-07-17 17:27:16 +08:00
|
|
|
|
|
2025-09-06 12:03:39 +08:00
|
|
|
|
public partial class MqttAliasDialogViewModel : DialogViewModelBase<string>
|
2025-07-17 17:27:16 +08:00
|
|
|
|
{
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string _title = "设置MQTT别名";
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string _message = "请输入变量在该MQTT服务器上的别名:";
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string _variableName = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string _mqttServerName = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
private string _mqttAlias = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
public MqttAliasDialogViewModel(string variableName, string mqttServerName)
|
|
|
|
|
|
{
|
|
|
|
|
|
VariableName = variableName;
|
|
|
|
|
|
MqttServerName = mqttServerName;
|
|
|
|
|
|
Message = $"请输入变量 '{VariableName}' 在MQTT服务器 '{MqttServerName}' 上的别名:";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public MqttAliasDialogViewModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-09-06 12:03:39 +08:00
|
|
|
|
|
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
|
private void Confirm()
|
|
|
|
|
|
{
|
|
|
|
|
|
Close(MqttAlias);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
|
private void Cancel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Close(null);
|
|
|
|
|
|
}
|
2025-07-17 17:27:16 +08:00
|
|
|
|
}
|