Commit 03f200e5 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 定点图配置添加密码

2. 报警大提示框,改为扫描报警大提示框
parent 5d631bd5
......@@ -72,11 +72,11 @@
</GroupBox.Header>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding EnableLCUS1}" />
</StackPanel>
<StackPanel Margin="5">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="串口地址" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding LCUS1_PortName}" HorizontalAlignment="Left" Tag="Full"/>
......@@ -100,17 +100,13 @@
</GroupBox>
<GroupBox Style="{x:Null}" Margin="5">
<GroupBox.Header>
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="大屏报警" VerticalAlignment="Bottom"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="大屏显示扫描报警" VerticalAlignment="Bottom"/>
</GroupBox.Header>
<StackPanel Orientation="Horizontal" x:Name="spErrCodes">
<StackPanel Margin="5">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="出错码" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="格式为:11,12" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ErrCodesOfTip}" MinWidth="300" HorizontalAlignment="Left" Tag="Full"/>
<StackPanel Margin="{StaticResource ControlMargin}">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding EnableScanErrBigTip}" />
</StackPanel>
</StackPanel>
</StackPanel>
......
......@@ -52,9 +52,9 @@ namespace FLY.Thick.Base.UI.CustomSection
public int WarningDurationSec { get; set; }
/// <summary>
/// 显示报警信息的 报警编号
/// 大屏幕提示扫描报警
/// </summary>
public string ErrCodesOfTip { get; set; }
public bool EnableScanErrBigTip { get; set; }
/// <summary>
/// USB 继电器 串口地址
......@@ -96,21 +96,21 @@ namespace FLY.Thick.Base.UI.CustomSection
WarningTipPath = this.paramDictionary.GetValue(ParamDistItemKeys.WarningTipPath, "");
var v = this.paramDictionary.GetValue<int>(ParamDistItemKeys.WarningDurationSec);
WarningDurationSec = this.paramDictionary.GetValue(ParamDistItemKeys.WarningDurationSec, 5);
ErrCodesOfTip = this.paramDictionary.GetValue(ParamDistItemKeys.ErrCodesOfTip, "11,12");
EnableScanErrBigTip = this.paramDictionary.GetValue(ParamDistItemKeys.EnableScanErrBigTip, false);
LCUS1_PortName = this.paramDictionary.GetValue(ParamDistItemKeys.LCUS1_PortName, "COM1");
EnableLCUS1 = this.paramDictionary.GetValue(ParamDistItemKeys.EnableLCUS1, false);
this.PropertyChanged += (s, e) =>
{
if (e.PropertyName == ParamDistItemKeys.WarningTipPath)
if (e.PropertyName == "WarningTipPath")
this.paramDictionary.SetValue(ParamDistItemKeys.WarningTipPath, WarningTipPath);
else if (e.PropertyName == ParamDistItemKeys.WarningDurationSec)
else if (e.PropertyName == "WarningDurationSec")
this.paramDictionary.SetValue(ParamDistItemKeys.WarningDurationSec, WarningDurationSec);
else if (e.PropertyName == ParamDistItemKeys.ErrCodesOfTip)
this.paramDictionary.SetValue(ParamDistItemKeys.ErrCodesOfTip, ErrCodesOfTip);
else if (e.PropertyName == ParamDistItemKeys.LCUS1_PortName)
else if (e.PropertyName == "EnableScanErrBigTip")
this.paramDictionary.SetValue(ParamDistItemKeys.EnableScanErrBigTip, EnableScanErrBigTip);
else if (e.PropertyName == "LCUS1_PortName")
this.paramDictionary.SetValue(ParamDistItemKeys.LCUS1_PortName, LCUS1_PortName);
else if (e.PropertyName == ParamDistItemKeys.EnableLCUS1)
else if (e.PropertyName == "EnableLCUS1")
this.paramDictionary.SetValue(ParamDistItemKeys.EnableLCUS1, EnableLCUS1);
};
......
......@@ -20,13 +20,14 @@
<StackPanel.Resources>
<Style x:Key="TextBlockStyle_GridFieldHeader" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}">
<Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="1,0"/>
<Setter Property="Margin" Value="1.5,0"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource Color_theme_activity}"/>
</Style>
<Style x:Key="TextBlockStyle_GridFieldContent" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}">
<Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="1,0"/>
<Setter Property="Margin" Value="1.5,0"/>
<Setter Property="Background" Value="White"/>
</Style>
<Style x:Key="ComboBoxStyle_GridFieldContent" TargetType="ComboBox" >
<Setter Property="Width" Value="100"/>
......@@ -34,7 +35,7 @@
<Setter Property="FontSize" Value="25"/>
</Style>
</StackPanel.Resources>
<StackPanel Orientation="Horizontal" Margin="3">
<StackPanel Orientation="Horizontal" Margin="3,1.5">
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}"
Text="状态" />
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldHeader}"
......@@ -48,13 +49,18 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3">
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding ControllerState}"/>
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding Header}"/>
<Button Style="{StaticResource ButtonStyle_icon}" Click="button_del_Click" Tag="{Binding .}">
<iconPacks:PackIconMaterial Kind="CloseCircle"/>
</Button>
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="3,1.5">
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding ControllerState}"/>
<TextBlock Style="{StaticResource TextBlockStyle_GridFieldContent}" Text="{Binding Header}"/>
<Button Style="{StaticResource ButtonStyle_icon}" Click="button_del_Click" Tag="{Binding .}" Foreground="{StaticResource ValidationBrush5}">
<iconPacks:PackIconMaterial Kind="CloseCircle"/>
</Button>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
......
......@@ -10,6 +10,7 @@ using System.Threading;
using System.Threading.Tasks;
using FLY.Thick.Base.UI;
using Unity;
using FLY.Thick.Base.Common;
namespace FLY.Thick.Base.UI.OnInit
{
......@@ -24,6 +25,8 @@ namespace FLY.Thick.Base.UI.OnInit
ParamDictionary paramDictionary;
IUnityContainer container;
bool enableScanErrBigTip;
int warningTipId=-1;
public int Level { get; }
public OnInitError(
IUnityContainer container,
......@@ -43,76 +46,63 @@ namespace FLY.Thick.Base.UI.OnInit
paramDictionary.ValueChanged += ParamDictionary_ValueChanged;
warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged;
updateErrCodesOfTip();
}
private void ParamDictionary_ValueChanged(object sender, ParamDictionaryValueChangedEventArgs e)
{
if (e.Key == ParamDistItemKeys.ErrCodesOfTip)
if (e.Key == ParamDistItemKeys.EnableScanErrBigTip)
{
updateErrCodesOfTip();
}
}
List<int> errCodes = new List<int>();
void updateErrCodesOfTip()
{
errCodes.Clear();
string str = paramDictionary.GetValue<string>(ParamDistItemKeys.ErrCodesOfTip);
if (string.IsNullOrEmpty(str))
return;
enableScanErrBigTip = paramDictionary.GetValue<bool>(ParamDistItemKeys.EnableScanErrBigTip, false);
int[] codes = null;
try
{
codes = Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>($"[{str}]");
}
catch (Exception ex)
{
return;
}
if (codes == null)
return;
if (codes.Count() == 0)
return;
errCodes.AddRange(codes);
}
private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (errCodes.Count() == 0)
if (!enableScanErrBigTip)
return;
FObjBase.PollModule.Current.Poll_JustOnce(
new FObjBase.PollModule.PollHandler(delegate ()
{
List<int> errCodes = new List<int> { ERRNOs.SCAN_ERRNO_OVERCTRL.Code, ERRNOs.SCAN_ERRNO_OVERTOL.Code };
var record = warningReasonWindow.Record;
//判断当前报警是否包含 errCodes
var rs = from r in record where errCodes.Contains(r.ErrCode) select r;
if (rs.Count() == 0)
{//没有一个需要报警
FLY.ControlLibrary.Window_WarningTip.Stop();
if (rs.Count() == 0) {
//不需要提示
if (warningTipId != -1)
{
//需要把之前的报警关闭
FLY.ControlLibrary.Window_WarningTip.Stop(warningTipId);
warningTipId = -1;
}
}
else
{
else {
int errcode = rs.First().ErrCode;
string msg = rs.First().Description;
string path = paramDictionary.GetValue<string>(ParamDistItemKeys.WarningTipPath);
//报警!!!!!!!!
FLY.ControlLibrary.Window_WarningTip.Show(
$"编码={errcode}",
msg,
TimeSpan.MaxValue,
path,
warningService.Reset
);
//报警!!!!!!!!
//记录打开的报警提示框Id,用于以后关闭
warningTipId = FLY.ControlLibrary.Window_WarningTip.Show(
$"编码={errcode}",
msg,
TimeSpan.MaxValue,
path,
warningService.Reset
);
}
}), this, MARKNO_WARNING_RING);
}
......
......@@ -13,7 +13,7 @@ namespace FLY.Thick.Base.UI
public const string Language = "Language";
public const string WarningTipPath = "WarningTipPath";
public const string WarningDurationSec = "WarningDurationSec";
public const string ErrCodesOfTip = "ErrCodesOfTip";
public const string EnableScanErrBigTip = "EnableScanErrBigTip";
public const string LCUS1_PortName = "LCUS1_PortName";
public const string EnableLCUS1 = "EnableLCUS1";
public const string WindowSize = "WindowSize";
......
......@@ -148,6 +148,9 @@ namespace FLY.Thick.Base.UI.UiModule
private void button_save_Click(object sender, RoutedEventArgs e)
{
if (!WdPassword.Authorize("GraphConfig"))
return;
graphparam_clone.CopyTo(mGraphParam);
FixGraphParams.Current.Save();
......
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