SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
EventViewer.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Controls;
6 
7 namespace SeciControls
8 {
9  public class EventViewer : TextBox
10  {
11  public delegate void SeciErrorHandler(String message);
12  public static event SeciErrorHandler OnError;
13 
14  public void AddMessage(String message, Boolean isError)
15  {
16  if (isError)
17  {
18  Text += "[" + DateTime.Now.ToShortDateString()
19  + " " + DateTime.Now.ToShortTimeString() + "] " + message + Environment.NewLine;
20  //Raise error
21  if (OnError != null)
22  {
23  OnError(message);
24  }
25 
26  }
27  else
28  {
29  Text += "[" + DateTime.Now.ToShortDateString()
30  + " " + DateTime.Now.ToShortTimeString() + "] " + message + Environment.NewLine;
31  }
32  }
33 
34  public void ClearMessages()
35  {
36  Text = "";
37  }
38 
39  }
40 }
static SeciErrorHandler OnError
Definition: EventViewer.cs:12
delegate void SeciErrorHandler(String message)
void AddMessage(String message, Boolean isError)
Definition: EventViewer.cs:14