Skip to content

Publish frontend message when Auto Run changes, added integration test.#2754

Merged
DocMoebiuz merged 3 commits intomainfrom
2753/fix-auto-run
Feb 24, 2026
Merged

Publish frontend message when Auto Run changes, added integration test.#2754
DocMoebiuz merged 3 commits intomainfrom
2753/fix-auto-run

Conversation

@DocMoebiuz
Copy link
Copy Markdown
Collaborator

@DocMoebiuz DocMoebiuz commented Feb 24, 2026

Pull request overview

This PR fixes a bug where the AutoRun icon in the frontend toolbar didn't visually update when clicked. The issue was caused by the removal of a PropertyChanged event handler in PR #2711, which previously triggered settings updates to the frontend. The fix implements a cleaner approach by calling Properties.Settings.Default.Save() when the AutoRun value changes, which automatically triggers the SettingsSaving event handler that publishes settings to the frontend.

Changes:

  • Removed redundant setAutoRunValue() call from MainForm_Shown() that was setting AutoRun to its own value
  • Added Properties.Settings.Default.Save() call in setAutoRunValue() to trigger frontend settings update
  • Added integration test to verify AutoRun toggle publishes Settings message to frontend
  • Enhanced test infrastructure with SetSynchronizationContextProvider() to support synchronous message handling in tests

fixes #2753

Copilot AI review requested due to automatic review settings February 24, 2026 14:51
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

This PR fixes a bug where the AutoRun icon in the frontend toolbar didn't visually update when clicked. The issue was caused by the removal of a PropertyChanged event handler in PR #2711, which previously triggered settings updates to the frontend. The fix implements a cleaner approach by calling Properties.Settings.Default.Save() when the AutoRun value changes, which automatically triggers the SettingsSaving event handler that publishes settings to the frontend.

Changes:

  • Removed redundant setAutoRunValue() call from MainForm_Shown() that was setting AutoRun to its own value
  • Added Properties.Settings.Default.Save() call in setAutoRunValue() to trigger frontend settings update
  • Added integration test to verify AutoRun toggle publishes Settings message to frontend
  • Enhanced test infrastructure with SetSynchronizationContextProvider() to support synchronous message handling in tests

Reviewed changes

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

File Description
UI/MainForm.cs Removed redundant AutoRun initialization and added Save() call to trigger frontend update
MobiFlightUnitTests/UI/MainFormTests.cs Added integration test for AutoRun toggle and enhanced TestMessagePublisher with message simulation capability
MobiFlight/BrowserMessages/MessageExchange.cs Added SetSynchronizationContextProvider() method for test support with documentation comment

@github-actions
Copy link
Copy Markdown

Build for this pull request:
MobiFlightConnector.zip

@github-actions
Copy link
Copy Markdown

Build for this pull request:
MobiFlightConnector.zip

@DocMoebiuz DocMoebiuz merged commit 4eb0703 into main Feb 24, 2026
2 checks passed
@DocMoebiuz DocMoebiuz added bug Something isn't working in a officially released version bug_beta Something isn't working in a beta version, not in a stable released version and removed bug Something isn't working in a officially released version labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug_beta Something isn't working in a beta version, not in a stable released version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoRun icon doesn't visually update on clicking

2 participants