open another sln
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
[CascadingParameter]
|
||||
public IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public bool AutoOpenLastSolution { get; set; }
|
||||
|
||||
private string? _solutionFilePath;
|
||||
|
||||
protected override void OnInitialized()
|
||||
@@ -28,7 +31,7 @@
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (AppState.IdeSettings.AutoOpenLastSolution && !string.IsNullOrWhiteSpace(_solutionFilePath))
|
||||
if (AutoOpenLastSolution && !string.IsNullOrWhiteSpace(_solutionFilePath))
|
||||
{
|
||||
MudDialog.Close(_solutionFilePath);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<MudButton OnClick="@DrawerToggle" Style="min-width: 20px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit"/>
|
||||
</MudButton>
|
||||
<MudButton Style="min-width: 20px;">
|
||||
<MudButton OnClick="@LoadSolutionFromInteractivePicker" Style="min-width: 20px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.FolderOpen" Color="Color.Inherit"/>
|
||||
</MudButton>
|
||||
<MudButtonGroup OverrideStyles="false">
|
||||
@@ -77,15 +77,7 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var dialogRef = await DialogService.ShowAsync<SolutionPickerDialog>("Open Solution", new DialogOptions { FullWidth = true, MaxWidth = MaxWidth.Medium, BackdropClick = false });
|
||||
var result = await dialogRef.Result;
|
||||
if (result is null) throw new InvalidOperationException("Dialog result is null");
|
||||
if (result.Canceled) throw new OperationCanceledException("Dialog was canceled");
|
||||
var solutionFilePath = (string)result.Data!;
|
||||
_solutionFilePath = solutionFilePath;
|
||||
|
||||
var solutionModel = await VsPersistenceMapper.GetSolutionModel(_solutionFilePath);
|
||||
_solutionModel = solutionModel;
|
||||
await LoadSolutionFromInteractivePicker(AppState.IdeSettings.AutoOpenLastSolution);
|
||||
if (AppState.IdeSettings.AutoOpenTerminalOnLaunch)
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
@@ -98,6 +90,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadSolutionFromInteractivePicker() => await LoadSolutionFromInteractivePicker(false);
|
||||
private async Task LoadSolutionFromInteractivePicker(bool autoOpenLastSolution)
|
||||
{
|
||||
var dialogRef = await DialogService.ShowAsync<SolutionPickerDialog>("Open Solution",new DialogParameters { [nameof(SolutionPickerDialog.AutoOpenLastSolution)] = autoOpenLastSolution }, new DialogOptions { FullWidth = true, MaxWidth = MaxWidth.Medium, BackdropClick = false });
|
||||
var result = await dialogRef.Result;
|
||||
if (result is null) throw new InvalidOperationException("Dialog result is null");
|
||||
if (result.Canceled) throw new OperationCanceledException("Dialog was canceled");
|
||||
var solutionFilePath = (string)result.Data!;
|
||||
_solutionFilePath = solutionFilePath;
|
||||
|
||||
var solutionModel = await VsPersistenceMapper.GetSolutionModel(_solutionFilePath);
|
||||
_solutionModel = solutionModel;
|
||||
}
|
||||
|
||||
private CancellationTokenSource? _cancellationTokenSource = null!;
|
||||
private async Task BuildSolution() => await MsBuildSolution(BuildType.Build);
|
||||
private async Task RebuildSolution() => await MsBuildSolution(BuildType.Rebuild);
|
||||
|
||||
Reference in New Issue
Block a user