Skip to content

fix(tools): 自定义下载页加载时刷新按钮状态,避免下载按钮一直置灰#3353

Open
NoClassFoundError wants to merge 1 commit into
PCL-Community:devfrom
NoClassFoundError:fix/custom-download-btn-3350
Open

fix(tools): 自定义下载页加载时刷新按钮状态,避免下载按钮一直置灰#3353
NoClassFoundError wants to merge 1 commit into
PCL-Community:devfrom
NoClassFoundError:fix/custom-download-btn-3350

Conversation

@NoClassFoundError

@NoClassFoundError NoClassFoundError commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

PageToolsTest 的 MeLoaded 在加载时将 BtnDownloadStart 置为禁用,但既未校验 TextDownloadUrl,也未调用真正计算按钮启用状态的 StartButtonRefresh,导致下载按钮初始一直灰色、需手动改动下载地址(触发 ValidatedTextChanged→StartButtonRefresh)才会恢复。
在 MeLoaded 末尾补上TextDownloadUrl.Validate() 与 StartButtonRefresh(),使按钮在加载时即按 URL/文件夹/文件名三项校验结果正确启用/禁用。

resolves #3350

本PR的提交信息生成由Claude Code Opus 4.8生成,由Opus 4.8对代码进行了审查。

Summary by Sourcery

Bug Fixes:

  • 确保在初始加载时,根据 URL、文件夹和文件名的校验结果正确启用或禁用下载按钮,而不是在 URL 字段被编辑之前一直保持禁用状态。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure the download button is correctly enabled or disabled on initial load based on URL, folder, and filename validation instead of remaining disabled until the URL field is edited.

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XS PR 大小评估:微型 labels Jul 5, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
审阅者指南(在小型 PR 上折叠)

审阅者指南

通过在 MeLoaded 期间验证下载 URL 并运行现有的开始按钮刷新逻辑,确保工具测试页面在加载时正确初始化下载按钮的启用/禁用状态。

MeLoaded 初始化下载按钮状态的时序图

sequenceDiagram
    actor User
    participant PageToolsTest
    participant TextDownloadFolder
    participant TextDownloadName
    participant TextDownloadUrl
    participant BtnDownloadStart

    User->>PageToolsTest: MeLoaded()
    PageToolsTest->>TextDownloadFolder: Validate()
    PageToolsTest->>TextDownloadName: Validate()
    PageToolsTest->>TextDownloadUrl: Validate()
    PageToolsTest->>PageToolsTest: StartButtonRefresh()
    PageToolsTest->>BtnDownloadStart: [update IsEnabled based on validations]
Loading

文件级变更

变更 细节 文件
修复初始下载按钮状态,使其在工具测试页面加载时能反映当前输入校验结果。
  • 扩展 MeLoaded,在校验文件夹和名称字段的同时,额外校验下载 URL。
  • 在 MeLoaded 末尾调用 StartButtonRefresh,使下载按钮的启用状态根据当前校验结果重新计算。
Plain Craft Launcher 2/Pages/PageTools/PageToolsTest.xaml.cs

与关联 issue 的对照评估

Issue 目标 是否解决 说明
#3350 修复自定义下载工具页面上自定义下载按钮保持灰色且无法点击的 bug,即便已经提供了有效的下载信息。

可能关联的 issue


使用技巧与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在审阅评论下回复,请求 Sourcery 从该评论创建一个 issue。你也可以在审阅评论下回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可在任意时间生成标题。你也可以在 pull request 上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写上 @sourcery-ai summary,即可在你想要的位置生成 PR 摘要。你也可以在 pull request 上评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 上评论 @sourcery-ai guide,可在任何时间(重新)生成审阅者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理了所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审阅: 在 pull request 上评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审阅。特别适合你想从头开始新的审阅——别忘了再评论 @sourcery-ai review 触发新的审阅!

自定义你的使用体验

访问你的 控制面板 以:

  • 启用或禁用审阅功能,如 Sourcery 自动生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Ensures the tools test page initializes the download button enabled/disabled state correctly on load by validating the download URL and running the existing start-button refresh logic during MeLoaded.

Sequence diagram for MeLoaded initializing download button state

sequenceDiagram
    actor User
    participant PageToolsTest
    participant TextDownloadFolder
    participant TextDownloadName
    participant TextDownloadUrl
    participant BtnDownloadStart

    User->>PageToolsTest: MeLoaded()
    PageToolsTest->>TextDownloadFolder: Validate()
    PageToolsTest->>TextDownloadName: Validate()
    PageToolsTest->>TextDownloadUrl: Validate()
    PageToolsTest->>PageToolsTest: StartButtonRefresh()
    PageToolsTest->>BtnDownloadStart: [update IsEnabled based on validations]
Loading

File-Level Changes

Change Details Files
Fix initial download button state so it reflects current input validation when the tools test page loads.
  • Extend MeLoaded to validate the download URL in addition to folder and name fields.
  • Invoke StartButtonRefresh at the end of MeLoaded so the download button enablement is recalculated based on current validation results.
Plain Craft Launcher 2/Pages/PageTools/PageToolsTest.xaml.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#3350 Fix the bug where the custom download button remains greyed out and cannot be clicked on the custom download tools page, even when valid download information is provided.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - 我已经审查了你的更改,看起来非常不错!


Sourcery 对开源项目是免费的——如果你觉得我们的审查有帮助,请考虑分享给别人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的审查。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Labels

size: XS PR 大小评估:微型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]: 自定义下载按钮灰色无法下载

2 participants