You can read the event log using this code:
EventLogReader reader = new EventLogReader("Microsoft-Windows-AppHost/Admin"); var evt = reader.ReadEvent(); while (evt!= null) {
If you want to attach a handler, your code will be close, but you can just pass the string to the observer instead of using the request object:
var watcher = new EventLogWatcher("Microsoft-Windows-AppHost/Admin"); watcher.EventRecordWritten += (object s, EventRecordWrittenEventArgs e1) => { Console.WriteLine(e1.EventRecord.FormatDescription()); }; watcher.Enabled = true;
source share