@@ -136,9 +136,6 @@ namespace BPASmartClient.Device | |||||
public virtual void StartMain() | public virtual void StartMain() | ||||
{ | { | ||||
#region 测试添加几个日志与告警 | |||||
#endregion | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
foreach (var peripheral in peripherals) | foreach (var peripheral in peripherals) | ||||
@@ -259,8 +256,6 @@ namespace BPASmartClient.Device | |||||
}); | }); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 报警监控 | /// 报警监控 | ||||
/// </summary> | /// </summary> | ||||
@@ -28,7 +28,7 @@ namespace BPASmartClient.ViewModel | |||||
#endregion | #endregion | ||||
#region 变量 | #region 变量 | ||||
public string api = "https://bpa.black-pa.com:21527/datav/api/Log/QueryLogFile?DeviceName="; | public string api = "https://bpa.black-pa.com:21527/datav/api/Log/QueryLogFile?DeviceName="; | ||||
public string DataVApiAddress { set; get; } | |||||
private ObservableCollection<FileModel> _LogModels; public ObservableCollection<FileModel> LogDataFile | private ObservableCollection<FileModel> _LogModels; public ObservableCollection<FileModel> LogDataFile | ||||
{ | { | ||||
get | get | ||||
@@ -51,6 +51,8 @@ namespace BPASmartClient.ViewModel | |||||
#region 函数 | #region 函数 | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | |||||
LogDataFile = new ObservableCollection<FileModel>(); | LogDataFile = new ObservableCollection<FileModel>(); | ||||
//查询 | //查询 | ||||
QueryCommand = new RelayCommand(() => | QueryCommand = new RelayCommand(() => | ||||
@@ -66,7 +68,7 @@ namespace BPASmartClient.ViewModel | |||||
try | try | ||||
{ | { | ||||
LogDataFile.Clear(); | LogDataFile.Clear(); | ||||
api = $"https://bpa.black-pa.com:21527/datav/api/Log/QueryLogFile?DeviceName={DataVClient.GetInstance().DeviceDataV.deviceTable.devicename}"; ; | |||||
api = $"{DataVApiAddress}/api/Log/QueryLogFile?DeviceName={DataVClient.GetInstance().DeviceDataV.deviceTable.devicename}"; ; | |||||
string json = HttpRequestHelper.HttpGetRequest(api, 1000); | string json = HttpRequestHelper.HttpGetRequest(api, 1000); | ||||
JsonMsg<List<FileModel>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<FileModel>>>(json); | JsonMsg<List<FileModel>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<FileModel>>>(json); | ||||
jsonMsg.obj?.data?.ForEach(file => | jsonMsg.obj?.data?.ForEach(file => | ||||
@@ -37,6 +37,7 @@ namespace BPASmartClient | |||||
/// </summary> | /// </summary> | ||||
public partial class MainWindow : Window | public partial class MainWindow : Window | ||||
{ | { | ||||
public MainConsole mainConsole; | |||||
public MainWindow() | public MainWindow() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
@@ -67,7 +68,8 @@ namespace BPASmartClient | |||||
ThreadManage.GetInstance().Start(new Action(() => | ThreadManage.GetInstance().Start(new Action(() => | ||||
{ | { | ||||
new MainConsole().Start(); | |||||
mainConsole = new MainConsole(); | |||||
mainConsole.Start(); | |||||
GetDevices(); | GetDevices(); | ||||
}), "启动主控制台", false); | }), "启动主控制台", false); | ||||
@@ -82,10 +84,51 @@ namespace BPASmartClient | |||||
{ | { | ||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | MessageLog.GetInstance.ShowEx(ex.ToString()); | ||||
} | } | ||||
}), "启动主IoT", false); | }), "启动主IoT", false); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||||
{ | |||||
App.Current.Dispatcher.Invoke(new Action(() => | |||||
{ | |||||
if (o is IOTCommandModel iot) | |||||
{ | |||||
switch (iot.CommandName) | |||||
{ | |||||
case 0://控制类 | |||||
if (iot.CommandValue != null && iot.CommandValue.Count>0) | |||||
{ | |||||
switch (iot.CommandValue.Keys.ToList()[0]) | |||||
{ | |||||
case "程序启动": | |||||
//mainConsole.Start(); | |||||
break; | |||||
//mainConsole.Stop(); | |||||
case "程序停止": | |||||
break; | |||||
case "程序复位": | |||||
//mainConsole.Stop(); | |||||
//mainConsole.Start(); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏控制", iot.CommandValue.Keys.ToList()[0]); | |||||
} | |||||
break; | |||||
case 1://设置类 | |||||
break; | |||||
case 2://通知类 | |||||
if (iot.CommandValue != null && iot.CommandValue.ContainsKey("text")) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏通知", iot.CommandValue["text"]); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
})); | |||||
}), "IotBroadcast"); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 获取设备集合 | /// 获取设备集合 | ||||