wabbajack/Wabbajack.App.Blazor/Pages/Install/Select.razor.cs

27 lines
863 B
C#
Raw Normal View History

2022-01-20 08:34:38 +00:00
using Microsoft.AspNetCore.Components;
using Microsoft.WindowsAPICodePack.Dialogs;
using Wabbajack.App.Blazor.State;
using Wabbajack.Common;
using Wabbajack.Paths;
namespace Wabbajack.App.Blazor.Pages;
public partial class Select
2022-01-20 08:34:38 +00:00
{
2022-01-21 13:41:37 +00:00
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
[Inject] private IStateContainer StateContainer { get; set; } = default!;
2022-01-20 08:34:38 +00:00
private void SelectFile()
{
using (var dialog = new CommonOpenFileDialog())
{
dialog.Multiselect = false;
dialog.Filters.Add(new CommonFileDialogFilter("Wabbajack File", "*" + Ext.Wabbajack));
if (dialog.ShowDialog() != CommonFileDialogResult.Ok) return;
2022-01-21 13:41:37 +00:00
StateContainer.ModlistPath = dialog.FileName.ToAbsolutePath();
2022-01-20 08:34:38 +00:00
}
2022-01-21 13:41:37 +00:00
NavigationManager.NavigateTo(Configure.Route);
2022-01-20 08:34:38 +00:00
}
}