Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }