From 0cf9b3a566f84e6dad9d59a2f2d696a5de7878ad Mon Sep 17 00:00:00 2001 From: Eveldee Date: Mon, 29 Apr 2019 22:35:59 +0200 Subject: [PATCH] Fix app and save on id add --- PlantBox.Broker/PlantBox.cs | 9 ++++++++- .../PlantBox.Client.Android.csproj | 4 ++++ PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/PlantBox.Broker/PlantBox.cs b/PlantBox.Broker/PlantBox.cs index 8ad64d7..e947e49 100644 --- a/PlantBox.Broker/PlantBox.cs +++ b/PlantBox.Broker/PlantBox.cs @@ -26,11 +26,18 @@ namespace PlantBox.Broker // State conditions public void UpdateState() { + bool IsDay() + { + double hour = DateTime.Now.Hour; + + return hour > 8 && hour < 20; + } + if (Humidity.Value < Humidity.Min || Humidity.Value > Humidity.Max) { State = PlantState.Warning; } - if (Luminosity.Value < Luminosity.Min || Luminosity.Value > Luminosity.Max) + if (IsDay() && Luminosity.Value < Luminosity.Min || Luminosity.Value > Luminosity.Max) { State = PlantState.Warning; } diff --git a/PlantBox.Client/PlantBox.Client.Android/PlantBox.Client.Android.csproj b/PlantBox.Client/PlantBox.Client.Android/PlantBox.Client.Android.csproj index 978d123..42bbecd 100644 --- a/PlantBox.Client/PlantBox.Client.Android/PlantBox.Client.Android.csproj +++ b/PlantBox.Client/PlantBox.Client.Android/PlantBox.Client.Android.csproj @@ -46,6 +46,10 @@ 4 true false + false + false + false + diff --git a/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs b/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs index 5d7fe80..193dbc5 100644 --- a/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs +++ b/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs @@ -56,6 +56,7 @@ namespace PlantBox.Client.Forms { App.Settings.IDs.Add(id); + await App.Settings.SaveAsync(); await Refresh(); } else