ExcelHelper/Services/ExcelHelperHostedService.cs

27 lines
659 B
C#
Raw Normal View History

2024-10-14 08:41:15 +08:00
using System.Threading;
using System.Threading.Tasks;
using ExcelHelper.Views.Pages;
using Microsoft.Extensions.Hosting;
2024-10-29 16:57:50 +08:00
namespace ExcelHelper.Services;
public class ExcelHelperHostedService : IHostedService
2024-10-14 08:41:15 +08:00
{
2024-10-29 16:57:50 +08:00
public Task StartAsync(CancellationToken cancellationToken)
2024-10-14 08:41:15 +08:00
{
2024-10-29 16:57:50 +08:00
var mainWindow = App.AppHost.Get<MainWindow>();
if (mainWindow != null)
2024-10-14 08:41:15 +08:00
{
2024-10-29 16:57:50 +08:00
mainWindow.Show();
App.AppHost.Get<NavigationService>().NavigateTo<ImportExcelPage>();
2024-10-14 08:41:15 +08:00
}
2024-10-29 16:57:50 +08:00
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
2024-10-14 08:41:15 +08:00
}
}