diff --git a/HBLConsole.Business/HeartbeatReport.cs b/HBLConsole.Business/HeartbeatReport.cs index 518e5c1..5359177 100644 --- a/HBLConsole.Business/HeartbeatReport.cs +++ b/HBLConsole.Business/HeartbeatReport.cs @@ -47,7 +47,7 @@ namespace HBLConsole.Business MessagePackage.Message = deviceStatus;//GetMessage == null ? deviceStatus : GetMessage(); MqttHelper.GetInstance.MqttPublishAsync(Topic, MessagePackage.Serialize()); Thread.Sleep(1000); - }), "设备心跳上报"); + }), "设备心跳上报", true); } } diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs index 5bc3549..8a4a368 100644 --- a/HBLConsole.MainConsole/Main.cs +++ b/HBLConsole.MainConsole/Main.cs @@ -46,7 +46,6 @@ namespace HBLConsole.MainConsole Json.Save(); Sqlite.GetInstance.Save(); TextHelper.GetInstance.SaveLogInfo(MessageLog.GetInstance.LogInfo, "LogInfo", "OrderInfoLog"); - } public void BusinessInit() @@ -54,7 +53,7 @@ namespace HBLConsole.MainConsole ThreadManage.GetInstance.Start(new Action(() => { InternetInfo.ConfigInit();//从 consul 获取配置数据 - //IotReport.GetInstance.Initialize(); + IotReport.GetInstance.Initialize(); Topics.Clear(); Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId)); Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId)); diff --git a/HBLConsole.PryUserControl/IcoButton.xaml b/HBLConsole.PryUserControl/IcoButton.xaml new file mode 100644 index 0000000..362925c --- /dev/null +++ b/HBLConsole.PryUserControl/IcoButton.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + diff --git a/HBLConsole.PryUserControl/IcoButton.xaml.cs b/HBLConsole.PryUserControl/IcoButton.xaml.cs new file mode 100644 index 0000000..5e528ab --- /dev/null +++ b/HBLConsole.PryUserControl/IcoButton.xaml.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace HBLConsole.PryUserControl +{ + /// + /// IcoButton.xaml 的交互逻辑 + /// + public partial class IcoButton : UserControl + { + public IcoButton() + { + InitializeComponent(); + } + + public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + (d as IcoButton).Refresh(); + } + + private void Refresh() + { + + } + + public int BorderThickness + { + get { return (int)GetValue(BorderThicknessProperty); } + set { SetValue(BorderThicknessProperty, value); } + } + public static readonly DependencyProperty BorderThicknessProperty = + DependencyProperty.Register("BorderThickness", typeof(int), typeof(IcoButton), + new PropertyMetadata(2, new PropertyChangedCallback(OnPropertyChanged))); + + } +} diff --git a/HBLConsole.Service/ThreadManage.cs b/HBLConsole.Service/ThreadManage.cs index 46d20bd..3ab8e21 100644 --- a/HBLConsole.Service/ThreadManage.cs +++ b/HBLConsole.Service/ThreadManage.cs @@ -46,28 +46,28 @@ namespace HBLConsole.Service CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => { - ccc: + ReStart: try { while (!CancellationTokenSources[guid + key].IsCancellationRequested) { - if (action != null) - { - action(); - } + if (action != null) action(); } } catch (Exception ex) { - MessageLog.GetInstance.Show(ex.ToString()); - - if (IsRestart) goto ccc; + if (IsRestart) + { + Thread.Sleep(2000); + MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启"); + goto ReStart; + } else { CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp); Threads.TryRemove(guid + key, out Task temp1); - MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启"); + MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已退出"); } } }), CancellationTokenSources[guid + key].Token).ContinueWith(new Action((t, o) => diff --git a/HBLConsole/App.config b/HBLConsole/App.config index 4286ab6..19426ed 100644 --- a/HBLConsole/App.config +++ b/HBLConsole/App.config @@ -11,7 +11,7 @@ - + diff --git a/HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml b/HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml index d8caac4..04ea3f1 100644 --- a/HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml +++ b/HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml @@ -474,6 +474,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + Source="http://1.14.74.54:8808/welcome" />