private void tmr_geupdates_Tick(object sender, EventArgs e) { try { using (WebClient searchvid = new WebClient()) { string searchvidstream = searchvid.DownloadString("http://services.runescape.com/m=itemdb_rs/Nature_rune/viewitem.ws?obj=561"); StringReader searchvidread = new StringReader(searchvidstream); { string searchvidreadtemp = ""; int spot1 = -1; int spot2 = -1; int newprice = 0; while ((searchvidreadtemp = searchvidread.ReadLine()) != null) { if (searchvidreadtemp.Contains("<td>")) { spot1 = -1; spot2 = -1; spot1 = searchvidreadtemp.IndexOf("<td>"); spot2 = searchvidreadtemp.Substring(spot1 + 4, searchvidreadtemp.Length - (spot1 + 4)).IndexOf("</td>"); if (spot1 != -1 && spot2 != -1) { newprice = Convert.ToInt32(searchvidreadtemp.Substring(spot1 + 4, spot2)); if (newprice != natprice) { natprice = newprice; Notification frmOut = new Notification(); frmOut.Set_Text("The Grand Exchange prices have been updated."); frmOut.Show(); } } } } searchvidread.Close(); } } } catch { } }
private void tmr_twitter_Tick(object sender, EventArgs e) { try { var fromTwitter = Twitter.Parse(twitteruser); if (fromTwitter[(fromTwitter.Count - 1)].Message != latesttweet) { twitterfeeds.DropDownItems.Add(fromTwitter[(fromTwitter.Count - 1)].Message); latesttweet = fromTwitter[(fromTwitter.Count - 1)].Message; Notification frmOut = new Notification(); frmOut.Set_Text(fromTwitter[(fromTwitter.Count - 1)].Message); frmOut.Show(); } } catch { } }
private void tmr_email_Tick(object sender, EventArgs e) { try { ImapClient ic = new ImapClient("imap.gmail.com", emailuser, emailpass, ImapClient.AuthMethods.Login, 993, true); ic.SelectMailbox("INBOX"); MailMessage[] mm = ic.GetMessages(0, ic.GetMessageCount()); if (mm[ic.GetMessageCount() - 1].Subject != latestemail) { latestemail = mm[ic.GetMessageCount() - 1].Subject; emailstrip.DropDownItems.Add(latestemail); Notification frmOut = new Notification(); frmOut.Set_Text(mm[ic.GetMessageCount() - 1].Subject); frmOut.Show(); } ic.Dispose(); } catch { } }