Skip to content

imp: 快速下载的选择菜单优化为多选项 - #3500

Open
qsc1918 wants to merge 5 commits into
PCL-Community:devfrom
qsc1918:imp/QuickDownload
Open

imp: 快速下载的选择菜单优化为多选项#3500
qsc1918 wants to merge 5 commits into
PCL-Community:devfrom
qsc1918:imp/QuickDownload

Conversation

@qsc1918

@qsc1918 qsc1918 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

修改内容

  • 调整快速下载的选择菜单优化为多选项

测试情况

  • 已运行 dotnet build
  • 已在本地验证快速下载功能

其他说明

Summary by Sourcery

通过添加支持多选的选择对话框,并将快速下载功能连接到对所有选中实例上运行,实现多实例选择的快速下载。

New Features:

  • 为消息框选择对话框引入多选模式,并提供相应的 API,用于返回所有选中的索引。
  • 允许快速下载在一次操作中选择并对多个兼容实例执行下载。

Enhancements:

  • 更新选择对话框的 UI 行为以支持基于复选框的多选,包括仅在至少选择一项时启用确认按钮。
Original summary in English

Summary by Sourcery

Enable multi-instance selection for quick download by adding a multi-select-capable selection dialog and wiring quick download to operate on all selected instances.

New Features:

  • Introduce a multi-select mode for message-box selection dialogs and a corresponding API that returns all selected indices.
  • Allow quick-download to select and apply downloads to multiple compatible instances in one operation.

Enhancements:

  • Update selection dialog UI behavior to support checkbox-based multi-selection, including enabling the confirm button only when at least one item is selected.

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

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

为通用选择对话框实现多选支持,并将其用于在快速下载流程中选择多个实例,相应地更新对话框行为和快速下载的实例选择逻辑。

快速下载多实例选择的时序图

sequenceDiagram
    actor User
    participant ModComp as ModComp
    participant ModMain as ModMain
    participant MyMsgSelect as MyMsgSelect

    User->>ModComp: QuickDownload(project)
    ModComp->>ModComp: _QuickDownloadPickInstances(project, files)
    ModComp->>ModMain: MyMsgBoxMultiSelect(selections, title, button1, button2, isWarn)
    ModMain->>MyMsgSelect: show with myConverter.MultiSelect = true

    User->>MyMsgSelect: check multiple MyListItem
    MyMsgSelect->>MyMsgSelect: _UpdateCheckedState()
    User->>MyMsgSelect: Btn1_Click()
    MyMsgSelect->>ModMain: myConverter.Result = List<int>

    ModMain-->>ModComp: return List<int> indices
    ModComp->>ModComp: map indices to List<McInstance>
    loop for each instance
        ModComp->>ModComp: _QuickDownloadToInstance(project, files, instance)
    end
Loading

文件级变更

Change Details Files
为通用消息框选择对话框添加多选能力,并暴露一个返回多个选中索引的辅助 API。
  • 扩展 MyMsgBoxConverter,增加 MultiSelect 标志,用于控制是否允许勾选多个选项。
  • 引入 MyMsgBoxMultiSelect 辅助方法,将 Select 类型对话框配置为多选模式,并返回已勾选索引的列表,同时记录日志。
  • 更新选择对话框的后端代码,当 MultiSelect 为 true 时将项目视为复选框,并在确认时收集所有选中的项目。
Plain Craft Launcher 2/Modules/ModMain.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgSelect.xaml.cs
更改快速下载实例选择逻辑,支持在一次操作中选择并下载到多个实例。
  • 用 _QuickDownloadPickInstances 替换单实例选择器,加载兼容实例并返回列表而非单个实例。
  • 更新快速下载的分支逻辑,遍历所有选中的实例,并对每个实例调用 _QuickDownloadToInstance。
  • 将 UI 选项从单选按钮切换为列表项,并使用新的 MyMsgBoxMultiSelect API 来允许多选实例。
Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs

与关联 issue 的对照评估

Issue Objective Addressed Explanation
#3471 当快速下载行为设置为“询问并下载到所选实例”时,将实例选择 UI 改为支持多选,并对所有选中的实例执行下载。

可能关联的 issues


Tips and commands

Interacting with 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 触发新的评审!

Customizing Your Experience

访问你的 dashboard 以:

  • 启用或禁用评审功能,例如 Sourcery 自动生成的 Pull Request 摘要、评审者指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审指令。
  • 调整其他评审设置。

Getting Help

Original review guide in English

Reviewer's Guide

Implements multi-select support for the generic selection dialog and uses it to allow choosing multiple instances in the quick download flow, updating both the dialog behavior and the quick download instance-selection logic accordingly.

Sequence diagram for quick download multi-instance selection

