Updated other uses of Internal Config to GLOBAL--FlexiApplication

This commit is contained in:
2025-11-04 13:16:07 +00:00
parent 1c89cf2847
commit 78c440ab76
8 changed files with 47 additions and 18 deletions

View File

@@ -1,7 +1,9 @@
using System.Net;
using System.Diagnostics;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace AiQ_GUI
{
@@ -10,7 +12,7 @@ namespace AiQ_GUI
public static HttpClient? SingleHTTPClient;
public static HttpClient Client => SingleHTTPClient ?? throw new InvalidOperationException("Client not initialized.");
public static void Initialize(string username, string password)
public async static void Initialize(string username, string password)
{
HttpClientHandler handler = new()
{
@@ -23,6 +25,17 @@ namespace AiQ_GUI
{
Timeout = TimeSpan.FromSeconds(20)
};
bool UP = false;
int i = 0;
while (!UP)
{
UP = await PingIP("8.8.8.8");
await Task.Delay(500);
if (i >= 5) MainForm.Instance.AddToActionsList($"Could not initialise new network with USER: {username} & PSWD: {password}"); // Try 5 times max
i++;
}
}
// Handles get and post to the camera API