Repository navigation
MainWindow 结构重构 - #692
Open
HAILValkyrie wants to merge 7 commits into
Open
MainWindow 结构重构#692HAILValkyrie wants to merge 7 commits into
HAILValkyrie wants to merge 7 commits into
Conversation
去掉文件名中的 &;MainWindow_cs/ 改名为 MainWindow/。纯移动,无逻辑改动。
InkCanvas.Controls 的 LangVersion 对齐到 12。
新增 Ink/Ppt/Update/Security/UiShell 五个子目录,文件纯移动。
提取 SettingsStore、TrayIconService、NotificationService、TimerService、ScreenshotService、HotkeyService,原位保留转发壳。
新增 ToolMode 枚举与字符串双向映射,替换各处字符串比较点,持久化格式不变。
引入 LogService,空 catch 改为记日志、重抛或注释说明。MessageBox 弹窗主题锁定为 Owner 窗口实际主题。清理重构期遗留的模块编号措辞,移除 docs/refactor 文档。
5 of 6 tasks
Member
|
一下子改这么多不怕冲突吗 |
Author
冲突这块有准备:6 个 commit 按阶段切分,每个可独立 revert;改动主体是纯移动和等价改写。功能测试都尽量全面了。后续若与新 PR 冲突,rebase 由我自己负责同时已同步到 net10 最新,若仍担心体量,行为面那一处改动(MessageBox 主题锁定)可以单独拆出,听安排。 |
Author
|
已同步上游 net10 最新提交(f6da559b docs: 添加官网地址),合并无冲突,本 PR 现已与 net10 保持同步,可正常合并。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这是什么
兑现 #683
的交付承诺。该 issue 发出后 6 天无回复,按其文末默认条款("无回复则先提阶段 7 空 catch 治理第一批试水")起步;实际交付阶段 1–7(本 PR),阶段 8–12(PPT 集成提取、物理拆分、Dispatcher 收敛、测试基建、审计)待本批通过后再发,避免在途冲突。
纯结构重构,宣称零行为变化——一处例外,见文末"已知取舍"第 1 条,主动交代。
Commit ↔ 阶段对照
ad46439refactor&)+MainWindow_cs/→MainWindow/git mv,git log --follow可查历史23ea4d9build9ce3f0erefactorf2e3101refactor9a15329refactorde9662bchore审查标尺(源自提案 GLOBAL-RULES):每处改动应能一眼归入三类之一——a) 空 catch 内插日志;b) 字符串比较换枚举比较;c) 满足编译的等价改写。归不了类的即违规。
基线与数字(2026-10-03 在 base 上实测,可复现)
Base:
net10 @ d5eb72e(含上游 9/30–10/3 全部修复)。MainWindow_cs/行数catch\s*(\([^)]*\))?\s*\{\s*\}全仓扫描)Services/引用 Dispatchergrep -rn "Dispatcher" Services/)体量降幅说明:按寄生提取协议,原位置保留同名转发壳,壳删除与剩余方法提取排后续批次(已登记 backlog),因此本批降幅有限是设计使然,非未完成。
六个服务的提取要点
SettingsStore(设置读写 10 方法)/ TrayIconService / NotificationService / TimerService / ScreenshotService / HotkeyService(配置层 11 方法 + 2 DTO)。登记在案的等效改写(全部可逐条核对):
CountdownTimerWindow与NewStyleTimerWindow两份各自实现,本次提取统一状态机;定时器类型保持System.Timers.Timer原样(未换 DispatcherTimer,线程来源未变);等价性经假时钟逐帧验证:10min→65s→暂停→65s→结束 三场景共 12,000/12,200 帧全等。"任何时刻至多一个活跃 Tick"由状态机结构保证。GetActionByName:switch → 构造注入字典查表,19 键集合与原 switch 全等。Dispatcher.Invoke:改为注入的UiInvoke委托,装配侧即Dispatcher.Invoke,封送语义不变。ToolMode.Unknown(旧行为原样入字段);现存调用方全部传注册字面量,该路径不可达。HotkeyConfig.json以新 DTO 重序列化与实物逐字节一致(时间戳除外)。App.xaml.cs 中
CreateTrayIconService的反射接线(GetMethod/GetField)是寄生提取的过渡形态(原字段被插件与设置页按名消费,签名不能动),随壳删除批次收敛,非终态设计。人工冒烟(Windows 11 IoT 企业版 LTSC 25H2 26200.9457,同时还测了Windows 11 专业版 25H2 26200.9550,Release 构建产物)
已知取舍(主动交代,可应要求调整)
de9662b内):MessageBox 弹窗主题锁定为 Owner 窗口实际主题。重构期冒烟发现部分错误弹窗在特定 Owner 下主题错位,随治理一并修复。可拆分为独立 commit 或 revert 另开 issue,听维护者意见。LogService.LogException(ex),原LogHelper调用点的中文上下文串未逐条保留。若需要,下批补回 context 参数。测试承诺核对(CONTRIBUTING)
Release 构建通过(日志可应要求贴出)✔ · 受影响功能冒烟 ✔ · 回归可能性逐 commit 自查 ✔ · 未盲目带入任何顺手修复(发现的问题均登记,未改)✔