Skip to content

Introduce IFilePickerService and move SettingsModal and filter modals to EventLogExpert.Components#515

Draft
jschick04 wants to merge 1 commit intojschick/debug-log-filtersfrom
jschick/move-modals-to-components
Draft

Introduce IFilePickerService and move SettingsModal and filter modals to EventLogExpert.Components#515
jschick04 wants to merge 1 commit intojschick/debug-log-filtersfrom
jschick/move-modals-to-components

Conversation

@jschick04
Copy link
Copy Markdown
Collaborator

Stacked on #513 — base is jschick/debug-log-filters because three of the moved modals' export paths require IFileSaveService from #513.

Summary

Continues the EventLogExpert.Components library lift. Five remaining MAUI-coupled modals (SettingsModal + four filter modals) move into the non-MAUI Razor library after introducing IFilePickerService to abstract their FilePicker.Default calls.

Changes

  • IFilePickerService (EventLogExpert.UI.Interfaces) — new abstraction mirroring IFileSaveService. Two methods: PickAsync(title, extensions): Task<string?> and PickMultipleAsync(title, extensions): Task<IReadOnlyList<string>>. Static FilePickerServiceFileTypes with Json and Database constants.
  • MauiFilePickerService (MAUI head) — implementation using MAUI Essentials FilePicker.Default. Wraps both methods in MainThread.InvokeOnMainThreadAsync (mirrors MauiFileSaveService); defensively filters null/empty FullPath and null collection results.
  • DI registration in MauiProgram.cs (singleton, beside IFileSaveService).
  • Modal refactors — four import handlers replaced with the abstraction; picker calls moved inside their existing try/catch blocks for parity with SettingsModal.
  • Modal moves — 12 files (SettingsModal + FilterCacheModal + FilterGroup + FilterGroupModal + FilterGroupSection, plus their .razor.cs and .razor.css companions) move from src/EventLogExpert/Components/Modals/ to src/EventLogExpert.Components/Modals/. Namespaces and razor markup unchanged.

Why MAUI Essentials FilePicker (not native WinUI FileOpenPicker)?

FileOpenPicker has no PickerTitle property (only CommitButtonText), and existing modal UX relies on titled prompts. Save-side stayed native because OneDrive needed DeferUpdates/CompleteUpdates; pick-side has no such requirement.

Validation

  • dotnet build src/EventLogExpert.slnx — 0 warnings, 0 errors
  • dotnet test src/EventLogExpert.slnx — 1879/1879 pass (19 + 144 + 628 + 1088, unchanged from Add filter, virtualization, and export UI to DebugLogModal and unify file save #513)
  • 4-reviewer panel (Claude xhigh, GPT-5.5, GPT-5.3-codex, rubber-duck) clean after duck's three robustness fixes were applied (MainThread wrapping, picker call inside try, defensive null on PickMultipleAsync).

Stack note

After #513 merges (squash), this PR will need a manual rebase onto main and force-push.

@jschick04 jschick04 requested a review from a team as a code owner May 6, 2026 22:05
@jschick04 jschick04 marked this pull request as draft May 6, 2026 22:06
@jschick04 jschick04 requested a review from Copilot May 6, 2026 22:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces an IFilePickerService abstraction to remove direct MAUI FilePicker.Default usage from modal components, supporting the ongoing lift of modals into the non-MAUI components library.

Changes:

  • Added IFilePickerService + shared file-type constants for JSON/database picks.
  • Implemented MauiFilePickerService (MainThread-wrapped) and registered it in DI.
  • Updated modal import flows to use the new abstraction.

Reviewed changes

Copilot reviewed 7 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/EventLogExpert/Services/MauiFilePickerService.cs Adds MAUI implementation of the new file picker abstraction.
src/EventLogExpert/MauiProgram.cs Registers IFilePickerService in DI for the MAUI head.
src/EventLogExpert/Components/Modals/SettingsModal.razor.cs Switches database import to IFilePickerService.
src/EventLogExpert/Components/Modals/Filters/FilterGroupModal.razor.cs Switches JSON import to IFilePickerService.
src/EventLogExpert/Components/Modals/Filters/FilterGroup.razor.cs Switches JSON import to IFilePickerService.
src/EventLogExpert/Components/Modals/Filters/FilterCacheModal.razor.cs Switches JSON import to IFilePickerService.
src/EventLogExpert.UI/Interfaces/IFilePickerService.cs Adds the new picker abstraction and file-type constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert/Services/MauiFilePickerService.cs Outdated
Comment thread src/EventLogExpert/Services/MauiFilePickerService.cs
Comment thread src/EventLogExpert.UI/Interfaces/IFilePickerService.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 15 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/EventLogExpert.Components/Modals/SettingsModal.razor.cs:201

  • The picker call uses PickMultipleAsync, but the picker title says "Please select a database file" (singular). Consider updating the title text to reflect multi-select (e.g., "database file(s)" or "one or more database files") to avoid confusing users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants