上机bug修复,命令修复添加

This commit is contained in:
hsc
2026-07-21 14:36:15 +08:00
parent 9661e5f063
commit 4386449925
8 changed files with 471 additions and 194 deletions

View File

@@ -92,9 +92,9 @@ namespace DeviceEditModule.ViewModels
set => SetProperty(ref _currentLimit, value);
}
private string _selectedMode = "AC";
private PowerCouplingMode _selectedMode = PowerCouplingMode.AC;
/// <summary>待设置的电源工作模式AC / DC / ACDC。</summary>
public string SelectedMode
public PowerCouplingMode SelectedMode
{
get => _selectedMode;
set => SetProperty(ref _selectedMode, value);

View File

@@ -155,8 +155,7 @@ namespace DeviceEditModule.ViewModels
public ICommand SetOcpCommand { get; }
public ICommand SetOppCommand { get; }
public ICommand ClearAlarmCommand { get; }
public ICommand SetRemoteModeCommand { get; }
public ICommand SetLocalModeCommand { get; }
#endregion
@@ -174,8 +173,7 @@ namespace DeviceEditModule.ViewModels
SetOcpCommand = new DelegateCommand(async () => await Exec(async () => { await _device!._OCP(OcpValue, Ct()); AppendLog($"OCP已设为 {OcpValue} A"); }));
SetOppCommand = new DelegateCommand(async () => await Exec(async () => { await _device!._OPP(OppValue, Ct()); AppendLog($"OPP已设为 {OppValue} W"); }));
ClearAlarmCommand = new DelegateCommand(async () => await Exec(async () => { await _device!.(Ct()); AppendLog("保护告警已清除"); }));
SetRemoteModeCommand = new DelegateCommand(async () => await Exec(async () => { await _device!.(Ct()); AppendLog("已切换到远程控制模式"); }));
SetLocalModeCommand = new DelegateCommand(async () => await Exec(async () => { await _device!.(Ct()); AppendLog("已切换到本地控制模式"); }));
SetLoadValueCommand = new DelegateCommand(async () => await Exec(async () =>
{

View File

@@ -100,14 +100,15 @@
<!-- 工作模式 -->
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="工作模式" Style="{StaticResource ParamLabel}"/>
<ComboBox Width="90" Height="32" Margin="4,0"
<ComboBox xmlns:sys="clr-namespace:System;assembly=mscorlib"
Width="90" Height="32" Margin="4,0"
materialDesign:HintAssist.Hint=""
SelectedItem="{Binding SelectedMode}"
VerticalContentAlignment="Center" FontSize="12">
<ComboBoxItem Content="CC"/>
<ComboBoxItem Content="CV"/>
<ComboBoxItem Content="CP"/>
<ComboBoxItem Content="CR"/>
<sys:String>CC</sys:String>
<sys:String>CV</sys:String>
<sys:String>CP</sys:String>
<sys:String>CR</sys:String>
</ComboBox>
<Button Content="设置" Command="{Binding SetModeCommand}"
Style="{StaticResource CmdBtn}"/>
@@ -115,13 +116,13 @@
Style="{StaticResource CmdBtn}"/>
</StackPanel>
<!-- 远程/本地 -->
<StackPanel Orientation="Horizontal" Margin="0,4">
<!--<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="控制模式" Style="{StaticResource ParamLabel}"/>
<Button Content="远程控制" Command="{Binding SetRemoteModeCommand}"
Style="{StaticResource CmdBtn}"/>
<Button Content="本地控制" Command="{Binding SetLocalModeCommand}"
Style="{StaticResource CmdBtn}"/>
</StackPanel>
</StackPanel>-->
<!-- 系统操作 -->
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="系统操作" Style="{StaticResource ParamLabel}"/>