diff --git a/NanoleafAPI/API/Controller.cs b/NanoleafAPI/API/Controller.cs index d72467e..b69b7e7 100644 --- a/NanoleafAPI/API/Controller.cs +++ b/NanoleafAPI/API/Controller.cs @@ -15,6 +15,7 @@ public class Controller : IDisposable [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public string? Auth_token { get; private set; } = null; private bool isDisposed = false; + public bool IsInitializing { get; private set; } = false; public bool IsInitialized { get; private set; } = false; protected bool IsSendPossible { @@ -260,7 +261,7 @@ public Controller(string ip, string port, bool initialize, string? auth_token = Port = port; Auth_token = auth_token; if (initialize) - _ = startServices(); + _ = Initialize(); } #pragma warning restore CS8618 @@ -272,8 +273,10 @@ public async Task Initialize() { if (this.IsInitialized) return; - + this.IsInitializing = true; await this.startServices(); + this.IsInitialized = true; + this.IsInitializing = false; } private async Task startServices() { @@ -283,7 +286,6 @@ private async Task startServices() } _ = this.runController(); this.streamController(); - IsInitialized = true; } public async Task RequestToken(int tryes = 20) diff --git a/NanoleafAPI/NanoleafAPI.csproj b/NanoleafAPI/NanoleafAPI.csproj index 5ce6d4f..68b5447 100644 --- a/NanoleafAPI/NanoleafAPI.csproj +++ b/NanoleafAPI/NanoleafAPI.csproj @@ -5,7 +5,7 @@ enable enable LICENSE - 0.0.37 + 0.0.38 https://github.com/patrick-dmxc/NanoleafAPI $(RepositoryUrl) Nanoleaf Light-Panels Canvas Shapes Essentials Elemants Lines API SmartHome