更新20260527

This commit is contained in:
GukSang.Jin
2026-05-27 14:59:53 +08:00
parent 57ce28a1ea
commit cdb2190728
3 changed files with 125 additions and 82 deletions

View File

@@ -38,7 +38,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel
private const double HeatingNoRiseTolerance = 1;
private const double HeatingAtTargetTolerance = 2;
private const double TargetTemperatureMismatchTolerance = 0.05;
private const ushort AlarmCoil = 91;
private const ushort YellowLampCoil = 57;
private const ushort GreenLampCoil = 58;
private const ushort RedLampCoil = 59;
private const ushort CirculatingWaterCoil = 49;
private const ushort HeatingCoil = 102;
private const ushort StartHeatingCoil = 100;
@@ -67,7 +69,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel
private string _targetTemperatureText = "";
private string _heatTransferText = "";
private string _lastAction = "待机";
private bool _alarmActive;
private bool _yellowLampActive;
private bool _greenLampActive;
private bool _redLampActive;
private bool _circulatingWaterActive;
private bool _heatingActive;
private bool _isEditingConeParameters;
@@ -148,25 +152,67 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel
private set => SetProperty(ref _lastAction, value);
}
public bool AlarmActive
public bool YellowLampActive
{
get => _alarmActive;
private set => SetProperty(ref _alarmActive, value);
get => _yellowLampActive;
private set
{
if (SetProperty(ref _yellowLampActive, value))
{
OnPropertyChanged(nameof(LampStatusText));
}
}
}
public bool GreenLampActive
{
get => _greenLampActive;
private set
{
if (SetProperty(ref _greenLampActive, value))
{
OnPropertyChanged(nameof(LampStatusText));
}
}
}
public bool RedLampActive
{
get => _redLampActive;
private set
{
if (SetProperty(ref _redLampActive, value))
{
OnPropertyChanged(nameof(LampStatusText));
}
}
}
public string LampStatusText
{
get
{
if (RedLampActive)
{
return "M59 红灯";
}
if (YellowLampActive)
{
return "M57 黄灯";
}
return GreenLampActive ? "M58 绿灯" : "未触发";
}
}
public bool CirculatingWaterActive
{
get => _circulatingWaterActive;
private set
{
if (SetProperty(ref _circulatingWaterActive, value))
{
OnPropertyChanged(nameof(CirculatingWaterButtonText));
}
}
private set => SetProperty(ref _circulatingWaterActive, value);
}
public string CirculatingWaterButtonText => CirculatingWaterActive ? "循环水:开启" : "循环水:关闭";
public string CirculatingWaterButtonText => CirculatingWaterAction;
public bool HeatingActive
{
@@ -263,7 +309,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel
}
}
AlarmActive = _tcpDeviceConnectionService.TryReadCoil(AlarmCoil, out var alarmActive) && alarmActive;
YellowLampActive = _tcpDeviceConnectionService.TryReadCoil(YellowLampCoil, out var yellowLampActive) && yellowLampActive;
GreenLampActive = _tcpDeviceConnectionService.TryReadCoil(GreenLampCoil, out var greenLampActive) && greenLampActive;
RedLampActive = _tcpDeviceConnectionService.TryReadCoil(RedLampCoil, out var redLampActive) && redLampActive;
HeatingActive = _tcpDeviceConnectionService.TryReadCoil(HeatingCoil, out var heatingActive) && heatingActive;
LogHeatingDiagnosticIfNeeded(HeatingActive);
if (_tcpDeviceConnectionService.TryReadCoil(CirculatingWaterCoil, out var circulatingWaterActive))

View File

