Commit 21ae28ec authored by 潘栩锋's avatar 潘栩锋 🚴

1. 修复 右下角图标不会消失。 之前的版本直接 System.Environment.Exit(0); 导致无法触发 ApplicationExit

2. 优化 报警码 升级为 uint16, 因为称重很多报警,快超过255了
3. 优化 报警管理界面 PgErrorTable2 删除【消音】
parent 2d5a6d39
......@@ -22,7 +22,7 @@ namespace FLY.AppHelper
/// </summary>
/// <param name="window">窗体</param>
/// <param name="text">当鼠标指针停留在通知区域图标上时显示的工具提示文本</param>
public WindowNotifyIconHelper(System.Windows.Window window, string text)
public WindowNotifyIconHelper(System.Windows.Window window, string text)
{
notifyIcon = new System.Windows.Forms.NotifyIcon();
//this.notifyIcon.BalloonTipText = "Hello, NotifyIcon!";
......@@ -38,7 +38,7 @@ namespace FLY.AppHelper
//关联托盘控件
MenuItem[] childen = new MenuItem[] { exit };
notifyIcon.ContextMenu = new ContextMenu(childen);
notifyIcon.ContextMenu = new ContextMenu(childen);
//this.notifyIcon.ShowBalloonTip(1000);
......@@ -48,13 +48,13 @@ namespace FLY.AppHelper
this.window.StateChanged += new EventHandler(window_StateChanged);
this.window.Closing += new System.ComponentModel.CancelEventHandler(window_Closing);
Application.ApplicationExit += Application_ApplicationExit;
}
private void Application_ApplicationExit(object sender, EventArgs e)
{
notifyIcon.Dispose();
System.Environment.Exit(0); //这个是不会触发 ApplicationExit, 但可以把全部线程清除掉
//System.Environment.Exit(0); //这个是不会触发 ApplicationExit, 但可以把全部线程清除掉
}
......@@ -69,11 +69,12 @@ namespace FLY.AppHelper
if (r == System.Windows.MessageBoxResult.Yes)
{
//notifyIcon.Visible = false;
//notifyIcon.Dispose();
notifyIcon.Dispose();
//System.Windows.Application.Current.Shutdown();
Application.Exit();
//Application.Exit();
System.Environment.Exit(0); //这个是不会触发 ApplicationExit, 但可以把全部线程清除掉
}
}
}
void window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//this.notifyIcon.Visible = false;
......@@ -82,7 +83,7 @@ namespace FLY.AppHelper
//System.Windows.MessageBoxResult r = System.Windows.MessageBox.Show("是否真的要退出程序??", "警告", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxResult.No);
//if (r == System.Windows.MessageBoxResult.Yes)
//{
//}
//else
//{
......
......@@ -108,9 +108,8 @@ namespace FLY.OBJComponents.Common
/// </summary>
public struct ERRNO
{
public byte Code;
public UInt16 Code;
public string Descrption;
public bool OffIsError;
}
public static class PlcErrNos
......@@ -118,6 +117,6 @@ namespace FLY.OBJComponents.Common
/// <summary>
/// PLC连接断开
/// </summary>
public static ERRNO ERRNO_PLC_DISCONNECTED = new ERRNO() { Code = 255, Descrption = "PLC连接断开" };
public static ERRNO ERRNO_PLC_DISCONNECTED = new ERRNO() { Code = 65535, Descrption = "PLC连接断开" };
}
}
......@@ -108,10 +108,10 @@ namespace FLY.OBJComponents.Server
ERR_STATE state = b ? ERR_STATE.ON : ERR_STATE.OFF;
ERRNO errno = PlcErrNos.ERRNO_PLC_DISCONNECTED;
byte errcode = (byte)(errno.Code - i);
UInt16 errcode = (UInt16)(errno.Code - i);
string description;
if (PLCos.PLCs.Count() > 1)
description = $"{plcName} No.{i} " + errno.Descrption;
description = $"{plcName} No.{i+1} " + errno.Descrption;
else
description = $"{plcName} " + errno.Descrption;
......@@ -154,7 +154,7 @@ namespace FLY.OBJComponents.Server
public void ResetError(INotifyPropertyChanged sender)
{
var type = sender.GetType();
foreach (var ei in obj_error[sender as INotifyPropertyChanged].error_property)
foreach (var ei in obj_error[sender].error_property)
{
var property = type.GetProperty(ei.property);
property.SetValue(sender, false);
......
......@@ -75,17 +75,7 @@
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" >
<Button Style="{StaticResource buttonStyle}" Click="button_silence_click" Foreground="#FFEE3232">
<StackPanel >
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="White"/>
<iconPacks:PackIconMaterial Kind="VolumeMute" Style="{StaticResource iconPackStyle}" />
</Grid>
<TextBlock Text="消音" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
......
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