Skip to content

Conversation

Sparrkle
Copy link
Contributor

@Sparrkle Sparrkle commented Oct 5, 2022

Removed Dispatcher and change how it works storyboard.

What's the PR

  • broken progressbar sometimes.

unknown

Tested

  • Progress bar can work.
  • API function StartLoadingBar & StopLoadingBar can work.

@taooceros
Copy link
Member

Will this make the progressbar always run in the background? people has complaint about the tiny little cpu usage because of that before.

@Sparrkle
Copy link
Contributor Author

Sparrkle commented Oct 6, 2022

I only changed the storyboard binding. so it doesn't matter.

@taooceros
Copy link
Member

I only changed the storyboard binding. so it doesn't matter.

basically discussion here #295. (Although I think it is a very trivial cost to have it always animate)

@taooceros
Copy link
Member

Sorry I just saw that you use trigger to control the animation. That's a much better solution. Thank you so much.

@jjw24
Copy link
Member

jjw24 commented Nov 14, 2022

@taooceros have you reviewed this and good to merge?

@taooceros
Copy link
Member

@taooceros have you reviewed this and good to merge?

sorry I thought I already merged...

@taooceros
Copy link
Member

I just give a similar test for that. There's tiny little cpu usage when flow is hide in this pr compared to the current dev branch (only <.5%).

@jjw24
Copy link
Member

jjw24 commented Nov 23, 2022

Hmm, what steps did you do to test it, let me give it a test.

@jjw24
Copy link
Member

jjw24 commented Nov 23, 2022

Also @Sparrkle @taooceros how do I reproduce this error consistently?

@taooceros
Copy link
Member

@Sparrkle I add stopStoryBoard when exit the trigger. Could you please take a look on whether I am doing it correctly?

@jjw24
Copy link
Member

jjw24 commented Dec 27, 2022

@taooceros @Sparrkle is this PR still required? Still getting that error?

@taooceros
Copy link
Member

@taooceros @Sparrkle is this PR still required? Still getting that error?

It's a better implementation so let's get it in anyway. Though we may need to resolve the conflict

This comment has been minimized.

Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

📝 Walkthrough

Walkthrough

The changes involve updates to the main window's visual and animation logic. In the XAML file, a new <Border> with dynamic clipping via a <MultiBinding> is added. The code behind has been refactored to simplify progress bar animation management by removing a persistent storyboard state flag and initializing a local storyboard with DoubleAnimation objects. A trigger now governs the start and stop of the animation based on the visibility of the progress bar.

Changes

File(s) Change Summary
Flow.Launcher/…/MainWindow.xaml Added a <Border> element with Style="{DynamicResource WindowRadius}" and a nested <Border.Clip> using a <MultiBinding> with a converter for clipping.
Flow.Launcher/…/MainWindow.xaml.cs Removed global storyboard state and flag; refactored InitProgressbarAnimation to use a local storyboard with DoubleAnimation objects and triggers for visibility-based control.

Suggested labels

kind/ui, 5 min review

Suggested reviewers

  • taooceros
  • jjw24

Poem

I'm a coding bunny, hopping with cheer,
Clipping borders with bindings so clear.
Progress bars dance to a refreshed beat,
With triggers and animations so neat.
Leaping through code with a joyful heart,
I celebrate clean changes—a perfect art!
🐇✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e862b38 and 9b60eac.

📒 Files selected for processing (1)
  • Flow.Launcher/MainWindow.xaml.cs (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
🔇 Additional comments (3)
Flow.Launcher/MainWindow.xaml.cs (3)

30-30: Appropriate import added

The addition of System.Windows.Shapes namespace import is correct as it's needed for the Line type used in the progress bar animation.


426-467: Great refactoring of the progress bar animation

This is a significant improvement to the progress bar animation implementation:

  1. The code now uses a local Storyboard variable instead of a class field
  2. Animations are properly frozen for better performance
  3. The implementation uses WPF's trigger system to automatically start/stop the animation based on the progress bar's visibility
  4. The animation style is properly configured through code with a base style from resources

This approach eliminates the need for manual tracking of animation state with boolean flags, making the code cleaner and more maintainable. It also aligns better with WPF's declarative programming model.

The trigger-based implementation should resolve the dispatcher exception mentioned in the PR title, as it removes any timing issues that might have occurred with manual animation control.


468-468: Default visibility correctly set

Setting the progress bar to hidden by default is appropriate, ensuring it only appears when needed.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher/MainWindow.xaml.cs (1)

430-473: Excellent refactoring of progress bar animation!

This implementation significantly improves the progress bar animation logic by:

  1. Using a local storyboard variable instead of a persistent field
  2. Implementing a visibility-based trigger system that automatically starts/stops animation
  3. Freezing animation objects for better performance
  4. Properly structuring the style with animation triggers

This addresses the dispatcher exception mentioned in the PR by removing any dependency on persistent state tracking and instead using the WPF trigger system to manage animation lifecycle automatically.

Consider adding a brief comment explaining the animation's purpose and behavior, like:

private void InitProgressbarAnimation()
{
+    // Sets up an infinite animation for the progress bar that automatically
+    // starts/stops based on the progress bar's visibility
    var progressBarStoryBoard = new Storyboard();
    
    // Rest of code...
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c28a37a and 5d2778a.

📒 Files selected for processing (1)
  • Flow.Launcher/MainWindow.xaml.cs (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
🔇 Additional comments (2)
Flow.Launcher/MainWindow.xaml.cs (2)

344-346: LGTM for menu item formatting.

Proper formatting of menu items with proper translations and icons.


362-364: LGTM for exit menu item formatting.

Proper formatting with translations and icon assignment.

This comment has been minimized.

@prlabeler prlabeler bot added the bug Something isn't working label Mar 14, 2025
Jack251970
Jack251970 previously approved these changes Mar 14, 2025
Copy link
Member

@Jack251970 Jack251970 left a comment

Choose a reason for hiding this comment

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

Look good! Thanks for your idea.

@Jack251970
Copy link
Member

@Sparrkle @taooceros Does this work for you?

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ forbidden-pattern 26
⚠️ ignored-expect-variant 1
⚠️ non-alpha-in-dictionary 19

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)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@Jack251970 Jack251970 requested a review from onesounds March 16, 2025 08:42
@Jack251970 Jack251970 merged commit eb2a24d into Flow-Launcher:dev Mar 16, 2025
6 checks passed
@Jack251970 Jack251970 added this to the 1.20.0 milestone Mar 16, 2025
@coderabbitai coderabbitai bot mentioned this pull request Mar 27, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants