Refresh file on change from background

This commit is contained in:
Matt Parker
2025-07-31 18:48:45 +10:00
parent 1dca2d19fd
commit 37a5bfc42b
4 changed files with 58 additions and 6 deletions

View File

@@ -1,7 +1,8 @@
using Microsoft.Build.Locator;
using Microsoft.Build.Locator;
using Microsoft.Extensions.DependencyInjection;
using MudBlazor.Services;
using Photino.Blazor;
using SharpIDE.Photino.Services;
namespace SharpIDE.Photino;
@@ -12,8 +13,9 @@ public class Program
{
var appBuilder = PhotinoBlazorAppBuilder.CreateDefault(args);
appBuilder.Services.AddLogging();
appBuilder.Services.AddLogging();//
appBuilder.Services.AddMudServices();
appBuilder.Services.AddSingleton<RefreshOpenFileService>();
appBuilder.RootComponents.Add<App>("app");
@@ -27,6 +29,12 @@ public class Program
//.SetIconFile("favicon.ico")
.SetTitle("SharpIDE.Photino");
app.MainWindow.WindowFocusInHandler += (sender, _) =>
{
var refreshOpenFileService = app.Services.GetRequiredService<RefreshOpenFileService>();
refreshOpenFileService.InvokeRefreshOpenFile();
};
AppDomain.CurrentDomain.UnhandledException += (sender, error) =>
{
app.MainWindow.ShowMessage("Fatal exception", error.ExceptionObject.ToString());
@@ -38,4 +46,3 @@ public class Program
app.Run();
}
}