@@ -43,7 +43,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="76" />
<RowDefinition Height="*" />
<RowDefinition Height="96" />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<Grid Grid.Row="0"
@@ -79,47 +79,38 @@
Width="100"
Height="42"
Style="{StaticResource InstrumentButtonStyle}" />
<Grid Width="92"
Height="54"
Margin="28,0,0,0">
<Ellipse Width="76"
Height="16"
Fill="#111817"
VerticalAlignment="Bottom"
HorizontalAlignment="Center" />
<Border Width="46"
Height="38"
CornerRadius="22,22,8,8"
BorderBrush="#6B201F"
BorderThickness="1"
VerticalAlignment="Top"
HorizontalAlignment="Center">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#2E9D57" />
<Setter Property="BorderBrush" Value="#1D6939" />
<StackPanel Margin="26,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Ellipse Width="34"
Height="34"
Stroke="#8C9691"
StrokeThickness="1">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="#A7AFAB" />
<Style.Triggers>
<DataTrigger Binding="{Binding AlarmActive}" Value="True">
<Setter Property="Background" Value="#F01824" />
<Setter Property="BorderBrush" Value="#6B201F" />
<DataTrigger Binding="{Binding GreenLampActive}" Value="True">
<Setter Property="Fill" Value="#2EA35A" />
<Setter Property="Stroke" Value="#1D6939" />
</DataTrigger>
<DataTrigger Binding="{Binding YellowLampActive}" Value="True">
<Setter Property="Fill" Value="#F2C230" />
<Setter Property="Stroke" Value="#8B6A00" />
</DataTrigger>
<DataTrigger Binding="{Binding RedLampActive}" Value="True">
<Setter Property="Fill" Value="#E41F2C" />
<Setter Property="Stroke" Value="#8E111A" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<Ellipse Width="10"
Height="18"
Fill="White"
Opacity="0.88"
Margin="0,8,18,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<RotateTransform Angle="35" />
</Ellipse.RenderTransform>
</Ellipse.Style>
</Ellipse>
</Grid>
<TextBlock Text="{Binding LampStatusText}"
FontSize="12"
Foreground="#40504B"
HorizontalAlignment="Center" />
</StackPanel>
</StackPanel>
</Grid>
@@ -292,39 +283,32 @@
CommandParameter="停止升温"
Width="140"
Height="42"
Margin="0,0,10,0"
Style="{StaticResource InstrumentButtonStyle}" />
<Button Content="循环水"
Command="{Binding ActionCommand}"
CommandParameter="循环水"
Width="140"
Height="42">
<Button.Style>
<Style TargetType="Button"
BasedOn="{StaticResource InstrumentButtonStyle}">
<Setter Property="Background" Value="#EEF1EF" />
<Setter Property="BorderBrush" Value="#A9B1AD" />
<Setter Property="Foreground" Value="#172320" />
<Style.Triggers>
<DataTrigger Binding="{Binding CirculatingWaterActive}" Value="True">
<Setter Property="Background" Value="#2F8F5B" />
<Setter Property="BorderBrush" Value="#236A45" />
<Setter Property="Foreground" Value="#FFFFFF" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Grid>
</Border>
</Grid>
<Grid Grid.Row="2"
Margin="24,12,24,16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="1"
Content="{Binding CirculatingWaterButtonText}"
Command="{Binding ActionCommand}"
CommandParameter="循环水"
Height="42"
VerticalAlignment="Center">
<Button.Style>
<Style TargetType="Button"
BasedOn="{StaticResource InstrumentPrimaryButtonStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding CirculatingWaterActive}" Value="True">
<Setter Property="Background" Value="#DDEFE6" />
<Setter Property="BorderBrush" Value="#3F8B63" />
<Setter Property="Foreground" Value="#0D3B24" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
</Grid>
</UserControl>

View File

@@ -191,8 +191,19 @@
FontWeight="SemiBold"
Foreground="#162321" />
<TextBlock Text="{Binding FlameStatus}"
FontSize="16"
Foreground="#40504B" />
FontSize="16">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#40504B" />
<Style.Triggers>
<DataTrigger Binding="{Binding FlameDetected}" Value="True">
<Setter Property="Foreground" Value="#E41F2C" />
<Setter Property="FontWeight" Value="SemiBold" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Grid>
</Border>