LogWindow: Improve loading time
All checks were successful
Test / Run tests (push) Successful in 1m46s
All checks were successful
Test / Run tests (push) Successful in 1m46s
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,9 +13,10 @@ 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 () => {
|
||||||
|
var list = Utils.GetLogEntries()
|
||||||
.Select(e => new {
|
.Select(e => new {
|
||||||
Event = e,
|
Event = e,
|
||||||
Lines = e.Message.Split('\n').ToArray(),
|
Lines = e.Message.Split('\n').ToArray(),
|
||||||
@@ -32,7 +35,12 @@ namespace Elwig.Windows {
|
|||||||
})
|
})
|
||||||
.OrderByDescending(e => e.Event.TimeGenerated)
|
.OrderByDescending(e => e.Event.TimeGenerated)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
await App.MainDispatcher.BeginInvoke(() => {
|
||||||
|
EventList.ItemsSource = list;
|
||||||
EventList.SelectedIndex = 0;
|
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