//to do, im moment nur test public bool sendPush() { string messageText = " "; string titleText = "Neues Objekt gefunden:"; if (this.ImmoscoutURL.Contains("/Wohnung-")) { titleText = "Neue Wohnung gefunden:"; } else if (this.ImmoscoutURL.Contains("/Haus-")) { titleText = "Neues Haus gefunden:"; } HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument(); StreamReader reader = new StreamReader(WebRequest.Create(ImmoscoutURL).GetResponse().GetResponseStream(), Encoding.GetEncoding("iso-8859-1")); String htmlString = reader.ReadToEnd(); document.LoadHtml(WebUtility.HtmlDecode(htmlString)); var header = document.DocumentNode.SelectNodes("/descendant::li[attribute::class=\"media medialist box\" and attribute::data-obid=\"" + this.newScoutId + "\"]/descendant::div[attribute::class=\"medialist__heading-wrapper\"]/descendant::a"); if (header.Count == 1) { messageText = header[0].InnerText.Trim(); } System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker(); worker.DoWork += delegate { ServiceClient client = new ServiceClient(); client.SendToast(titleText, messageText, this.PushNotificationURI); }; try { worker.RunWorkerAsync(); } catch (Exception) { reader.Close(); return false; } reader.Close(); return true; }