Updated other uses of Internal Config to GLOBAL--FlexiApplication
This commit is contained in:
17
Network.cs
17
Network.cs
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user