V4.3 Changes - Bradley B
This commit is contained in:
17
Network.cs
17
Network.cs
@@ -10,7 +10,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 +23,21 @@ namespace AiQ_GUI
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(20)
|
||||
};
|
||||
|
||||
bool UP = false;
|
||||
int i = 0;
|
||||
|
||||
while (!UP)
|
||||
{
|
||||
UP = await PingIP("10.10.10.137");
|
||||
await Task.Delay(500);
|
||||
if (i >= 5)
|
||||
{
|
||||
//MainForm.Instance.AddToActionsList($"Could not initialise new network with USER: {username} & PSWD: {password}");
|
||||
return; // Try 5 times max
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles get and post to the camera API
|
||||
|
||||
Reference in New Issue
Block a user