Add Explorer Workbench with hierarchical, off-UI Storage analysis.
Storage queries run in the background with cancellation and covering indexes so switching views no longer freezes the UI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
56
src/Explorer.App/App.xaml.cs
Normal file
56
src/Explorer.App/App.xaml.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Explorer.Presentation.ViewModels;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
|
||||
namespace Explorer.App;
|
||||
|
||||
public partial class App : System.Windows.Application
|
||||
{
|
||||
private IHost? _host;
|
||||
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
DispatcherUnhandledException += (_, args) =>
|
||||
{
|
||||
Log.Error(args.Exception, "Unhandled UI exception");
|
||||
args.Handled = true;
|
||||
};
|
||||
|
||||
var env = new Windows.WindowsAppEnvironment();
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
.WriteTo.File(
|
||||
Path.Combine(env.LogDirectory, "explorer-.log"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 14)
|
||||
.CreateLogger();
|
||||
|
||||
_host = Host.CreateDefaultBuilder()
|
||||
.UseSerilog()
|
||||
.ConfigureServices((_, services) => services.AddExplorer())
|
||||
.Build();
|
||||
|
||||
var vm = _host.Services.GetRequiredService<MainViewModel>();
|
||||
await vm.InitializeAsync().ConfigureAwait(true);
|
||||
await _host.StartAsync().ConfigureAwait(true);
|
||||
var window = _host.Services.GetRequiredService<MainWindow>();
|
||||
window.DataContext = vm;
|
||||
window.Show();
|
||||
}
|
||||
|
||||
protected override async void OnExit(ExitEventArgs e)
|
||||
{
|
||||
if (_host is not null)
|
||||
{
|
||||
await _host.StopAsync(TimeSpan.FromSeconds(3)).ConfigureAwait(true);
|
||||
_host.Dispose();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user