From 0789071eeec578ffd74110cc687ddc4f8c576367 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 5 Mar 2024 10:54:21 +0200 Subject: [PATCH] Add setting whether to reload APIs from server (#72) To not reload all data entered by user will be preserved --- src/client/DCSInsight/App.config | 6 ++ .../Communication/TCPClientHandler.cs | 6 +- src/client/DCSInsight/MainWindow.xaml | 5 +- src/client/DCSInsight/MainWindow.xaml.cs | 36 +++++++--- .../Properties/Settings.Designer.cs | 26 +++++++- .../DCSInsight/Properties/Settings.settings | 6 ++ .../Windows/WindowAskReloadAPIDialog.xaml | 40 ++++++++++++ .../Windows/WindowAskReloadAPIDialog.xaml.cs | 65 +++++++++++++++++++ 8 files changed, 176 insertions(+), 14 deletions(-) create mode 100644 src/client/DCSInsight/Windows/WindowAskReloadAPIDialog.xaml create mode 100644 src/client/DCSInsight/Windows/WindowAskReloadAPIDialog.xaml.cs diff --git a/src/client/DCSInsight/App.config b/src/client/DCSInsight/App.config index 11e2f1d..ca31740 100644 --- a/src/client/DCSInsight/App.config +++ b/src/client/DCSInsight/App.config @@ -22,6 +22,12 @@ -1 + + False + + + True + \ No newline at end of file diff --git a/src/client/DCSInsight/Communication/TCPClientHandler.cs b/src/client/DCSInsight/Communication/TCPClientHandler.cs index cce29d1..34d8bc0 100644 --- a/src/client/DCSInsight/Communication/TCPClientHandler.cs +++ b/src/client/DCSInsight/Communication/TCPClientHandler.cs @@ -30,11 +30,13 @@ internal class TCPClientHandler : IDisposable, ICommandListener public bool LogJSON { get; set; } private string _currentMessage = ""; private volatile bool _responseReceived; + private bool _requestAPIList; - public TCPClientHandler(string host, string port) + public TCPClientHandler(string host, string port, bool requestAPIList) { _host = host; _port = port; + _requestAPIList = requestAPIList; ICEventHandler.AttachCommandListener(this); } @@ -75,7 +77,7 @@ private async void ClientThread() if (!_tcpClient.Connected) break; - if (!_apiListReceived && _metaDataPollCounter < 1) + if (_requestAPIList && !_apiListReceived && _metaDataPollCounter < 1) { Thread.Sleep(300); _metaDataPollCounter++; diff --git a/src/client/DCSInsight/MainWindow.xaml b/src/client/DCSInsight/MainWindow.xaml index 4195a94..d0f5ce0 100644 --- a/src/client/DCSInsight/MainWindow.xaml +++ b/src/client/DCSInsight/MainWindow.xaml @@ -26,7 +26,7 @@ - +