@inject IDataService DataService Navigator Id Navigator Name Navigator Genre Illustration Credit Tooltip (Japanese) Tooltip (English) @{ # pragma warning disable CS8602 } @context.Id @context.NavigatorName @context.Genre @context.IllustrationCredit @context.ToolTipJp @context.ToolTipEn @{ # pragma warning restore CS8602 } Selected Navigator: @selectedNavigator?.NavigatorName Cancel Ok @code{ [CascadingParameter] public required MudDialogInstance MudDialog { get; set; } [Parameter] public required PlayOptionData Data { get; set; } private Navigator? selectedNavigator; private IReadOnlyList navigators = new List(); private string searchString = string.Empty; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); selectedNavigator = DataService.GetNavigatorById((uint)Data.OptionPart2.NavigatorId); navigators = DataService.GetNavigatorsSortedById(); } private bool Filter(Navigator? navigator) { if (navigator is null) { return false; } var aggregate = $"{navigator.NavigatorName}{navigator.IllustrationCredit}{navigator.ToolTipEn}{navigator.ToolTipJp}"; return string.IsNullOrEmpty(searchString) || aggregate.Contains(searchString, StringComparison.OrdinalIgnoreCase); } private void Submit() { if (selectedNavigator is not null) { Data.OptionPart2.NavigatorId = (int)selectedNavigator.Id; } MudDialog.Close(DialogResult.Ok(true)); } private void Cancel() => MudDialog.Cancel(); }