1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
/// <summary>
/// Appelle le fichier d'aide
/// </summary>
/// <param name="e"></param>
/// <param name="fichierAide">Chemin entier du fichier d'aide (nom de fichier compris ainsi que l'extension)</param>
/// <param name="topic">Nom du topic</param>
public static void CallAide(System.Windows.Input.KeyEventArgs e, string fichierAide, string topic)
{
try
{
if (fichierAide == "")
{
// Valeur en dure à changer
IniReader lecteurIni = new IniReader("C:\\HelpAide.ini");
string helpFileIni = lecteurIni.ReadString("HELP", "HELP_FILE");
//Chemin du fichier d'aide trouvé dans le fichier ini
if (helpFileIni != "")
{
fichierAide = helpFileIni;
if (topic == "")
{
// Information redirection
MessageBox.Show("Aucun topic n'a été trouvé ou spécifié : vous allez être redirigé à la page d'accueil de l'aide.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
//Ouvre le fichier d'aide à la page de démarrage
System.Windows.Forms.Help.ShowHelp(null, fichierAide);
//Passe la fenêtre qui affiche le pb
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
}
else
{
//Ouvre le fichier avec ce topic
System.Windows.Forms.Help.ShowHelp(null, fichierAide);
//Passe la fenêtre qui affiche le pb
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
//Permet de se placer sur l'onglet index
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{RIGHT}");
SendKeys.SendWait("{TAB}");
//Ecrit le mot clé dans la zone de texte
SendKeys.SendWait(topic);
//Appui sur entré pour valider la recherche
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
}
}
else //Chemin du fichier d'aide pas trouvé dans le fichier ini
{
MessageBox.Show("Aucun fichier d'aide n'a été spécifié ou n'a pu être trouvé. L'aide ne peut donc pas s'ouvrir.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
if (topic == "")
{
// Information redirection
MessageBox.Show("Aucun topic n'a été trouvé ou spécifié : vous allez être redirigé à la page d'accueil de l'aide.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
//Ouvre le fichier d'aide à la page de démarrage
System.Windows.Forms.Help.ShowHelp(null, fichierAide);
//Passe la fenêtre qui affiche le pb
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
}
else
{
//Ouvre le fichier avec ce topic
System.Windows.Forms.Help.ShowHelp(null, fichierAide);
//Passe la fenêtre qui affiche le pb
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
//Permet de se placer sur l'onglet index
SendKeys.Send("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{RIGHT}");
SendKeys.SendWait("{TAB}");
//Ecrit le mot clé dans la zone de texte
SendKeys.SendWait(topic);
//Appui sur entré pour valider la recherche
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("{ENTER}");
}
}
}
catch (Exception exp)
{
//MessageBox.Show("Erreur lors de la recherche du fichier : " + exp.ToString(), "ERREUR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} |
Partager