Imports System.IO
Public Class frmAide

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Width = Aff.Aide_Largeur : Me.Height = Aff.Aide_Hauteur 'Dimension de l'écran d'affichage de l'Aide
        setupBrowser2()
    End Sub
    Private Sub setupBrowser2()
        ' This prevents the Web browser from opening files that are dropped onto it.
        WebBrowser1.AllowWebBrowserDrop = False

        Dim toto As String = "NoAide.mht"
        Select Case Aff.FichierAide
            Case 1
                toto = "Sable_Gravillon_Production.mht"
            Case 2
                toto = "Exigence_Ouvrabilite.mht"
            Case 3
                toto = "Exigence_Humidite.mht"
            Case 4
                toto = "Sable_Humidite.mht"
            Case 5
                toto = "Sable_Densite.mht"
            Case 6
                toto = "Gravillon_Humidite.mht"
            Case 7
                toto = "Gravillon_Densite.mht"
            Case 8
                toto = "Exigence_CoefMajoration.mht"
            Case 9
                toto = "Exigence_Fck28.mht"
            Case 10
                toto = "Config_BetonFormulation.mht"'
            Case 11
                toto = "Exigence_ModeFabrication.mht"
            Case 12
                toto = "Exigence_Vibration.mht"
            Case 13
                toto = "Ciment_ClasseVrai.mht"
            Case 14
                toto = "Ciment_Densite.mht"
            Case 15
                toto = "Config_FormulationCompacite.mht"
            Case 16
                toto = "Sable_Tamis.mht"
            Case 17
                toto = "Exigence_Transport.mht"
            Case 18
                toto = "Exigence_Temperature.mht"
            Case 19
                toto = "Outils_Classe_Exposition.mht"
            Case 20
                toto = "Ciment_Qualite.mht"
            Case 21
                toto = "Ciment_Addition.mht"
            Case 22
                toto = "Exigence_EN206.mht"
            Case 23
                toto = "Exigence_MajorationPateaCiment.mht"
            Case 24
                toto = "Exigence_TabKdg.mht"
            Case 25
                toto = "Gravillon_CoefGranulaire.mht"
            Case 26
                toto = "Sable_Fines.mht"
            Case 27
                toto = "Config_FormulationBaronOllivier.mht"
            Case 28
                toto = "Adjuvant_Plastifiant_Minoration.mht"
            Case 29
                toto = "Adjuvant_Plastifiant_Dosage.mht"
            Case 30
                toto = "Sable_CoefAbsorption.mht"
            Case 31
                toto = "Gravillon_CoefAbsorption.mht"
            Case 32
                toto = "Config_CimentAddition_Densite.mht"
            Case 33
                toto = "Exigence_CorrectionYA.mht"
            Case 34
                toto = "Adjuvant_Plastifiant_MajorationFines.mht"
            Case 35
                toto = "Ciment_Addition_ComplementFines.mht"
            Case 36
                toto = "Sable_Correcteur.mht"
            Case 37
                toto = "Exigence_TabE.mht"
            Case 38
                toto = "Ciment_Addition_MasseImposee.mht"
        End Select
        Dim fi As New FileInfo(Directory.GetCurrentDirectory.ToString() & "\Aide\" & toto)
        DisplayHTMLDoc(fi.FullName)
    End Sub

    Private Sub DisplayHTMLDoc(ByVal path As String)
        If Not path = String.Empty Then
            Try
                If (File.Exists(path)) Then
                    WebBrowser1.Url = New Uri(path)
                Else
                    MessageBox.Show("Désolé, fichier d'aide introuvable à l'adresse suivante: " & path & ".", "Fichier d'aide", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    Me.Close()
                End If
            Catch ex As ApplicationException
                MessageBox.Show("L'erreur suivante s'est produite lors de l'accès au fichier d'aide: " & ex.Message & Environment.NewLine & ex.StackTrace, "Fichier d'aide", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End Try
        End If
    End Sub
End Class