-
-
Notifications
You must be signed in to change notification settings - Fork 365
Fix hide window startup & Close InvalidOperationException #3390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThis pull request updates the UI behavior and control flow in two areas. In the main window code, the visibility and opacity of the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Definitions (1)Flow.Launcher/ViewModel/MainViewModel.cs (4)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 addresses the window flickering issue during startup by refining how window visibility and UI element properties are handled. Key changes include:
- Removing unnecessary asynchronous UI updates and recursion in the ChangeQueryTextAsync method.
- Refactoring the Show and Hide methods to directly work with Application.Current.MainWindow for window cloak handling.
- Adjusting the opacity and visibility updates for clock and search icon in MainWindow to better support the new startup behavior.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
Flow.Launcher/ViewModel/MainViewModel.cs | Simplified asynchronous UI updates and window show/hide behavior. |
Flow.Launcher/MainWindow.xaml.cs | Refactored UI element updates to align with the window startup fix. |
Comments suppressed due to low confidence (2)
Flow.Launcher/ViewModel/MainViewModel.cs:641
- The recursive pattern used here to invoke ChangeQueryText may be risky if the dispatcher thread check fails repeatedly. Please verify that under all conditions the UI thread is eventually accessed to prevent potential infinite recursion.
if (!Application.Current.Dispatcher.CheckAccess())
Flow.Launcher/MainWindow.xaml.cs:809
- [nitpick] The removal of the UpdatePosition call from the WindowAnimation method may affect the window's positioning during the animation phase. Please confirm that the positioning is handled appropriately elsewhere.
UpdatePosition();
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this 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 aims to fix window flickering during app startup by refactoring window show/hide methods and improving dispatcher usage to avoid blocking the UI thread. Key changes include:
- In MainViewModel.cs, updating ChangeQueryTextAsync to check for UI thread access and refactoring the Show and Hide methods to remove redundant dispatcher invocations.
- In MainWindow.xaml.cs, modifying the OnLoaded and OnDeactivated handlers to adjust UI element properties and backdrop settings, and updating WindowAnimation to better manage animation timing.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
Flow.Launcher/ViewModel/MainViewModel.cs | Refactored dispatcher usage in ChangeQueryTextAsync and simplified the Show/Hide methods. |
Flow.Launcher/MainWindow.xaml.cs | Updated UI element handling during window load/deactivation and adjusted window animation. |
Comments suppressed due to low confidence (3)
Flow.Launcher/ViewModel/MainViewModel.cs:641
- Ensure that the added dispatcher access check in ChangeQueryTextAsync maintains the correct execution context for UI updates. Confirm that the recursive invocation doesn't lead to unintended side effects.
if (!Application.Current.Dispatcher.CheckAccess())
Flow.Launcher/ViewModel/MainViewModel.cs:1453
- The removal of detailed UI element updates (like opacity and visibility adjustments) in the Show method may lead to visual inconsistencies; verify that calling only DWMSetCloakForWindow achieves the intended result.
Win32Helper.DWMSetCloakForWindow(Application.Current.MainWindow, false);
Flow.Launcher/MainWindow.xaml.cs:815
- [nitpick] The removal of the UpdatePosition() call prior to starting the window animation might cause position discrepancies; please confirm if updating the position is no longer required for the animation to run smoothly.
var clocksb = new Storyboard();
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This reverts commit b519313.
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. Forbidden patterns 🙅 (1)In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves. These forbidden patterns matched content: s.b. workaround(s)
If the flagged items are 🤯 false positivesIf items relate to a ...
|
There was a problem hiding this 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 window flickering and startup invisibility by updating the visibility, opacity, and cloak handling of the application window. Key changes include:
- Refactoring the Show, Hide, and ChangeQueryTextAsync methods to simplify dispatcher usage and avoid UI thread blocking.
- Adjusting first-launch settings and updating UI element properties in MainWindow.xaml.cs to improve startup behavior.
- Removing redundant code and improving consistency in UI updates during deactivation and animation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
Flow.Launcher/ViewModel/MainViewModel.cs | Refactored Show/Hide methods and improved dispatcher access check to manage window cloak and avoid flickering. |
Flow.Launcher/MainWindow.xaml.cs | Updated first launch behaviors, renamed certain UI update sequences, and replaced Close() with Shutdown() for graceful termination. |
Comments suppressed due to low confidence (2)
Flow.Launcher/MainWindow.xaml.cs:114
- [nitpick] Local variable 'WelcomeWindow' should use camelCase (e.g., 'welcomeWindow') to align with standard C# naming conventions.
var WelcomeWindow = new WelcomeWindow();
Flow.Launcher/ViewModel/MainViewModel.cs:1454
- Consider adding a type check or assertion to ensure that Application.Current.MainWindow is of the expected type before calling DWMSetCloakForWindow to prevent potential runtime errors.
Win32Helper.DWMSetCloakForWindow(Application.Current.MainWindow, false);
🥷 Code experts: onesounds Jack251970, onesounds have most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
Fix window flicking during app startup
Follow on with #3388
Test
Open FL and app window is invisible always