wabbajack/Wabbajack.App.Blazor/MainWindow.xaml.cs

45 lines
1.4 KiB
C#
Raw Normal View History

2022-01-09 13:33:22 +00:00
using System;
2022-01-21 13:41:37 +00:00
using Microsoft.AspNetCore.Components;
2022-01-09 13:33:22 +00:00
using Microsoft.Extensions.Logging;
using Wabbajack.App.Blazor.Models;
2022-01-21 04:57:59 +00:00
using Wabbajack.App.Blazor.State;
using Wabbajack.App.Blazor.Utility;
using Wabbajack.Common;
using Wabbajack.Installer;
using Wabbajack.Paths.IO;
2022-01-09 13:33:22 +00:00
2022-01-20 08:34:38 +00:00
namespace Wabbajack.App.Blazor;
public partial class MainWindow
2022-01-09 13:33:22 +00:00
{
2022-01-21 13:41:37 +00:00
private readonly ILogger<MainWindow> _logger;
private readonly LoggerProvider _loggerProvider;
2022-01-20 08:34:38 +00:00
private readonly SystemParametersConstructor _systemParams;
2022-01-21 13:41:37 +00:00
private readonly IStateContainer _stateContainer;
2022-01-20 08:34:38 +00:00
public MainWindow(ILogger<MainWindow> logger, IServiceProvider serviceProvider, LoggerProvider loggerProvider,
2022-01-21 13:41:37 +00:00
SystemParametersConstructor systemParams, IStateContainer stateContainer)
2022-01-09 13:33:22 +00:00
{
2022-01-21 13:41:37 +00:00
_logger = logger;
2022-01-20 08:34:38 +00:00
_loggerProvider = loggerProvider;
2022-01-21 13:41:37 +00:00
_systemParams = systemParams;
_stateContainer = stateContainer;
2022-01-21 04:57:59 +00:00
2022-01-21 13:41:37 +00:00
_stateContainer.TaskBarStateObservable.Subscribe(state =>
2022-01-21 04:57:59 +00:00
{
Dispatcher.InvokeAsync(() =>
{
TaskBarItem.Description = state.Description;
TaskBarItem.ProgressState = state.State;
TaskBarItem.ProgressValue = state.ProgressValue;
});
2022-01-21 13:41:37 +00:00
});
2022-01-20 08:34:38 +00:00
InitializeComponent();
BlazorWebView.Services = serviceProvider;
2022-01-09 13:33:22 +00:00
}
}
2022-01-20 08:34:38 +00:00
// Required so compiler doesn't complain about not finding the type. [MC3050]
public partial class Main { }