This commit is contained in:
@@ -561,9 +561,7 @@ namespace Elwig.Helpers {
|
|||||||
Log = "Application",
|
Log = "Application",
|
||||||
Source = ".NET Runtime",
|
Source = ".NET Runtime",
|
||||||
};
|
};
|
||||||
return log.Entries.Cast<EventLogEntry>()
|
return [.. log.Entries.OfType<EventLogEntry>().Where(e => e.InstanceId == 1026).Where(e => e.Message.StartsWith("Application: Elwig.exe"))];
|
||||||
.Where(e => e.Message.StartsWith("Application: Elwig.exe"))
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetEntityIdetifierForPk(params object?[] primaryKey) {
|
public static int GetEntityIdetifierForPk(params object?[] primaryKey) {
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
public partial class LogWindow : Window {
|
public partial class LogWindow : Window {
|
||||||
@@ -11,28 +13,35 @@ namespace Elwig.Windows {
|
|||||||
WindowState = WindowState.Maximized;
|
WindowState = WindowState.Maximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
private async void Window_Loaded(object sender, RoutedEventArgs evt) {
|
||||||
var log = Utils.GetLogEntries();
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
EventList.ItemsSource = log
|
await Task.Run(async () => {
|
||||||
.Select(e => new {
|
var log = Utils.GetLogEntries();
|
||||||
Event = e,
|
var list = log
|
||||||
Lines = e.Message.Split('\n').ToArray(),
|
.Select(e => new {
|
||||||
})
|
Event = e,
|
||||||
.Select(e => new {
|
Lines = e.Message.Split('\n').ToArray(),
|
||||||
e.Event,
|
})
|
||||||
Exception = e.Lines.FirstOrDefault(l => l.StartsWith("Exception Info: "))?[16..].Trim().Split(':', 2),
|
.Select(e => new {
|
||||||
Location = e.Lines.FirstOrDefault(l => l.StartsWith(" at Elwig."))?[5..].Trim(),
|
e.Event,
|
||||||
})
|
Exception = e.Lines.FirstOrDefault(l => l.StartsWith("Exception Info: "))?[16..].Trim().Split(':', 2),
|
||||||
.Select(e => new {
|
Location = e.Lines.FirstOrDefault(l => l.StartsWith(" at Elwig."))?[5..].Trim(),
|
||||||
e.Event,
|
})
|
||||||
e.Exception,
|
.Select(e => new {
|
||||||
ExceptionName = e.Exception?[0].Trim(),
|
e.Event,
|
||||||
ExceptionMessage = e.Exception?.Length >= 2 ? e.Exception?[1].Trim() : null,
|
e.Exception,
|
||||||
e.Location,
|
ExceptionName = e.Exception?[0].Trim(),
|
||||||
})
|
ExceptionMessage = e.Exception?.Length >= 2 ? e.Exception?[1].Trim() : null,
|
||||||
.OrderByDescending(e => e.Event.TimeGenerated)
|
e.Location,
|
||||||
.ToList();
|
})
|
||||||
EventList.SelectedIndex = 0;
|
.OrderByDescending(e => e.Event.TimeGenerated)
|
||||||
|
.ToList();
|
||||||
|
await App.MainDispatcher.BeginInvoke(() => {
|
||||||
|
EventList.ItemsSource = list;
|
||||||
|
EventList.SelectedIndex = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EventList_SelectionChanged(object sender, RoutedEventArgs evt) {
|
private void EventList_SelectionChanged(object sender, RoutedEventArgs evt) {
|
||||||
|
Reference in New Issue
Block a user