feat(ui): Add About dialog with user-facing changelog

- Help menu (Help > About STPViewer) opens a dialog styled after
  ETTerms AboutView: app card (name/version/description), developer
  card, tech stack card on the left; scrollable version history on
  the right, written for end users in plain language (v0.1.0-v0.7.0)
- Version read from assembly (single source: csproj <Version>)
- Note in CLAUDE.md: top-level WPF MenuItem with a Click handler does
  not fire (verified with real mouse input) - dialog entries must
  live in a submenu

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 09:17:06 +08:00
co-authored by Claude Fable 5
parent 3d124782d5
commit 45b27d51cb
6 changed files with 222 additions and 0 deletions
+3
View File
@@ -108,6 +108,7 @@ STPViewer/
│ └── UnitSystem.cs # mm/inch + Units 格式化
├── StlExportDialog.xaml / .cs # STL 匯出參數對話框(範圍/格式/單位/精度 + 預估,確認再匯出)
├── AboutDialog.xaml / .cs # 關於視窗(程式/開發者/技術棧 + 使用者版 changelog
├── Services/
│ ├── StepImportService.cs # STEP/STL/DXF 讀檔 + 三角化 + 裝配樹
@@ -480,6 +481,8 @@ WPF retained-mode 每幀重走 visual tree → frame rate 崩。瀏覽模式因
- [x] 勾選清單隨 settings.json`QuickBarKeys`)保存;null/新按鈕用註冊表預設值
- [x] **剖面參數列**獨立成第三列,只在 `SectionEnabled` 時顯示(含「✕ 關閉」);
平常整條隱藏,不再常駐佔位
- [x] **關於視窗**`AboutDialog`,選單「說明 → 關於 STPViewer」)— 程式資訊/開發者/技術棧 +
給一般使用者看的版本紀錄(樣式參考 ETTerms AboutView);發新版在 Changelog 陣列頂端加一筆
**驗收:** 選單所有功能可用(checkable 與工具列 toggle 同步);快速列勾選即時增減、重開保留;
既有快速鍵 P/D/E/F/C/A/M + Esc 不受影響
+3
View File
@@ -97,6 +97,9 @@ dotnet publish src/STPViewer -c Release -o publish/STPViewer
放開事件靠 overlay 的 `AddHandler(MouseLeftButtonUp, handledEventsToo:true)`manipulator 會標 handled),`_gizmoBakePending` 防同次重複烘焙
- 干涉/面距/對齊等運算在背景執行緒;`Freeze()` 幾何後才跨執行緒
- 匯入在背景執行緒;`Freeze()` 幾何後才跨執行緒
- 發新版:升 csproj `<Version>` 之外,記得在 `AboutDialog.xaml.cs``Changelog` 陣列**頂端**加一筆
(口吻寫給一般使用者:「你會感覺到什麼」,不是技術 changelog)。
⚠️ WPF **頂層 MenuItem 直接掛 Click 不會觸發**(實測滑鼠/鍵盤都沒反應),要開視窗的入口一律放子選單(如 說明 → 關於)
- Commit 格式:Conventional Commits`feat:` / `fix:` / `docs:` …)
## 注意事項 / 已知限制
+118
View File
@@ -0,0 +1,118 @@
<Window x:Class="STPViewer.AboutDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="關於 STPViewer"
Width="860" Height="600"
WindowStartupLocation="CenterOwner"
ResizeMode="CanResize" MinWidth="700" MinHeight="420"
ShowInTaskbar="False">
<Window.Resources>
<Style x:Key="Card" TargetType="Border">
<Setter Property="Background" Value="#F0F4F8" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="14,10" />
<Setter Property="Margin" Value="0,0,0,10" />
</Style>
<Style x:Key="CardTitle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Margin" Value="0,0,0,6" />
</Style>
<Style x:Key="DimText" TargetType="TextBlock">
<Setter Property="Foreground" Value="#667788" />
<Setter Property="FontSize" Value="12" />
</Style>
</Window.Resources>
<Grid Margin="14">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- ─── 左:程式 / 開發者 / 技術棧 ─── -->
<StackPanel Grid.Column="0" Grid.Row="0" Margin="0,0,12,0">
<Border Style="{StaticResource Card}">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="STPViewer" FontSize="22" FontWeight="Bold"
Foreground="#1565C0" HorizontalAlignment="Center" />
<TextBlock x:Name="VersionText" Text="v0.0.0" Style="{StaticResource DimText}"
HorizontalAlignment="Center" Margin="0,2,0,8" />
<TextBlock TextAlignment="Center" FontSize="12" LineHeight="18">
STP / STEP 3D 檢視器<LineBreak />
免開重量級 CAD,快速開檔、量測、<LineBreak />
對齊插合、干涉檢查、剖面、匯出
</TextBlock>
</StackPanel>
</Border>
<Border Style="{StaticResource Card}">
<StackPanel>
<TextBlock Text="👤 開發者" Style="{StaticResource CardTitle}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition /><RowDefinition /><RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Name" Style="{StaticResource DimText}" />
<TextBlock Grid.Row="0" Grid.Column="1" Text="ET Wen" FontSize="12" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Email" Style="{StaticResource DimText}" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="eric441151893@gmail.com" FontSize="12" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="GitHub" Style="{StaticResource DimText}" />
<TextBlock Grid.Row="2" Grid.Column="1" Text="github.com/ETWen" FontSize="12" />
</Grid>
</StackPanel>
</Border>
<Border Style="{StaticResource Card}">
<StackPanel>
<TextBlock Text="🔧 技術棧" Style="{StaticResource CardTitle}" />
<TextBlock Style="{StaticResource DimText}" LineHeight="18">
.NET 8 · WPF · C#<LineBreak />
CADabilitySTEP / B-rep 幾何核心)<LineBreak />
HelixToolkit3D 顯示與相機)
</TextBlock>
</StackPanel>
</Border>
</StackPanel>
<!-- ─── 右:Change log ─── -->
<Border Grid.Column="1" Grid.Row="0" Background="#FAFBFC" CornerRadius="6" Padding="4">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Text="📋 版本紀錄" FontWeight="Bold" FontSize="14"
Margin="12,8,0,4" />
<ScrollViewer VerticalScrollBarVisibility="Auto" Padding="12,0,12,8">
<ItemsControl x:Name="ChangelogList">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,8,0,4">
<TextBlock FontWeight="Bold" Foreground="#1565C0" FontSize="13">
<Run Text="●" /> <Run Text="{Binding Header, Mode=OneWay}" />
</TextBlock>
<ItemsControl ItemsSource="{Binding Changes}" Margin="16,3,0,0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" TextWrapping="Wrap" FontSize="12"
LineHeight="17" Margin="0,1,0,1" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DockPanel>
</Border>
<Button Grid.Column="1" Grid.Row="1" Content="關閉" Width="90" Margin="0,10,0,0"
HorizontalAlignment="Right" IsCancel="True" IsDefault="True" />
</Grid>
</Window>
+91
View File
@@ -0,0 +1,91 @@
using System;
using System.Linq;
using System.Reflection;
using System.Windows;
namespace STPViewer;
/// <summary>
/// 關於視窗:左 = 程式資訊 / 開發者 / 技術棧,右 = 版本紀錄(寫給一般使用者看,非技術 changelog)。
/// 樣式參考 ETTerms 的 AboutView。發新版時在 Changelog 陣列最上面加一筆。
/// </summary>
public partial class AboutDialog : Window
{
public AboutDialog()
{
InitializeComponent();
Version v = Assembly.GetExecutingAssembly().GetName().Version!;
VersionText.Text = $"v{v.Major}.{v.Minor}.{v.Build}";
ChangelogList.ItemsSource = Changelog.Select(e => new
{
Header = $"v{e.Version} · {e.Title} ({e.Date:yyyy-MM-dd})",
e.Changes,
}).ToList();
}
private record ChangelogEntry(string Version, DateOnly Date, string Title, string[] Changes);
// ── 版本紀錄(新版加最上面;口吻:一般使用者看得懂,講「你會感覺到什麼」而非實作細節)──
private static readonly ChangelogEntry[] Changelog =
{
new("0.7.0", new DateOnly(2026, 7, 4), "介面大整理 — 選單列+可自訂快速列",
new[]
{
"• 上方新增選單列,全部功能依「檔案/視圖/量測/變換/工具」分類,不用再在一長排按鈕裡找。",
"• 原本的工具列變成「快速列」:只放常用按鈕。想放哪些自己決定 — 到「快速列 → 自訂按鈕」勾選,下次開啟會記住。",
"• 剖面的軸向/位置控制列改成只在開啟剖面時出現,平常不佔空間。",
"• 新增「關於」視窗(就是這個畫面),可以看版本紀錄。",
}),
new("0.6.0", new DateOnly(2026, 7, 4), "匯出 STL",
new[]
{
"• 新增匯出 STL:把畫面上的零件(含對齊、旋轉後的位置)存成 STL 網格檔,可拿去 3D 列印或給其他軟體用。",
"• 匯出前會先跳出設定視窗:全部合併成一個檔或每個檔案各存一個、Binary 或文字格式、mm 或 inch、網格精細度 — 確認後才匯出。",
"• 設定視窗會即時顯示三角形數量與預估檔案大小。",
}),
new("0.5.0", new DateOnly(2026, 7, 3), "量測、視圖、樹狀面板大升級",
new[]
{
"• 量距離時點到圓孔邊緣會自動吸到圓心 — 量兩孔中心距(pitch)超方便。",
"• 量測快速鍵:P 點、D 距離、E 邊、F 面、C 圓、A 角度、M 面距;Esc 取消。",
"• 樹狀面板可搜尋零件名稱;右鍵可「只顯示此節點」隔離觀察,也可以量體積與質心。",
"• 新增標準視圖(等角/前/上/右)與正交投影,量尺寸不受透視變形。",
"• 剖面新增「3點」模式:在模型上點 3 個點,就能沿任意斜面剖開。",
"• 新增匯出 STEP:把對齊好的零件位置存成新 STEP 檔,交接給正式 CAD。",
"• 會記住視窗大小、單位設定與最近開啟的 10 個檔案。",
}),
new("0.4.0", new DateOnly(2026, 7, 2), "更快、更穩",
new[]
{
"• 大檔案拉剖面滑桿不再卡住畫面(改到背景計算)。",
"• 拖曳/操作器放開零件後的定位計算大幅加速。",
"• 程式遇到錯誤會提示訊息並繼續運作,不再整個閃退。",
}),
new("0.3.2", new DateOnly(2026, 6, 18), "大組件量測不再卡",
new[]
{
"• 修正大型組件(數萬個面)進入量測模式後,轉動視角嚴重卡頓的問題 — 現在量測跟瀏覽一樣順。",
}),
new("0.3.1", new DateOnly(2026, 6, 13), "操作器永遠可見",
new[]
{
"• 三軸操作器改成永遠浮在畫面最上層,不會被零件擋住,任何角度都抓得到。",
}),
new("0.3.0", new DateOnly(2026, 6, 13), "三軸操作器",
new[]
{
"• 新增操作器:選取檔案後出現 XYZ 三色箭頭與旋轉環,箭頭沿軸精確移動、旋轉環繞軸轉任意角度。",
}),
new("0.2.0", new DateOnly(2026, 6, 13), "拖曳模式",
new[]
{
"• 新增拖曳模式:左鍵按住零件直接拖到想要的位置,放開就定位。",
"• 0.2.1 修正拖曳過的零件再點擊會當掉的問題。",
}),
new("0.1.0", new DateOnly(2026, 6, 13), "首次釋出",
new[]
{
"• STEPSTL/DXF 匯入與裝配樹、點/距離/邊/面/圓/角度/面距量測、兩點與三點對齊、干涉檢查、剖面、mm ⇄ inch、CSV 與截圖匯出。",
}),
};
}
+4
View File
@@ -133,6 +133,10 @@
<Separator />
<MenuItem Header="恢復預設按鈕" Command="{Binding QuickBar.ResetDefaultsCommand}" />
</MenuItem>
<MenuItem Header="說明(_H)">
<MenuItem Header=" 關於 STPViewer…" Click="About_Click"
ToolTip="程式資訊與版本紀錄" />
</MenuItem>
</Menu>
<!-- ─── 快速工具列(可自訂:選單「快速列 → 自訂按鈕」勾選)─── -->
+3
View File
@@ -123,6 +123,9 @@ public partial class MainWindow : Window
menu.IsOpen = true;
}
private void About_Click(object sender, RoutedEventArgs e) =>
new AboutDialog { Owner = this }.ShowDialog();
private void Tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) =>
_vm.SelectedNode = e.NewValue as ModelNodeViewModel;