Skip to content

fix #81#82

Merged
erikdarlingdata merged 1 commit intoerikdarlingdata:devfrom
ClaudioESSilva:fix/context_menu_actions
Mar 11, 2026
Merged

fix #81#82
erikdarlingdata merged 1 commit intoerikdarlingdata:devfrom
ClaudioESSilva:fix/context_menu_actions

Conversation

@ClaudioESSilva
Copy link
Contributor

What does this PR do?

Fixes #81

Which component(s) does this affect?

  • Desktop App (PlanViewer.App)
  • Core Library (PlanViewer.Core)
  • CLI Tool (PlanViewer.Cli)
  • SSMS Extension (PlanViewer.Ssms)
  • Tests
  • Documentation

How was this tested?

Same steps as #81 and confirmed it works.

The problem

The RaiseEvent(new RoutedEventArgs(Button.ClickEvent)) approach is unreliable in Avalonia — Button.ClickEvent is a bubble-routing event that relies on the visual tree. Calling it programmatically on a button doesn't guarantee the Click handler fires in all scenarios.

The fix extracts the advice logic into showHumanAdvice and showRobotAdvice action delegates, then uses them from both the toolbar button click handlers and the context menu event subscriptions.

Previously, humanBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)) was used as an indirect bridge — but Avalonia's Button.ClickEvent is a bubble-routed event tied to pointer interactions, and calling RaiseEvent programmatically on a button doesn't reliably trigger its Click handler outside of normal UI interaction. Calling the shared action directly avoids that indirection entirely.

Checklist

  • I have read the contributing guide
  • My code builds with zero warnings (dotnet build -c Debug)
  • All tests pass (dotnet test)
  • I have not introduced any hardcoded credentials or server names

@erikdarlingdata erikdarlingdata merged commit 53dd47c into erikdarlingdata:dev Mar 11, 2026
2 checks passed
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