Public Function DownloadSource(ByVal address As String) As String Dim Result As String Using NetC As New System.Net.WebClient() Result = NetC.DownloadString(address) End Using Return Result End Function Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click With NotifyIcon1 .Text = "JMC Surveillance météorologique 4 Professional Edition" If DownloadSource("http://pagesperso-orange.fr/jmcreations/infos1.htm").Contains("OK") Then .Icon = My.Resources.notifyicon .Visible = True .ShowBalloonTip(20, "Message d'information:", GetHTMLPage("http://pagesperso-orange.fr/jmcreations/infos_saviezvous_3.xx_et_4.xx.htm"), ToolTipIcon.Info) End If End With temps_affichage_infobulle.Stop() End Sub
Dim objWebRequest2 As System.Net.WebRequest = System.Net.HttpWebRequest.Create("http://pagesperso-orange.fr/jmcreations/infos_bulles/Alerte.htm") Dim objWebResponse2 As System.Net.WebResponse = objWebRequest2.GetResponse() Dim objStreamReader2 As System.IO.StreamReader = Nothing Try objStreamReader2 = New System.IO.StreamReader(objWebResponse2.GetResponseStream()) Invisible.Text = objStreamReader2.ReadToEnd() Finally If Not objWebResponse2 Is Nothing Then objWebResponse2.Close() End If End Try Dim objWebRequest3 As System.Net.WebRequest = System.Net.HttpWebRequest.Create("http://pagesperso-orange.fr/jmcreations/infos_bulles/Alerte1.htm") Dim objWebResponse3 As System.Net.WebResponse = objWebRequest3.GetResponse() Dim objStreamReader3 As System.IO.StreamReader = Nothing Try objStreamReader3 = New System.IO.StreamReader(objWebResponse3.GetResponseStream()) Invisible2.Text = objStreamReader3.ReadToEnd() Finally If Not objWebResponse3 Is Nothing Then objWebResponse3.Close() End If End Try Dim objWebRequest4 As System.Net.WebRequest = System.Net.HttpWebRequest.Create("http://pagesperso-orange.fr/jmcreations/infos_bulles/Actualites.htm") Dim objWebResponse4 As System.Net.WebResponse = objWebRequest4.GetResponse() Dim objStreamReader4 As System.IO.StreamReader = Nothing Try objStreamReader4 = New System.IO.StreamReader(objWebResponse4.GetResponseStream()) Invisible3.Text = objStreamReader4.ReadToEnd() Finally If Not objWebResponse4 Is Nothing Then objWebResponse4.Close() End If End Try Dim objWebRequest5 As System.Net.WebRequest = System.Net.HttpWebRequest.Create("http://pagesperso-orange.fr/jmcreations/infos_bulles/Actualites1.htm") Dim objWebResponse5 As System.Net.WebResponse = objWebRequest5.GetResponse() Dim objStreamReader5 As System.IO.StreamReader = Nothing Try objStreamReader5 = New System.IO.StreamReader(objWebResponse5.GetResponseStream()) Invisible4.Text = objStreamReader5.ReadToEnd() Finally If Not objWebResponse5 Is Nothing Then objWebResponse5.Close() End If End Try If My.Settings.afficher_infosbulles = True Then If My.Settings.explication_infobulle = True Then NotifyIcon1.Icon = My.Resources.notifyicon NotifyIcon1.Visible = True NotifyIcon1.ShowBalloonTip(20, "Message d'information:", "Voici une nouveauté de la version 4 de JMC Surveillance météorologique." & Chr(13) + Chr(10) & "Grâce à cette info-bulle, vous pourrez être prévenu par nos serveurs d'évènements météorologiques dangereux, d'évènements importants concernant votre logiciel ou bien JM Créations.", ToolTipIcon.Info) NotifyIcon1.Text = "JMC Surveillance météorologique 4 Professional Edition" My.Settings.explication_infobulle = False My.Settings.Save() ElseIf Invisible.Text = Invisible2.Text Then NotifyIcon1.Icon = My.Resources.notifyicon NotifyIcon1.Visible = True NotifyIcon1.ShowBalloonTip(20, "Alerte météorologique:", GetHTMLPage("http://pagesperso-orange.fr/jmcreations/infos_bulles/informations.htm"), ToolTipIcon.Warning) NotifyIcon1.Text = "JMC Surveillance météorologique 4 Professional Edition" ElseIf Invisible3.Text = Invisible4.Text Then NotifyIcon1.Icon = My.Resources.notifyicon NotifyIcon1.Visible = True NotifyIcon1.ShowBalloonTip(20, "Message d'information:", GetHTMLPage("http://pagesperso-orange.fr/jmcreations/infos_bulles/informations_jmc.htm"), ToolTipIcon.Info) NotifyIcon1.Text = "JMC Surveillance météorologique 4 Professional Edition" End If End If temps_affichage_infobulle.Stop() End Sub