sequenceDiagram
    actor User
    participant ModComp as ModComp
    participant ModMain as ModMain
    participant MyMsgSelect as MyMsgSelect

    User->>ModComp: QuickDownload(project)
    ModComp->>ModComp: _QuickDownloadPickInstances(project, files)
    ModComp->>ModMain: MyMsgBoxMultiSelect(selections, title, button1, button2, isWarn)
    ModMain->>MyMsgSelect: show with myConverter.MultiSelect = true

    User->>MyMsgSelect: check multiple MyListItem
    MyMsgSelect->>MyMsgSelect: _UpdateCheckedState()
    User->>MyMsgSelect: Btn1_Click()
    MyMsgSelect->>ModMain: myConverter.Result = List<int>

    ModMain-->>ModComp: return List<int> indices
    ModComp->>ModComp: map indices to List<McInstance>
    loop for each instance
        ModComp->>ModComp: _QuickDownloadToInstance(project, files, instance)
    end
Loading

File-Level Changes

Change Details Files
Add multi-select capability to the generic message-box selection dialog and expose a helper API that returns multiple selected indices.
  • Extend MyMsgBoxConverter with a MultiSelect flag to control whether multiple options can be checked.
  • Introduce MyMsgBoxMultiSelect helper that configures a Select-type dialog in multi-select mode and returns a list of checked indices, logging the result.
  • Update the selection dialog code-behind to treat items as checkboxes when MultiSelect is true and to collect all checked items on confirmation.
Plain Craft Launcher 2/Modules/ModMain.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgSelect.xaml.cs
Change quick download instance picking to support selecting and downloading to multiple instances in one operation.
  • Replace single-instance picker with _QuickDownloadPickInstances that loads compatible instances and returns a list instead of a single one.
  • Update the quick download branching logic to iterate all selected instances and invoke _QuickDownloadToInstance for each.
  • Switch the UI options from radio buttons to list items and use the new MyMsgBoxMultiSelect API to allow multi-selection of instances.
Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#3471 When quick download behavior is set to 'ask and download to selected instance', change the instance selection UI to support multi-selection and apply the download to all selected instances.

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.

嘿——我在这里留下了一些总体反馈:

  • MyMsgBoxMultiSelect 中,目前日志消息会打印 List<int> 的类型名,而不是有用的值;建议显式记录索引(例如 string.Join(",", (List<int>)converter.Result)),或对其进行序列化,这样日志才更有可操作性。
  • 在多选的 Btn1_Click 中,代码目前只检查 MyListItem 子元素;如果以后在选择列表中添加其他 IMyRadio 实现,它们会被忽略——建议要么在集合类型上做更明确的约束,要么对其他 IMyRadio 实现进行一致的处理。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- In `MyMsgBoxMultiSelect`, the log message will print the `List<int>`’s type name rather than useful values; consider logging the indices explicitly (e.g., `string.Join(",", (List<int>)converter.Result)`), or serializing them, so the log is actionable.
- In `Btn1_Click` for multi-select, the code only inspects `MyListItem` children; if other `IMyRadio` implementations are ever added to the selection list, they will be ignored—consider either constraining the collection type more explicitly or handling additional `IMyRadio` implementations consistently.

Sourcery 对开源项目免费——如果你喜欢我们的代码审查,请考虑分享它们 ✨
帮我变得更有用!请对每条评论点击 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • In MyMsgBoxMultiSelect, the log message will print the List<int>’s type name rather than useful values; consider logging the indices explicitly (e.g., string.Join(",", (List<int>)converter.Result)), or serializing them, so the log is actionable.
  • In Btn1_Click for multi-select, the code only inspects MyListItem children; if other IMyRadio implementations are ever added to the selection list, they will be ignored—consider either constraining the collection type more explicitly or handling additional IMyRadio implementations consistently.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `MyMsgBoxMultiSelect`, the log message will print the `List<int>`’s type name rather than useful values; consider logging the indices explicitly (e.g., `string.Join(",", (List<int>)converter.Result)`), or serializing them, so the log is actionable.
- In `Btn1_Click` for multi-select, the code only inspects `MyListItem` children; if other `IMyRadio` implementations are ever added to the selection list, they will be ignored—consider either constraining the collection type more explicitly or handling additional `IMyRadio` implementations consistently.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d1b3f955e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b604030e14

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/Modules/Minecraft/ModComp.cs
@Chiloven945 Chiloven945 changed the title imp:快速下载的选择菜单优化为多选项 imp: 快速下载的选择菜单优化为多选项 Aug 5, 2026
Comment thread PCL.Core/App/Localization/Languages/zh-CN.xaml Outdated
qsc1918 and others added 2 commits August 5, 2026 16:31
Co-authored-by: ChilovenBustiangle <116699482+Chiloven945@users.noreply.github.com>
@MoYuan-CN
MoYuan-CN requested a review from Chiloven945 August 5, 2026 12:37
Comment thread PCL.Core/App/Localization/Languages/en-US.xaml Outdated
Co-authored-by: ChilovenBustiangle <116699482+Chiloven945@users.noreply.github.com>
@MoYuan-CN
MoYuan-CN requested a review from Chiloven945 August 6, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]: 快速下载优化

2 participants