/// <summary> /// The my on entry written. /// </summary> /// <param name="source"> /// The source. /// </param> /// <param name="e"> /// The e. /// </param> public void MyOnEntryWritten(object source, EntryWrittenEventArgs e) { var eventViewerMessage = new EventViewerMessage { EntryType = e.Entry.EntryType, MachineName = e.Entry.MachineName, Message = e.Entry.Message, Source = e.Entry.Source, TimeWritten = e.Entry.TimeWritten }; var serializedMessage = JsonConvert.SerializeObject(eventViewerMessage); DataContext = EncodingDecoding.EncodingString2Bytes(serializedMessage); ActionTrigger(this, Context); }
/// <summary> /// The my on entry written. /// </summary> /// <param name="source"> /// The source. /// </param> /// <param name="e"> /// The e. /// </param> public void MyOnEntryWritten(object source, EntryWrittenEventArgs e) { if (e.Entry.Source != "DEMOEV") { return; } var eventViewerMessage = new EventViewerMessage { EntryType = e.Entry.EntryType, MachineName = e.Entry.MachineName, Message = e.Entry.Message, Source = e.Entry.Source, TimeWritten = e.Entry.TimeWritten }; var serializedMessage = JsonConvert.SerializeObject(eventViewerMessage); this.DataContext = Encoding.UTF8.GetBytes(serializedMessage); this.SetEventActionTrigger(this, this.Context); }