public override bool Connect() { try { if (RobotClient == null) { RobotClientSetup(); } if (ZarizeniJeDlePinguOnline) { RobotClient?.Connect(); } bool status = false; status = RobotClient.Connected; if (status) { Status = Stav.Online; NastaveniHlidacihoPsa(); HlidaciPes.Zapni(); } return(status); } catch (Exception exception) { var zarizeniArgs = new ZarizeniArgs(Status, Ping, $"!CHYBA!", exception); OnStatusChanged(zarizeniArgs); return(false); } }
private void NastaveniHlidacihoPsa() { if (HlidaciPes != null) { return; } HlidaciPes = new HlidaciPes <VstupVystup>(this); HlidaciPes.HlidaciPesNecoZaznamenal += (object Nalez) => { Hlaseni hlaseniPsa = (Hlaseni)Nalez; VstupVystup vstupVystup = (VstupVystup)hlaseniPsa.Zprava; if (vstupVystup.Nazev.ToLower() == "error") { if (vstupVystup.Hodnota) { Status = Stav.InError; } else { Status = Stav.Online; } } }; }