@@ -77,7 +77,7 @@ | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
FontSize="8" | FontSize="8" | ||||
Foreground="#FF00E6F7" | Foreground="#FF00E6F7" | ||||
Text="{Binding ListNum}" /> | |||||
Text="{Binding ListNum, Mode=TwoWay}" /> | |||||
<!-- --> | <!-- --> | ||||
</Border> | </Border> | ||||
<Image | <Image | ||||
@@ -93,6 +93,11 @@ | |||||
<ControlTemplate.Triggers> | <ControlTemplate.Triggers> | ||||
<Trigger Property="IsChecked" Value="true"> | <Trigger Property="IsChecked" Value="true"> | ||||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" /> | <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" /> | ||||
<Setter TargetName="bd1" Property="Visibility" Value="Visible" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="False"> | |||||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" /> | |||||
<Setter TargetName="bd1" Property="Visibility" Value="Collapsed" /> | |||||
</Trigger> | </Trigger> | ||||
<MultiDataTrigger> | <MultiDataTrigger> | ||||
<MultiDataTrigger.Conditions> | <MultiDataTrigger.Conditions> | ||||
@@ -99,8 +99,8 @@ namespace BPASmartClient.Device | |||||
/// </summary> | /// </summary> | ||||
private List<IPeripheral> peripherals; | private List<IPeripheral> peripherals; | ||||
public Action<object> AddErrorAction { get; set; } | |||||
public Action<object> DeleteErrorAction { get; set; } | |||||
public Action<int,object> AddErrorAction { get; set; } | |||||
public Action<int, object> DeleteErrorAction { get; set; } | |||||
#endregion | #endregion | ||||
@@ -153,36 +153,37 @@ namespace BPASmartClient.Device | |||||
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]); | Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
foreach (var item in Status.GetStatusT()) | |||||
if (AddErrorAction != null && DeleteErrorAction != null) | |||||
{ | { | ||||
if (item.Name == "Warning" || item.Name == "Fault") | |||||
foreach (var item in Status.GetStatusT()) | |||||
{ | { | ||||
if (item.Status != "无故障" && item.Status != "无警告" && item.Status != "未发生故障") | |||||
if (item.Name == "Warning" || item.Name == "Fault") | |||||
{ | { | ||||
var res = Error?.FirstOrDefault(p => p.GetType().GetProperty("Text").GetValue(p).ToString() == item.Ms); | |||||
if (res == null) | |||||
if (item.Status != "无故障" && item.Status != "无警告" && item.Status != "未发生故障") | |||||
{ | { | ||||
object obj = new | |||||
var res = Error?.FirstOrDefault(p => p.GetType().GetProperty("Text").GetValue(p).ToString() == item.Ms); | |||||
if (res == null) | |||||
{ | { | ||||
Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
Type = item.Name == "Warning" ? "警告" : "故障", | |||||
Text = item.Ms | |||||
}; | |||||
Error.Add(obj); | |||||
AddErrorAction?.Invoke(obj); | |||||
object obj = new | |||||
{ | |||||
Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
Type = item.Name == "Warning" ? "警告" : "故障", | |||||
Text = item.Ms | |||||
}; | |||||
Error.Add(obj); | |||||
AddErrorAction?.Invoke(DeviceId,obj); | |||||
} | |||||
} | } | ||||
} | |||||
else | |||||
{ | |||||
var res = Error?.FirstOrDefault(p => p.GetType().GetProperty("Text").GetValue(p).ToString().Contains(item.id)); | |||||
if (res != null) | |||||
else | |||||
{ | { | ||||
Error.Remove(res); | |||||
DeleteErrorAction?.Invoke(res); | |||||
var res = Error?.FirstOrDefault(p => p.GetType().GetProperty("Text").GetValue(p).ToString().Contains(item.id)); | |||||
if (res != null) | |||||
{ | |||||
Error.Remove(res); | |||||
DeleteErrorAction?.Invoke(DeviceId,res); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -233,7 +234,7 @@ namespace BPASmartClient.Device | |||||
Text = res.Info | Text = res.Info | ||||
}; | }; | ||||
Error.Add(obj); | Error.Add(obj); | ||||
AddErrorAction?.Invoke(obj); | |||||
AddErrorAction?.Invoke(DeviceId, obj); | |||||
} | } | ||||
}); | }); | ||||
alarmHelper.RemoveAction = new Action<string>((s) => | alarmHelper.RemoveAction = new Action<string>((s) => | ||||
@@ -242,7 +243,7 @@ namespace BPASmartClient.Device | |||||
if (res != null && Error.Contains(res)) | if (res != null && Error.Contains(res)) | ||||
{ | { | ||||
Error.Remove(res); | Error.Remove(res); | ||||
DeleteErrorAction?.Invoke(res); | |||||
DeleteErrorAction?.Invoke(DeviceId, res); | |||||
} | } | ||||
}); | }); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -82,7 +82,7 @@ namespace BPASmartClient.Device | |||||
/// <param name="field"></param> | /// <param name="field"></param> | ||||
object GetPropertyValue(object info, string field); | object GetPropertyValue(object info, string field); | ||||
Action<object> AddErrorAction { get; set; } | |||||
Action<object> DeleteErrorAction { get; set; } | |||||
Action<int, object> AddErrorAction { get; set; } | |||||
Action<int, object> DeleteErrorAction { get; set; } | |||||
} | } | ||||
} | } |
@@ -17,6 +17,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="log4net" Version="2.0.14" /> | |||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> | <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> | ||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -0,0 +1,423 @@ | |||||
using log4net; | |||||
using log4net.Repository; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Diagnostics; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Helper | |||||
{ | |||||
/// <summary> | |||||
/// 创建人:奉友福 | |||||
/// 时间:2021/11/12 | |||||
/// </summary> | |||||
public class logHelper | |||||
{ | |||||
#region 单例模式 | |||||
static private logHelper m_logHelperInstance = null; | |||||
public static logHelper GetLogConfigInstance() | |||||
{ | |||||
if (null == m_logHelperInstance) | |||||
{ | |||||
m_logHelperInstance = new logHelper(); | |||||
} | |||||
return m_logHelperInstance; | |||||
} | |||||
#endregion | |||||
/// <summary> | |||||
/// 日志显示委托 | |||||
/// </summary> | |||||
public Action<string> InfoNotify { get; set; } | |||||
private ILog directLogger = null; | |||||
private log4net.Appender.RollingFileAppender directRollfileAppender = null; | |||||
ILoggerRepository logRepos = null; | |||||
private static bool m_isInitDirectLog = false; //是否初始化了直接写入日志文件 | |||||
private static Int32 directFileSize = 50; | |||||
private static string directLogDir = string.Empty; | |||||
private static string directLogFileName = string.Empty; | |||||
//static private UAFLogHelper uafLogInstance = null; | |||||
private LogLevel logLevel = LogLevel.ALL; | |||||
/// <summary> | |||||
/// 初始化日志 | |||||
/// </summary> | |||||
/// <param name="path"></param> | |||||
public static void Fun_InitLog(string path) | |||||
{ | |||||
try | |||||
{ | |||||
/// 设置需要的日志信息 | |||||
GetLogConfigInstance().SetConfigEnableThreadId(true); | |||||
GetLogConfigInstance().SetConfigEnableAppDomain(true); | |||||
/// 使用直接日志接口写入日志信息 | |||||
GetLogConfigInstance().SetLogLevel(LogLevel.ERROR); | |||||
GetLogConfigInstance().SetDirectFileLogInfo(5, string.Empty); | |||||
GetLogConfigInstance().SetDirectFileLogName("HBL.LogDir"); | |||||
if (!(GetLogConfigInstance().initDirectLogger(path))) | |||||
{ | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
public void SetDirectFileLogInfo(Int32 fileSize, string logDirectory) | |||||
{ | |||||
directFileSize = fileSize; | |||||
directLogDir = logDirectory; | |||||
} | |||||
public void SetDirectFileLogName(string logFileName) | |||||
{ | |||||
directLogFileName = logFileName; | |||||
} | |||||
//初始化日志实例 | |||||
public bool initDirectLogger(string loggerName) | |||||
{ | |||||
try | |||||
{ | |||||
logRepos = log4net.LogManager.CreateRepository(loggerName); | |||||
//初始化记录日志到文件的 appender | |||||
InitDirectRollFileAppender(loggerName); | |||||
m_isInitDirectLog = true; | |||||
return true; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
throw e; | |||||
} | |||||
} | |||||
private void InitDirectRollFileAppender(string loggerName) | |||||
{ | |||||
try | |||||
{ | |||||
directLogger = LogManager.GetLogger(logRepos.Name, loggerName); | |||||
//初始化记录日志到文件的 appender | |||||
directRollfileAppender = new log4net.Appender.RollingFileAppender(); | |||||
// pattern layout | |||||
log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout(); | |||||
//UAFCustomDataDB.UAFCustomLayout layout = new UAFCustomDataDB.UAFCustomLayout(); | |||||
//layout.ConversionPattern = "%log_time %log_threadname %log_ip %-5level %log_domain %log_location %log_msg %log_details%n"; // pattern | |||||
layout.ConversionPattern = string.Empty; | |||||
if (LogConfig.GetLogConfigInstance().EnableDate) | |||||
{ | |||||
layout.ConversionPattern += "%date{yyyy-MM-dd HH:mm:ss} "; | |||||
} | |||||
//级别 | |||||
layout.ConversionPattern += "%-5level "; | |||||
if (LogConfig.GetLogConfigInstance().EnableAppDomain) | |||||
{ | |||||
layout.ConversionPattern += "%a "; | |||||
} | |||||
if (LogConfig.GetLogConfigInstance().EnableThreadId) | |||||
{ | |||||
layout.ConversionPattern += "[%t] "; | |||||
} | |||||
layout.ConversionPattern += "%m%n"; | |||||
layout.ActivateOptions(); // activate | |||||
//directRollfileAppender.CloseFlag = false; //添加打开标志 | |||||
directRollfileAppender.Layout = layout; // layout pattern | |||||
//directRollfileAppender.Name = "DirectLogRollFileAppender"; | |||||
directRollfileAppender.Name = loggerName; | |||||
directRollfileAppender.File = string.Empty; | |||||
//设置日志文件路径 | |||||
if (string.Empty == directLogDir) | |||||
{ | |||||
directRollfileAppender.File = "LogDir\\"; | |||||
} | |||||
else | |||||
{ | |||||
if (directLogDir.EndsWith("\\")) | |||||
{ | |||||
directRollfileAppender.File = directLogDir; | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.File = directLogDir + "\\"; | |||||
} | |||||
} | |||||
//设置日志文件名字 | |||||
if (string.Empty == directLogFileName) | |||||
{ | |||||
//获取进程Id,构造日志文件名字 | |||||
string loggerFileName = Process.GetCurrentProcess().ProcessName | |||||
+ Process.GetCurrentProcess().Id.ToString() + "_" | |||||
+ DateTime.Now.Year.ToString() | |||||
+ DateTime.Now.Month.ToString() | |||||
+ DateTime.Now.Day.ToString() | |||||
+ DateTime.Now.Hour.ToString() | |||||
+ DateTime.Now.Minute.ToString() | |||||
+ DateTime.Now.Second.ToString() | |||||
+ DateTime.Now.Millisecond.ToString() + "_";//"UAFMsgName"; | |||||
directRollfileAppender.File += loggerFileName; | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.File += directLogFileName; | |||||
} | |||||
directRollfileAppender.AppendToFile = true; // overwrite any existin g file with the same name | |||||
if (directFileSize <= 0) | |||||
{ | |||||
directRollfileAppender.MaxFileSize = (50 * 1024 * 1024); // max file size - 50*1024*1024 = 50MB | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.MaxFileSize = (directFileSize * 1024 * 1024); | |||||
} | |||||
directRollfileAppender.MaxSizeRollBackups = 50; // keep 50 files | |||||
directRollfileAppender.ImmediateFlush = true; // flush after every append | |||||
directRollfileAppender.Threshold = log4net.Core.Level.All; | |||||
directRollfileAppender.DatePattern = "yyyy_M_d'.log'"; | |||||
directRollfileAppender.StaticLogFileName = false; | |||||
directRollfileAppender.ActivateOptions(); // activate | |||||
// add appenders | |||||
//log4net.Config.BasicConfigurator.Configure(directRollfileAppender); | |||||
log4net.Config.BasicConfigurator.Configure(logRepos, directRollfileAppender); | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
throw e; | |||||
} | |||||
} | |||||
//重新设置日志保存路径和文件名 | |||||
public void ReconfigLogDirAndName() | |||||
{ | |||||
directRollfileAppender.File = string.Empty; | |||||
//设置日志文件路径 | |||||
if (string.Empty == directLogDir) | |||||
{ | |||||
directRollfileAppender.File = "LogDir\\"; | |||||
} | |||||
else | |||||
{ | |||||
if (directLogDir.EndsWith("\\")) | |||||
{ | |||||
directRollfileAppender.File = directLogDir; | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.File = directLogDir + "\\"; | |||||
} | |||||
} | |||||
//设置日志文件名字 | |||||
if (string.Empty == directLogFileName) | |||||
{ | |||||
//获取进程Id,构造日志文件名字 | |||||
string loggerFileName = Process.GetCurrentProcess().ProcessName | |||||
+ Process.GetCurrentProcess().Id.ToString() + "_" | |||||
+ DateTime.Now.Year.ToString() | |||||
+ DateTime.Now.Month.ToString() | |||||
+ DateTime.Now.Day.ToString() | |||||
+ DateTime.Now.Hour.ToString() | |||||
+ DateTime.Now.Minute.ToString() | |||||
+ DateTime.Now.Second.ToString() | |||||
+ DateTime.Now.Millisecond.ToString() + "_";//"UAFMsgName"; | |||||
directRollfileAppender.File += loggerFileName; | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.File += directLogFileName; | |||||
} | |||||
if (directFileSize <= 0) | |||||
{ | |||||
directRollfileAppender.MaxFileSize = (50 * 1024 * 1024); // max file size - 50*1024*1024 = 50MB | |||||
} | |||||
else | |||||
{ | |||||
directRollfileAppender.MaxFileSize = (directFileSize * 1024 * 1024); | |||||
} | |||||
directRollfileAppender.ActivateOptions(); // activate | |||||
} | |||||
public void SetLogLevel(LogLevel level) | |||||
{ | |||||
logLevel = level; | |||||
} | |||||
public bool WriteLog(LogLevel level, string logMsg) | |||||
{ | |||||
try | |||||
{ | |||||
if (null == directLogger) | |||||
{ | |||||
return false; | |||||
} | |||||
//if ((LogLevel.OFF == logLevel) || ((Int32)level > (Int32)logLevel /*&& LogObjectLib.LogLevel.ALL != logLevel*/)) | |||||
//{ | |||||
// return true; | |||||
//} | |||||
//调用日志接口直接写日志信息 | |||||
switch (level) | |||||
{ | |||||
case LogLevel.FATAL: | |||||
if (directLogger.IsFatalEnabled) | |||||
{ | |||||
directLogger.Fatal(logMsg); | |||||
} | |||||
break; | |||||
case LogLevel.ERROR: | |||||
if (directLogger.IsErrorEnabled) | |||||
{ | |||||
directLogger.Error(logMsg); | |||||
} | |||||
break; | |||||
case LogLevel.WARN: | |||||
if (directLogger.IsWarnEnabled) | |||||
{ | |||||
directLogger.Warn(logMsg); | |||||
} | |||||
break; | |||||
case LogLevel.INFO: | |||||
if (directLogger.IsInfoEnabled) | |||||
{ | |||||
directLogger.Info(logMsg); | |||||
} | |||||
break; | |||||
case LogLevel.DEBUG: | |||||
if (directLogger.IsDebugEnabled) | |||||
{ | |||||
directLogger.Debug(logMsg); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (InfoNotify != null) | |||||
{ | |||||
logMsg = $"{DateTime.Now.ToString("HH:mm:ss")}:{level} {logMsg} \n\r"; | |||||
InfoNotify(logMsg); | |||||
} | |||||
return true; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
throw e; | |||||
} | |||||
} | |||||
//设置日志配置--app域名 | |||||
public void SetConfigEnableAppDomain(bool value) | |||||
{ | |||||
LogConfig.GetLogConfigInstance().EnableAppDomain = value; | |||||
} | |||||
//设置日志配置--线程id | |||||
public void SetConfigEnableThreadId(bool value) | |||||
{ | |||||
LogConfig.GetLogConfigInstance().EnableThreadId = value; | |||||
} | |||||
public bool GetConfigEnableAppDomain() | |||||
{ | |||||
return LogConfig.GetLogConfigInstance().EnableAppDomain; | |||||
} | |||||
public bool GetConfigEnableThreadId() | |||||
{ | |||||
return LogConfig.GetLogConfigInstance().EnableThreadId; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 创建人:奉友福 | |||||
/// </summary> | |||||
public class LogConfig | |||||
{ | |||||
private bool m_enableDate = true; | |||||
private bool m_enableAppDomain = false; | |||||
private bool m_enableThreadId = false; | |||||
#region 单例模式 | |||||
static private LogConfig m_logConfigInstance = null; | |||||
public static LogConfig GetLogConfigInstance() | |||||
{ | |||||
if (null == m_logConfigInstance) | |||||
{ | |||||
m_logConfigInstance = new LogConfig(); | |||||
} | |||||
return m_logConfigInstance; | |||||
} | |||||
#endregion | |||||
private LogConfig() | |||||
{ | |||||
} | |||||
public bool EnableDate | |||||
{ | |||||
set | |||||
{ | |||||
m_enableDate = value; | |||||
} | |||||
get { return m_enableDate; } | |||||
} | |||||
public bool EnableAppDomain | |||||
{ | |||||
set | |||||
{ | |||||
m_enableAppDomain = value; | |||||
} | |||||
get { return m_enableAppDomain; } | |||||
} | |||||
public bool EnableThreadId | |||||
{ | |||||
set | |||||
{ | |||||
m_enableThreadId = value; | |||||
} | |||||
get { return m_enableThreadId; } | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 创建人:奉友福 | |||||
/// 时间:2021/11/12 | |||||
/// </summary> | |||||
public enum LogLevel | |||||
{ | |||||
OFF = 0, | |||||
FATAL, | |||||
ERROR, | |||||
WARN, | |||||
INFO, | |||||
DEBUG, | |||||
ALL | |||||
} | |||||
} |
@@ -19,17 +19,34 @@ namespace BPASmartClient.IoT | |||||
public class DataVClient | public class DataVClient | ||||
{ | { | ||||
#region 单例模式 | #region 单例模式 | ||||
private volatile static DataVClient _Instance; | |||||
public static DataVClient GetInstance() => _Instance ?? (_Instance = new DataVClient()); | |||||
public static DataVClient init = null; | |||||
public static DataVClient GetInstance() | |||||
{ | |||||
if (init == null) | |||||
{ | |||||
init = new DataVClient(); | |||||
} | |||||
return init; | |||||
} | |||||
/// <summary> | |||||
/// 显示定义构造函数为私有,表示只允许自己实例化自己 | |||||
/// </summary> | |||||
public DataVClient() | public DataVClient() | ||||
{ | { | ||||
DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | ||||
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | ||||
Initialize(); | |||||
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString(); | |||||
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString(); | |||||
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString(); | |||||
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString(); | |||||
} | } | ||||
#endregion | #endregion | ||||
#region 公有变量 | #region 公有变量 | ||||
public string StartupMode { set; get; } | |||||
public string DeviceName { set; get; } | |||||
public string ProductKey { set; get; } | |||||
public string DeviceSecret { set; get; } | |||||
/// <summary> | /// <summary> | ||||
/// DataV 服务地址 | /// DataV 服务地址 | ||||
/// </summary> | /// </summary> | ||||
@@ -49,7 +66,9 @@ namespace BPASmartClient.IoT | |||||
/// <summary> | /// <summary> | ||||
/// 广播 | /// 广播 | ||||
/// </summary> | /// </summary> | ||||
public string PubTopic = "/broadcast/" + "grgpECHSL7q" + "/" + "Transit_SetDevice"; | |||||
//public string PubTopic = "/broadcast/" + "grgpECHSL7q" + "/" + "Transit_SetDevice"; | |||||
public string PubTopic = "/broadcast/" + "grgpECHSL7q" + "/" + "Transit_Test_SetDevice"; | |||||
/// <summary> | /// <summary> | ||||
/// key值 | /// key值 | ||||
/// </summary> | /// </summary> | ||||
@@ -66,7 +85,7 @@ namespace BPASmartClient.IoT | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected()) | |||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | |||||
{ | { | ||||
alarmTable.ClientId = ClientId; | alarmTable.ClientId = ClientId; | ||||
alarmTable.devicename = DeviceDataV.deviceTable.devicename; | alarmTable.devicename = DeviceDataV.deviceTable.devicename; | ||||
@@ -90,7 +109,7 @@ namespace BPASmartClient.IoT | |||||
string id = string.Empty; | string id = string.Empty; | ||||
try | try | ||||
{ | { | ||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected()) | |||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable!=null) | |||||
{ | { | ||||
logTable.ClientId = ClientId; | logTable.ClientId = ClientId; | ||||
logTable.devicename = DeviceDataV.deviceTable.devicename; | logTable.devicename = DeviceDataV.deviceTable.devicename; | ||||
@@ -120,14 +139,29 @@ namespace BPASmartClient.IoT | |||||
public void Initialize() | public void Initialize() | ||||
{ | { | ||||
string message = string.Empty; | string message = string.Empty; | ||||
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, "", ref message)) | |||||
if (StartupMode == "API") | |||||
{ | { | ||||
DeviceDataV.DataVMessageAction += DevIOTActionHandler; | |||||
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceDataV.deviceTable.devicename}阿里云连接成功"); | |||||
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, "", ref message)) | |||||
{ | |||||
ProductKey = DeviceDataV.deviceTable.productkey; | |||||
DeviceName = DeviceDataV.deviceTable.devicename; | |||||
DeviceSecret = DeviceDataV.deviceTable.devicesecret; | |||||
DeviceDataV.DataVMessageAction += DevIOTActionHandler; | |||||
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceName}阿里云连接成功"); | |||||
} | |||||
else | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(message); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
MessageLog.GetInstance.ShowEx(message); | |||||
if (DeviceDataV.InitializeNo(ProductKey, DeviceName, DeviceSecret, ref message)) | |||||
{ | |||||
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceName}阿里云连接成功"); | |||||
} | |||||
else | |||||
MessageLog.GetInstance.ShowEx(message); | |||||
} | } | ||||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | ||||
{ | { | ||||
@@ -143,7 +177,7 @@ namespace BPASmartClient.IoT | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected()) | |||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | |||||
{ | { | ||||
List<object> dataVNode = new List<object>(); | List<object> dataVNode = new List<object>(); | ||||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | ||||
@@ -182,7 +216,7 @@ namespace BPASmartClient.IoT | |||||
/// 增加告警 | /// 增加告警 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="obj"></param> | /// <param name="obj"></param> | ||||
private void AddErrorAction(object obj) | |||||
private void AddErrorAction(int Devid, object obj) | |||||
{ | { | ||||
string id = Guid.NewGuid().ToString(); | string id = Guid.NewGuid().ToString(); | ||||
HttpAddAlarm(new AlarmTable | HttpAddAlarm(new AlarmTable | ||||
@@ -191,16 +225,19 @@ namespace BPASmartClient.IoT | |||||
AlarmType = GetPropertyValue(obj, "Type").ToString(), | AlarmType = GetPropertyValue(obj, "Type").ToString(), | ||||
AlarmMessage = GetPropertyValue(obj, "Text").ToString(), | AlarmMessage = GetPropertyValue(obj, "Text").ToString(), | ||||
AlarmVla = "告警", | AlarmVla = "告警", | ||||
DeviceId = Devid.ToString(), | |||||
KeyID = id, | KeyID = id, | ||||
}); | }); | ||||
keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] =id ; | keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] =id ; | ||||
MessageLog.GetInstance.AddDeviceAlarmLogShow(GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(),id); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除告警 | /// 删除告警 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="obj"></param> | /// <param name="obj"></param> | ||||
private void DeleteErrorAction(object obj) | |||||
private void DeleteErrorAction(int Devid, object obj) | |||||
{ | { | ||||
string message = GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(); | string message = GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(); | ||||
if (keyValues.ContainsKey(message)) | if (keyValues.ContainsKey(message)) | ||||
@@ -211,9 +248,12 @@ namespace BPASmartClient.IoT | |||||
AlarmType = GetPropertyValue(obj, "Type").ToString(), | AlarmType = GetPropertyValue(obj, "Type").ToString(), | ||||
AlarmMessage = GetPropertyValue(obj, "Text").ToString(), | AlarmMessage = GetPropertyValue(obj, "Text").ToString(), | ||||
AlarmVla = "告警", | AlarmVla = "告警", | ||||
DeviceId= Devid.ToString(), | |||||
KeyID = keyValues[message], | KeyID = keyValues[message], | ||||
State="n" | State="n" | ||||
}); | }); | ||||
MessageLog.GetInstance.DeleteDeviceAlarmLogShow(message, keyValues[message]); | |||||
} | } | ||||
} | } | ||||
@@ -43,6 +43,7 @@ namespace BPASmartDatavDeviceClient.IoT | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
if (deviceTable == null) deviceTable = new DeviceTable(); | |||||
deviceTable.devicename = _devicename; | deviceTable.devicename = _devicename; | ||||
SetValue(_productkey, _devicename, _devicesecret); | SetValue(_productkey, _devicename, _devicesecret); | ||||
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); | IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); | ||||
@@ -161,7 +162,7 @@ namespace BPASmartDatavDeviceClient.IoT | |||||
{ | { | ||||
string json = string.Empty; | string json = string.Empty; | ||||
if (string.IsNullOrEmpty(deviceId)) | if (string.IsNullOrEmpty(deviceId)) | ||||
json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}"); | |||||
json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}",1000); | |||||
else | else | ||||
json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}"); | json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}"); | ||||
JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json); | JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json); | ||||
@@ -66,7 +66,7 @@ namespace BPASmartClient.Message | |||||
/// <summary> | /// <summary> | ||||
/// 设备过程日志委托 | /// 设备过程日志委托 | ||||
/// </summary> | /// </summary> | ||||
public Action<string> DeviceProcessLogNotify { get; set; } | |||||
public Action<string, string> DeviceProcessLogNotify { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 设备日志信息字典 | /// 设备日志信息字典 | ||||
@@ -81,6 +81,47 @@ namespace BPASmartClient.Message | |||||
{ | { | ||||
if (!DPLogInfo.ContainsKey(id)) | if (!DPLogInfo.ContainsKey(id)) | ||||
DPLogInfo.TryAdd(id, info); | DPLogInfo.TryAdd(id, info); | ||||
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}"); | |||||
//ExLogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {ExLogInfo}"; | |||||
if (DeviceProcessLogNotify != null) DeviceProcessLogNotify(id,info); | |||||
} | |||||
} | |||||
#endregion | |||||
#region 设备告警日志 | |||||
/// <summary> | |||||
/// 设备告警日志委托 | |||||
/// </summary> | |||||
public Action<string, string> DeviceAlarmLogNotify { get; set; } | |||||
public Action AlarmLogNotify { get; set; } | |||||
/// <summary> | |||||
/// 设备告警日志委托字典 | |||||
/// </summary> | |||||
public ConcurrentDictionary<string, string> DPAlarmInfo = new ConcurrentDictionary<string, string>(); | |||||
/// <summary> | |||||
/// 设备告警日志输出 | |||||
/// </summary> | |||||
/// <param name="info"></param> | |||||
public void AddDeviceAlarmLogShow(string id, string info) | |||||
{ | |||||
DPAlarmInfo[info] = id; | |||||
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}"); | |||||
if (DeviceAlarmLogNotify != null) DeviceAlarmLogNotify(id, info); | |||||
if (AlarmLogNotify != null) AlarmLogNotify(); | |||||
} | |||||
/// <summary> | |||||
/// 设备告警日志输出 | |||||
/// </summary> | |||||
/// <param name="info"></param> | |||||
public void DeleteDeviceAlarmLogShow(string id, string info) | |||||
{ | |||||
if (DPAlarmInfo.ContainsKey(id)) | |||||
{ | |||||
string mes=string.Empty; | |||||
DPAlarmInfo.Remove(id, out mes); | |||||
if (AlarmLogNotify != null) AlarmLogNotify(); | |||||
} | |||||
} | |||||
else | else | ||||
DPLogInfo[id] = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {DPLogInfo[id]}"; | DPLogInfo[id] = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {DPLogInfo[id]}"; | ||||
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}"); | Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}"); | ||||
@@ -1,4 +1,5 @@ | |||||
using BPASmartClient.IoT; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.IoT; | |||||
using BPASmartClient.Message; | using BPASmartClient.Message; | ||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
@@ -22,8 +23,8 @@ namespace BPASmartClient.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public class LogViewModel : ObservableObject | public class LogViewModel : ObservableObject | ||||
{ | { | ||||
//public DispatcherTimer dispatcherTimer; | |||||
public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||||
public DispatcherTimer dispatcherTimer; | |||||
public string ClientId= System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||||
private ObservableCollection<LogModel> _LogModels; | private ObservableCollection<LogModel> _LogModels; | ||||
public ObservableCollection<LogModel> LogDataGrid | public ObservableCollection<LogModel> LogDataGrid | ||||
{ | { | ||||
@@ -43,20 +44,46 @@ namespace BPASmartClient.ViewModel | |||||
public static LogViewModel GetInstance() => _Instance ?? (_Instance = new LogViewModel()); | public static LogViewModel GetInstance() => _Instance ?? (_Instance = new LogViewModel()); | ||||
private LogViewModel() | private LogViewModel() | ||||
{ | { | ||||
if (LogDataGrid == null) | |||||
LogDataGrid = new ObservableCollection<LogModel>(); | |||||
logHelper.Fun_InitLog(System.AppDomain.CurrentDomain.BaseDirectory); | |||||
if (LogDataGrid==null) LogDataGrid = new ObservableCollection<LogModel>(); | |||||
//一般日志 | |||||
MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | ||||
{ | { | ||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | ||||
{ | { | ||||
LogDataGrid.Insert(0, new LogModel { message = s, type = "Base" });//基础消息 | |||||
LogDataGrid.Insert(0,new LogModel { message = s,type = "Info" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, s); | |||||
})); | })); | ||||
}); | }); | ||||
//设备日志 | |||||
MessageLog.GetInstance.DeviceProcessLogNotify = new Action<string,string>((id,s) => | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
LogDataGrid.Insert(0, new LogModel { message = s, type = "DeviceLog" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.DEBUG, s); | |||||
})); | |||||
}); | |||||
//设备告警日志 | |||||
MessageLog.GetInstance.DeviceAlarmLogNotify = new Action<string, string>((id, s) => | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
LogDataGrid.Insert(0, new LogModel { message = id, type = "DeviceAlarm" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.WARN, id); | |||||
})); | |||||
}); | |||||
//错误日志 | |||||
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | ||||
{ | { | ||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | ||||
{ | { | ||||
LogDataGrid.Insert(0, new LogModel { message = s, type = "Error" });//错误消息 | |||||
LogDataGrid.Insert(0,new LogModel { message = s,type = "Error" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR, s); | |||||
DataVClient.GetInstance().HttpAddLog(new LogTable | DataVClient.GetInstance().HttpAddLog(new LogTable | ||||
{ | { | ||||
ClientId = ClientId, | ClientId = ClientId, | ||||
@@ -78,6 +105,21 @@ namespace BPASmartClient.ViewModel | |||||
{ | { | ||||
ExcellOrder(); | ExcellOrder(); | ||||
}); | }); | ||||
dispatcherTimer = new DispatcherTimer(); | |||||
dispatcherTimer.Tick += delegate | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
if (LogDataGrid.Count > 100) | |||||
{ | |||||
LogDataGrid.RemoveAt(LogDataGrid.Count-1); | |||||
} | |||||
})); | |||||
}; | |||||
dispatcherTimer.Interval = TimeSpan.FromSeconds(10); | |||||
dispatcherTimer.Start(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -1,4 +1,6 @@ | |||||
using BPASmartClient.Business; | using BPASmartClient.Business; | ||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Message; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
using System; | using System; | ||||
@@ -9,6 +11,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using System.Windows; | using System.Windows; | ||||
using System.Windows.Input; | using System.Windows.Input; | ||||
using System.Windows.Threading; | |||||
namespace BPASmartClient.ViewModel | namespace BPASmartClient.ViewModel | ||||
{ | { | ||||
@@ -17,9 +20,101 @@ namespace BPASmartClient.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public class MainViewModel : ObservableObject | public class MainViewModel : ObservableObject | ||||
{ | { | ||||
/// <summary> | |||||
/// 网络连接状态 | |||||
/// </summary> | |||||
private bool _NetworkConnectState = true; | |||||
public bool NetworkConnectState | |||||
{ | |||||
get | |||||
{ | |||||
return _NetworkConnectState; | |||||
} | |||||
set | |||||
{ | |||||
if (_NetworkConnectState == value) | |||||
return; | |||||
_NetworkConnectState = value; | |||||
OnPropertyChanged("NetworkConnectState"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 是否告警 | |||||
/// </summary> | |||||
public AlarmModel IsAlarm { get; set; } | |||||
public DispatcherTimer dispatcherTimer; | |||||
public MainViewModel() | public MainViewModel() | ||||
{ | { | ||||
IsAlarm =new AlarmModel(); | |||||
OrderStatusViewModel.Init(); | OrderStatusViewModel.Init(); | ||||
//设备告警日志 | |||||
MessageLog.GetInstance.AlarmLogNotify = new Action(() => | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
IsAlarm.IsCheck = MessageLog.GetInstance.DPAlarmInfo.Count > 0; | |||||
IsAlarm.ListNum = MessageLog.GetInstance.DPAlarmInfo.Count; | |||||
})); | |||||
}); | |||||
dispatcherTimer = new DispatcherTimer(); | |||||
dispatcherTimer.Tick += delegate | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
NetworkConnectState = UniversalHelper.GetInstance().GetNetworkState(); | |||||
})); | |||||
}; | |||||
dispatcherTimer.Interval = TimeSpan.FromSeconds(1); | |||||
dispatcherTimer.Start(); | |||||
} | |||||
} | |||||
public class AlarmModel : ObservableObject | |||||
{ | |||||
/// <summary> | |||||
/// 是否告警 | |||||
/// </summary> | |||||
private bool _IsCheck = false; | |||||
public bool IsCheck | |||||
{ | |||||
get | |||||
{ | |||||
return _IsCheck; | |||||
} | |||||
set | |||||
{ | |||||
if (_IsCheck == value) | |||||
return; | |||||
_IsCheck = value; | |||||
OnPropertyChanged("IsCheck"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 告警数量 | |||||
/// </summary> | |||||
private int _ListNum = 0; | |||||
public int ListNum | |||||
{ | |||||
get | |||||
{ | |||||
return _ListNum; | |||||
} | |||||
set | |||||
{ | |||||
if (_ListNum == value) | |||||
return; | |||||
_ListNum = value; | |||||
OnPropertyChanged("ListNum"); | |||||
} | |||||
} | |||||
public AlarmModel() | |||||
{ | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -2,14 +2,6 @@ | |||||
<configuration> | <configuration> | ||||
<appSettings> | <appSettings> | ||||
<!--通用配置--> | <!--通用配置--> | ||||
<!--测试服务 Consul 地址--> | |||||
<!--<add key="ConsulAddress" value="http://111.9.47.105:9011/" />--> | |||||
<!--正式服务 Consul 地址--> | |||||
<!--<add key="ConsulAddress" value="http://162.14.105.138:9005" />--> | |||||
<!--客户端ID--> | |||||
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | <!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | ||||
<add key="ClientId" value="111"/> | <add key="ClientId" value="111"/> | ||||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | <!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | ||||
@@ -17,6 +9,7 @@ | |||||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | <add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | ||||
<!--<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/>--> | <!--<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/>--> | ||||
<add key="ClientId" value="2"/> | |||||
<!--开发环境--> | <!--开发环境--> | ||||
<add key="ApolloUri" value="http://10.2.1.21:28080"/> | <add key="ApolloUri" value="http://10.2.1.21:28080"/> | ||||
@@ -32,8 +25,16 @@ | |||||
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/> | <add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/> | ||||
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>--> | <add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>--> | ||||
<add key="COM_Coffee" value="COM3"/> | |||||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||||
<!--LOCAL:直接使用下方本地“设备连接信息”--> | |||||
<add key="StartupMode" value="API"/> | |||||
<add key="ProductKey" value="grgpECHSL7q"/> | |||||
<add key="DeviceName" value="qsqd"/> | |||||
<add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/> | |||||
<!--外设配置--> | |||||
<add key="COM_Coffee" value="COM3"/> | |||||
<add key="BAUD_Coffee" value="115200"/> | <add key="BAUD_Coffee" value="115200"/> | ||||
<add key="COM_IceCream" value="COM12"/> | <add key="COM_IceCream" value="COM12"/> | ||||
<add key="BAUD_IceCream" value="9600"/> | <add key="BAUD_IceCream" value="9600"/> | ||||
@@ -25,9 +25,9 @@ | |||||
<!--查询按钮栏--> | <!--查询按钮栏--> | ||||
<StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | <StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | ||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | |||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}">导出</Button> | |||||
<!--<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | |||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox>--> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}">导出日志</Button> | |||||
</StackPanel> | </StackPanel> | ||||
<!--表格栏--> | <!--表格栏--> | ||||
@@ -177,16 +177,15 @@ | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
Cursor="Hand" | Cursor="Hand" | ||||
DataContext="{Binding GaoJingMessage}" | |||||
IsChecked="True" | |||||
IsChecked="{Binding NetworkConnectState}" | |||||
Style="{DynamicResource StatusBtnStyle网络连接状态}" | Style="{DynamicResource StatusBtnStyle网络连接状态}" | ||||
ToolTip="网络连接状态" /> | ToolTip="网络连接状态" /> | ||||
<Border Style="{DynamicResource border竖线}" /> | <Border Style="{DynamicResource border竖线}" /> | ||||
<ToggleButton | <ToggleButton | ||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
Cursor="Hand" | |||||
DataContext="{Binding GaoJingMessage}" | |||||
Cursor="Hand" | |||||
DataContext="{Binding IsAlarm}" | |||||
Style="{DynamicResource StatusBtnStyle告警}" | Style="{DynamicResource StatusBtnStyle告警}" | ||||
ToolTip="告警消息" /> | ToolTip="告警消息" /> | ||||
<Border Style="{DynamicResource border竖线}" /> | <Border Style="{DynamicResource border竖线}" /> | ||||
@@ -63,6 +63,8 @@ namespace BPASmartClient | |||||
{ | { | ||||
new MainConsole().Start(); | new MainConsole().Start(); | ||||
}), "启动主控制台", false); | }), "启动主控制台", false); | ||||
DataVClient.GetInstance().Initialize(); | |||||
DataVClient.GetInstance().Start(); | DataVClient.GetInstance().Start(); | ||||
} | } | ||||
#endregion | #endregion | ||||