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
|
void client_GetErreurLogCompleted(object sender, Appli.ServiceWCFIdentification.GetErreurCompletedEventArgs e)
{
string[] infosErreur;
infosErreur = new string[3];
infosErreur = e.Result;
string libelleErreur = infosErreur[0];
string NiveauErreur = infosErreur[1];
string Couleur = infosErreur[2];
//Recherche de l'erreur dans la RichTextBox
RichTextBox.SelectionStart = 0;
//bool result = RichTextBox.Find(libelleErreur);
bool result;
int nb = Regex.Matches(str, libelleErreur).Count;
for (int i = 0; i < nb; i++)
{
result = RichTextBox.Find(libelleErreur);
if (result)
{
RichTextBox.ReturnFocus();
byte a = (byte)(Convert.ToUInt32(Couleur.Substring(0, 2), 16));
byte r = (byte)(Convert.ToUInt32(Couleur.Substring(2, 2), 16));
byte g = (byte)(Convert.ToUInt32(Couleur.Substring(4, 2), 16));
byte b = (byte)(Convert.ToUInt32(Couleur.Substring(6, 2), 16));
var color = Color.FromArgb(a, r, g, b);
var brush = new SolidColorBrush(color);
ExecuteFormatting(Formatting.Background, brush);
if (i == 0)
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Background = brush;
cbi.Content = libelleErreur;
ComboBoxErreur.Items.Add(cbi);
}
NbErreurLogSelectionne++;
}
}
textBlockErreur.Text = "Ce Log contient " + NbErreurLogSelectionne + " erreur(s).";
} |
Partager