优化设置界面Tcp显示
This commit is contained in:
@@ -8,14 +8,14 @@ using UIShare.ViewModelBase;
|
|||||||
namespace SettingModule.ViewModels.Dialogs
|
namespace SettingModule.ViewModels.Dialogs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TCP 连接配置对话框 VM。
|
/// Tcp 连接配置对话框 VM。
|
||||||
/// 通过 DialogParameters 接收宿主 DeviceInfoVM;保存时把副本写回宿主。
|
/// 通过 DialogParameters 接收宿主 DeviceInfoVM;保存时把副本写回宿主。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TCPConfigViewModel : DialogViewModelBase
|
public class TCPConfigViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
#region 属性
|
#region 属性
|
||||||
|
|
||||||
private string _title = "TCP 连接配置";
|
private string _title = "Tcp 连接配置";
|
||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
get => _title;
|
get => _title;
|
||||||
@@ -105,7 +105,7 @@ namespace SettingModule.ViewModels.Dialogs
|
|||||||
{
|
{
|
||||||
_hostDevice.TcpConfig ??= new TcpConfigVM();
|
_hostDevice.TcpConfig ??= new TcpConfigVM();
|
||||||
Config.CopyTo(_hostDevice.TcpConfig);
|
Config.CopyTo(_hostDevice.TcpConfig);
|
||||||
_hostDevice.ConnectionType = "TCP";
|
_hostDevice.ConnectionType = "Tcp";
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestClose.Invoke(ButtonResult.OK);
|
RequestClose.Invoke(ButtonResult.OK);
|
||||||
@@ -121,7 +121,7 @@ namespace SettingModule.ViewModels.Dialogs
|
|||||||
if (parameters.ContainsKey("Device"))
|
if (parameters.ContainsKey("Device"))
|
||||||
{
|
{
|
||||||
_hostDevice = parameters.GetValue<DeviceInfoVM>("Device");
|
_hostDevice = parameters.GetValue<DeviceInfoVM>("Device");
|
||||||
Title = $"TCP 连接配置 - {_hostDevice?.DeviceName}";
|
Title = $"Tcp 连接配置 - {_hostDevice?.DeviceName}";
|
||||||
Config = new TcpConfigVM(_hostDevice?.TcpConfig);
|
Config = new TcpConfigVM(_hostDevice?.TcpConfig);
|
||||||
}
|
}
|
||||||
else if (parameters.ContainsKey("Config"))
|
else if (parameters.ContainsKey("Config"))
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace SettingModule.ViewModels
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打开"连接配置"对话框。按 SelectedDevice.ConnectionType 决定开 TCP 还是串口对话框。
|
/// 打开"连接配置"对话框。按 SelectedDevice.ConnectionType 决定开 Tcp 还是串口对话框。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnOpenConnectionConfig()
|
private void OnOpenConnectionConfig()
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ namespace SettingModule.ViewModels
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(dialogName))
|
if (string.IsNullOrEmpty(dialogName))
|
||||||
{
|
{
|
||||||
StatusMessage = "当前设备未配置连接方式(请先选择 TCP 或 Serial)";
|
StatusMessage = "当前设备未配置连接方式(请先选择 Tcp 或 Serial)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -310,20 +310,20 @@
|
|||||||
<ComboBox materialDesign:HintAssist.Hint="" Grid.Row="0" Grid.Column="1"
|
<ComboBox materialDesign:HintAssist.Hint="" Grid.Row="0" Grid.Column="1"
|
||||||
Margin="0,4"
|
Margin="0,4"
|
||||||
ItemsSource="{Binding ConnectionTypes}"
|
ItemsSource="{Binding ConnectionTypes}"
|
||||||
SelectedItem="{Binding SelectedDevice.ConnectionType}"/>
|
SelectedItem="{Binding SelectedDevice.ConnectionType,Mode=TwoWay}"/>
|
||||||
<Button Grid.Row="0" Grid.Column="2"
|
<Button Grid.Row="0" Grid.Column="2"
|
||||||
Content="配置..."
|
Content="配置..."
|
||||||
Margin="8,4,0,4" Padding="14,2"
|
Margin="8,4,0,4" Padding="14,2"
|
||||||
Command="{Binding OpenConnectionConfigCommand}"/>
|
Command="{Binding OpenConnectionConfigCommand}"/>
|
||||||
|
|
||||||
<!-- TCP 参数预览 -->
|
<!-- Tcp 参数预览 -->
|
||||||
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||||
Margin="0,4,0,0" Orientation="Horizontal">
|
Margin="0,4,0,0" Orientation="Horizontal">
|
||||||
<StackPanel.Style>
|
<StackPanel.Style>
|
||||||
<Style TargetType="StackPanel">
|
<Style TargetType="StackPanel">
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding SelectedDevice.ConnectionType}" Value="TCP">
|
<DataTrigger Binding="{Binding SelectedDevice.ConnectionType}" Value="Tcp">
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
@@ -414,7 +414,6 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontWeight="Bold"/>
|
FontWeight="Bold"/>
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||||
<Button Content="重置" Command="{Binding ResetCommand}" Padding="12,4"/>
|
|
||||||
<Button Content="保存" Command="{Binding SaveCommand}" Padding="12,4" Margin="6,0,0,0"/>
|
<Button Content="保存" Command="{Binding SaveCommand}" Padding="12,4" Margin="6,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace UIShare.UIViewModel
|
|||||||
/// 连接方式:"None" / "TCP" / "Serial"。
|
/// 连接方式:"None" / "TCP" / "Serial"。
|
||||||
/// 用于决定 SettingView 上"配置..."按钮打开哪一个对话框。
|
/// 用于决定 SettingView 上"配置..."按钮打开哪一个对话框。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string _connectionType = "None";
|
private string _connectionType ;
|
||||||
public string ConnectionType
|
public string ConnectionType
|
||||||
{
|
{
|
||||||
get => _connectionType;
|
get => _connectionType;
|
||||||
|
|||||||
Reference in New Issue
Block a user