Skip to content

Commit

Permalink
Small api change on Dialog service
Browse files Browse the repository at this point in the history
  • Loading branch information
TheXDS committed Mar 17, 2024
1 parent b050504 commit fa7c0cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Core/Ganymede/Ganymede.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TheXDS.MCART.Mvvm" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.UI" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.Mvvm" Version="0.17.2-alpha.16" />
<PackageReference Include="TheXDS.MCART.UI" Version="0.17.2-alpha.16" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions src/Core/Ganymede/Services/IDialogService_Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public partial interface IDialogService
/// options may contain several items.
/// </remarks>
/// <see cref="GetOption(string?, string, string[])"/>
Task<int> SelectOption(string? title, string prompt, params string[] options) => GetOption(title, prompt, options);
async Task<InputResult<int>> SelectOption(string? title, string prompt, params string[] options)
{
var result = await GetOption(title, prompt, options);
return new(result >= 0, result);
}

/// <summary>
/// Gets a value from the user.
Expand Down Expand Up @@ -265,7 +269,7 @@ Task<InputResult<string>> GetFileOpenPath(string? title, string message)
/// </returns>
Task<InputResult<string>> GetFileOpenPath(string? title, string message, string? defaultPath)
{
return GetFileOpenPath(title, message, new[] { FileFilterItem.AllFiles }, defaultPath);
return GetFileOpenPath(title, message, [FileFilterItem.AllFiles], defaultPath);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Ganymede/Services/NavigatingDialogService_Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public Task<int> GetOption(string? title, string prompt, params string[] options
}

/// <inheritdoc/>
public async Task<int> SelectOption(string? title, string prompt, params string[] options)
public async Task<InputResult<int>> SelectOption(string? title, string prompt, params string[] options)
{
TaskCompletionSource<bool> dialogAwaiter = new();
var vm = CreateInputDialogVm<SelectionDialogViewModel>(title, prompt, dialogAwaiter);
vm.Options = options;
Navigate(vm);
var result = await dialogAwaiter.Task;
return result ? options.FindIndexOf(vm.Value) : -1;
return new(result, result ? options.FindIndexOf(vm.Value) : -1);
}

/// <inheritdoc/>
Expand Down
8 changes: 4 additions & 4 deletions src/Platform/Ganymede.Wpf/Ganymede.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TheXDS.MCART.Mvvm" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.UI" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.Wpf.Common" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.Wpf.Controls" Version="0.17.2-alpha.11" />
<PackageReference Include="TheXDS.MCART.Mvvm" Version="0.17.2-alpha.16" />
<PackageReference Include="TheXDS.MCART.UI" Version="0.17.2-alpha.16" />
<PackageReference Include="TheXDS.MCART.Wpf.Common" Version="0.17.2-alpha.16" />
<PackageReference Include="TheXDS.MCART.Wpf.Controls" Version="0.17.2-alpha.16" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit fa7c0cb

Please sign in to comment.