ExcelHelper/Services/ExcelHelperHostedService.cs

27 lines
659 B
C#

using System.Threading;
using System.Threading.Tasks;
using ExcelHelper.Views.Pages;
using Microsoft.Extensions.Hosting;
namespace ExcelHelper.Services;
public class ExcelHelperHostedService : IHostedService
{
public Task StartAsync(CancellationToken cancellationToken)
{
var mainWindow = App.AppHost.Get<MainWindow>();
if (mainWindow != null)
{
mainWindow.Show();
App.AppHost.Get<NavigationService>().NavigateTo<ImportExcelPage>();
}
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}