From 6991ab501a620adebce455359ff39184c7834852 Mon Sep 17 00:00:00 2001 From: "David P.G" Date: Sun, 6 Jul 2025 20:25:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E7=9F=AD=E6=97=B6=E9=97=B4=E5=86=85=E9=87=8D=E5=A4=8D=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.xaml.cs | 2 +- Services/MqttBackgroundService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App.xaml.cs b/App.xaml.cs index d22c1a0..a24a631 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -81,7 +81,7 @@ public partial class App : Application services.AddSingleton(); services.AddSingleton(); services.AddHostedService(); // Register as HostedService - // services.AddHostedService(); + services.AddHostedService(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/Services/MqttBackgroundService.cs b/Services/MqttBackgroundService.cs index 6037240..13945be 100644 --- a/Services/MqttBackgroundService.cs +++ b/Services/MqttBackgroundService.cs @@ -129,7 +129,7 @@ namespace PMSWPF.Services // 发布MQTT消息。 await client.PublishAsync(message); - NlogHelper.Info($"Published {variable.Name} = {variable.DataValue} to {topic}/{variable.Name}"); // 记录发布信息 + NlogHelper.Info($"Published {variable.Name} = {variable.DataValue} to {topic}/{variable.Name}",throttle:true); // 记录发布信息 variable.IsModified = false; // 发布后重置修改标志。 } }