From 08562998482b05c8398f135b886602cef5c71af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rik=20Levente?= Date: Sun, 1 Oct 2023 16:49:07 +0200 Subject: [PATCH] Refresh interval doesn't require restart --- core/MainWindow.xaml.cs | 4 +++ interface/pages/settings.svelte | 55 ++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/core/MainWindow.xaml.cs b/core/MainWindow.xaml.cs index 4639357..e2ace08 100644 --- a/core/MainWindow.xaml.cs +++ b/core/MainWindow.xaml.cs @@ -49,6 +49,7 @@ public MainWindow() { APIRefresher.Start(); } + // Refresh API public void RefreshAPI(object sender, object e) { System.Threading.Tasks.Task.Run(() => { App.GlobalHardwareInfo.Refresh(); @@ -57,6 +58,7 @@ public void RefreshAPI(object sender, object e) { SendAPI(); } + // Start webview private async void Init() { await webView.EnsureCoreWebView2Async(); webView.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; @@ -125,6 +127,8 @@ public async void WebView_WebMessageReceived(object sender, CoreWebView2WebMessa case "newSettings": App.GlobalSettings = JsonSerializer.Deserialize(content.Content, App.SerializerOptions); + APIRefresher.Interval = new TimeSpan(0, 0, App.GlobalSettings.interval); + setSettings(App.GlobalSettings); break; diff --git a/interface/pages/settings.svelte b/interface/pages/settings.svelte index a88eea3..1342093 100644 --- a/interface/pages/settings.svelte +++ b/interface/pages/settings.svelte @@ -25,7 +25,7 @@

Refresh interval

-

How often does Cores refreshes the sensors and displays the data. Restart required.

+

How often does Cores refreshes the sensors and displays the data.