Commit 1131b035 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 由于配置问题,LCUS1 无法使用

parent 94decdd5
...@@ -94,7 +94,9 @@ ...@@ -94,7 +94,9 @@
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<TextBlock x:Name="textblock_lcus" Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding ErrMsg}" /> <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" >
状态:<Run Text="{Binding LCUS1.ErrMsg,Mode=OneWay}"/>
</TextBlock>
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
......
...@@ -78,20 +78,20 @@ namespace FLY.Thick.Base.UI.CustomSection ...@@ -78,20 +78,20 @@ namespace FLY.Thick.Base.UI.CustomSection
ParamDictionary paramDictionary; ParamDictionary paramDictionary;
LCUS1 lCUS1; LCUS1 lcus1;
public LCUS1 LCUS1 => lcus1;
public UcSectionErrorVm() public UcSectionErrorVm()
{ {
PlayCmd = new RelayCommand(Play); PlayCmd = new RelayCommand(Play);
OpenCmd = new RelayCommand(Open); OpenCmd = new RelayCommand(Open);
BellRingCmd = new RelayCommand(() => { lCUS1.On(); }); BellRingCmd = new RelayCommand(() => { lcus1.On(); });
BellOffCmd = new RelayCommand(() => { lCUS1.Off(); }); BellOffCmd = new RelayCommand(() => { lcus1.Off(); });
} }
public void Init(ParamDictionary paramDictionary, LCUS1 lCUS1) public void Init(ParamDictionary paramDictionary, LCUS1 lCUS1)
{ {
this.paramDictionary = paramDictionary; this.paramDictionary = paramDictionary;
this.lCUS1 = lCUS1; this.lcus1 = lCUS1;
paramDictionary.SetBinding(this, "WarningTipPath", ""); paramDictionary.SetBinding(this, "WarningTipPath", "");
paramDictionary.SetBinding(this, "WarningDurationSec", 5); paramDictionary.SetBinding(this, "WarningDurationSec", 5);
paramDictionary.SetBinding(this, "EnableScanErrBigTip", false); paramDictionary.SetBinding(this, "EnableScanErrBigTip", false);
......
...@@ -10,13 +10,10 @@ namespace FLY.Thick.Base.UI ...@@ -10,13 +10,10 @@ namespace FLY.Thick.Base.UI
public class LCUS1_dependOn:LCUS1 public class LCUS1_dependOn:LCUS1
{ {
ParamDictionary paramDictionary; ParamDictionary paramDictionary;
FLY.OBJComponents.IService.IWarningService warningService;
public LCUS1_dependOn( public LCUS1_dependOn(
ParamDictionary paramDictionary, ParamDictionary paramDictionary)
FLY.OBJComponents.IService.IWarningService warningService)
{ {
this.paramDictionary = paramDictionary; this.paramDictionary = paramDictionary;
this.warningService = warningService;
PortName = this.paramDictionary.GetValue("LCUS1_PortName", "COM1"); PortName = this.paramDictionary.GetValue("LCUS1_PortName", "COM1");
this.paramDictionary.ValueChanged += (s, e) => this.paramDictionary.ValueChanged += (s, e) =>
{ {
...@@ -25,24 +22,6 @@ namespace FLY.Thick.Base.UI ...@@ -25,24 +22,6 @@ namespace FLY.Thick.Base.UI
PortName = e.Value as string; PortName = e.Value as string;
} }
}; };
this.warningService.PropertyChanged += (s, e) =>
{
if (e.PropertyName == "IsRinging")
{
if (this.paramDictionary.GetValue("EnableLCUS1",false))
{
if (this.warningService.IsRinging)
{
On();
}
else
{
Off();
}
}
}
};
} }
} }
} }
...@@ -147,6 +147,7 @@ ...@@ -147,6 +147,7 @@
<Compile Include="OnInit\OnInitError.cs" /> <Compile Include="OnInit\OnInitError.cs" />
<Compile Include="OnInit\OnInitGageCommand.cs" /> <Compile Include="OnInit\OnInitGageCommand.cs" />
<Compile Include="OnInit\OnInitLanguage.cs" /> <Compile Include="OnInit\OnInitLanguage.cs" />
<Compile Include="OnInit\OnInitLcus1_One.cs" />
<Compile Include="OnInit\OnInitOSK.cs" /> <Compile Include="OnInit\OnInitOSK.cs" />
<Compile Include="PasswordAuthorize.cs" /> <Compile Include="PasswordAuthorize.cs" />
<Compile Include="PgBorderSearchPlastic.xaml.cs"> <Compile Include="PgBorderSearchPlastic.xaml.cs">
......
...@@ -27,6 +27,8 @@ namespace FLY.Thick.Base.UI ...@@ -27,6 +27,8 @@ namespace FLY.Thick.Base.UI
serial.Open(); serial.Open();
byte[] buf = new byte[] { 0xa0, 0x01, 0x01, 0xa2 }; byte[] buf = new byte[] { 0xa0, 0x01, 0x01, 0xa2 };
serial.Write(buf, 0, buf.Length); serial.Write(buf, 0, buf.Length);
//等0.5s确保发送出去了
Task.Delay(500).Wait();
serial.Close(); serial.Close();
ErrMsg = $"{DateTime.Now} ON"; ErrMsg = $"{DateTime.Now} ON";
} }
...@@ -48,6 +50,8 @@ namespace FLY.Thick.Base.UI ...@@ -48,6 +50,8 @@ namespace FLY.Thick.Base.UI
serial.Open(); serial.Open();
byte[] buf = new byte[] { 0xa0, 0x01, 0x00, 0xa1 }; byte[] buf = new byte[] { 0xa0, 0x01, 0x00, 0xa1 };
serial.Write(buf, 0, buf.Length); serial.Write(buf, 0, buf.Length);
//等0.5s确保发送出去了
Task.Delay(500).Wait();
serial.Close(); serial.Close();
ErrMsg = $"{DateTime.Now} OFF"; ErrMsg = $"{DateTime.Now} OFF";
} }
......
using Misc;
using MultiLayout.UiModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Base.UI.OnInit
{
/// <summary>
/// LCUS1 USB继电器模块, 监听 单个报警服务 IWarningSystem2Service
/// </summary>
public class OnInitLcus1_One : IOnInit
{
public int Level { get; private set; }
ParamDictionary paramDictionary;
LCUS1 lcus1;
FLY.OBJComponents.IService.IWarningService warningService;
public OnInitLcus1_One(
ParamDictionary paramDictionary,
FLY.OBJComponents.IService.IWarningService warningService,
LCUS1 lcus1,
int lv = 1)
{
Level = lv;
this.lcus1 = lcus1;
this.paramDictionary = paramDictionary;
this.warningService = warningService;
}
public void OnInit()
{
warningService.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(warningService.IsRinging))
{
if (this.paramDictionary.GetValue("EnableLCUS1", false))
{
if (this.warningService.IsRinging)
{
lcus1.On();
}
else
{
lcus1.Off();
}
}
}
};
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment