|
|
|
@ -13,7 +13,6 @@ namespace SunlightAggregationTerminal.Models |
|
|
|
|
|
|
|
public static SqliteHelper sqliteHelper = SQLiteConfig.Config(Path.Combine(FileSystem.AppDataDirectory, "MyAppData.db"))!; //数据库连接路径(获取各平台的应用数据目录)
|
|
|
|
private Timer timer; |
|
|
|
private static int TimerNotifications = -1440; |
|
|
|
public AppModels() |
|
|
|
{ |
|
|
|
if(sqliteHelper != null) |
|
|
|
@ -42,13 +41,14 @@ namespace SunlightAggregationTerminal.Models |
|
|
|
App.GlobalData.LocalAreaNetworkMode = Convert.ToBoolean(dat.Field<object>("LocalAreaNetworkMode")); |
|
|
|
App.GlobalData.DarkMode = Convert.ToBoolean(dat.Field<object>("DarkMode")); |
|
|
|
App.GlobalData.MessageNotificationMode = Convert.ToBoolean(dat.Field<object>("MessageNotificationMode")); |
|
|
|
App.GlobalData.NotificationID = dat.Field<string>("NotificationID")?? "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//启动通知轮询延迟120s启动周期600s
|
|
|
|
timer = new Timer(TimerNotification, null, TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(300)); |
|
|
|
timer = new Timer(TimerNotification, null, TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(10)); |
|
|
|
} |
|
|
|
|
|
|
|
//轮询通知的定时任务
|
|
|
|
@ -58,10 +58,9 @@ namespace SunlightAggregationTerminal.Models |
|
|
|
{ |
|
|
|
Dictionary<string, object> NotificationDictionary = new Dictionary<string, object>(); |
|
|
|
NotificationDictionary.Add("Command", "Notification"); |
|
|
|
NotificationDictionary.Add("StartTime", DateTime.Now.AddMinutes(TimerNotifications).ToString("yyyy-MM-dd HH:mm:ss.fff")); |
|
|
|
NotificationDictionary.Add("StartTime", App.GlobalData.NotificationID); |
|
|
|
NotificationDictionary.Add("EndTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); |
|
|
|
DataReceived.Transmit(NotificationDictionary.ToJsonString()); |
|
|
|
TimerNotifications = -5; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -134,8 +133,6 @@ namespace SunlightAggregationTerminal.Models |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string GetAppUniqueId() |
|
|
|
{ |
|
|
|
const string key = "sunlight_app_unique_id"; |
|
|
|
|