If the settings are changed while collecting weather, ignore the exception
This commit is contained in:
parent
00b228c008
commit
df7e4f2044
@ -25,25 +25,27 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model.Sensor {
|
|||||||
|
|
||||||
private void BackGroundRunner() {
|
private void BackGroundRunner() {
|
||||||
while(this.backgroundrunnerAlive) {
|
while(this.backgroundrunnerAlive) {
|
||||||
List<Warning> ret = new List<Warning>();
|
try {
|
||||||
foreach(Int32 item in Settings.Instance.Internal.WeatherCellIDs) {
|
List<Warning> ret = new List<Warning>();
|
||||||
try {
|
foreach(Int32 item in Settings.Instance.Internal.WeatherCellIDs) {
|
||||||
JsonData json = this.webrequests.GetJson("https://maps.dwd.de/geoserver/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeName=dwd:Warnungen_Gemeinden&outputFormat=application/json&cql_filter=WARNCELLID=" + item);
|
try {
|
||||||
if (json.ContainsKey("features") && json["features"].IsArray && json["features"].Count > 0) {
|
JsonData json = this.webrequests.GetJson("https://maps.dwd.de/geoserver/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeName=dwd:Warnungen_Gemeinden&outputFormat=application/json&cql_filter=WARNCELLID=" + item);
|
||||||
foreach (JsonData warning in json["features"]) {
|
if(json.ContainsKey("features") && json["features"].IsArray && json["features"].Count > 0) {
|
||||||
try {
|
foreach(JsonData warning in json["features"]) {
|
||||||
ret.Add(new Warning(warning));
|
try {
|
||||||
} catch { }
|
ret.Add(new Warning(warning));
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch { }
|
||||||
} catch { }
|
|
||||||
}
|
|
||||||
this.Warnungen = ret;
|
|
||||||
for (Int32 i = 0; i < 1000; i++) {
|
|
||||||
if (this.backgroundrunnerAlive) {
|
|
||||||
Thread.Sleep(60);
|
|
||||||
}
|
}
|
||||||
}
|
this.Warnungen = ret;
|
||||||
|
for(Int32 i = 0; i < 1000; i++) {
|
||||||
|
if(this.backgroundrunnerAlive) {
|
||||||
|
Thread.Sleep(60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user