本次更新聚焦于钻带文件解析顺序与格式的准确还原,提升了界面基础信息展示,并优化了相关数据结构和辅助方法。主要包括: - 钻带孔位逐行顺序解析,完整保留原始坐标字符串格式,避免顺序错乱和格式丢失。 - 界面新增基础信息分组,自动统计并展示最小钻咀、槽刀、EA刀直径。 - 数据结构如Point2D等增加运算符重载和构造函数,便于几何计算。 - 机台码(0.499刀具)坐标行顺序提取及正则健壮性提升。 - 移除强制编码指定,提升跨平台兼容性。 - 清理冗余测试代码,更新示例/测试钻带文件内容。 - 新增《必读.md》,明确AI开发不需编写测试单元。 本次无其他功能或逻辑变动的占位diff。
220 lines
9.4 KiB
XML
220 lines
9.4 KiB
XML
<Window
|
||
x:Class="DrillTools.MainWindow"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
xmlns:local="clr-namespace:DrillTools"
|
||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
Title="钻带处理工具(支持拖入钻带文件)"
|
||
Width="1000"
|
||
Height="550"
|
||
AllowDrop="True"
|
||
mc:Ignorable="d">
|
||
|
||
<Window.DataContext>
|
||
<local:MainWindowViewModel />
|
||
</Window.DataContext>
|
||
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="*" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 工具栏 -->
|
||
<ToolBar Grid.Row="0">
|
||
<!--<Button
|
||
Name="LoadSampleDataButton"
|
||
Click="LoadSampleDataButton_Click"
|
||
Content="加载示例数据" />
|
||
<Separator />-->
|
||
<Button
|
||
Name="LoadDrillTapeButton"
|
||
Click="LoadDrillTapeButton_Click"
|
||
Content="加载钻带文件" />
|
||
<Button
|
||
Name="ReorderToolsButton"
|
||
Click="ReorderToolsButton_Click"
|
||
Content="重排刀序" />
|
||
<Button
|
||
Name="ApplyOrderButton"
|
||
Click="ApplyOrderButton_Click"
|
||
Content="应用并保存"
|
||
IsEnabled="{Binding HasOriginalFile}" />
|
||
<Button
|
||
Name="ToggleTopmostButton"
|
||
Click="ToggleTopmostButton_Click"
|
||
Content="{Binding TopmostButtonText}" />
|
||
</ToolBar>
|
||
|
||
<!-- 主内容区域 -->
|
||
<Grid Grid.Row="1">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*" MinWidth="400" />
|
||
<ColumnDefinition Width="2*" />
|
||
</Grid.ColumnDefinitions>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="120" />
|
||
<RowDefinition Height="*" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 刀具列表 -->
|
||
<GroupBox
|
||
Grid.RowSpan="2"
|
||
Grid.Column="0"
|
||
Header="刀具列表(可拖动排序)">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="*" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<ListView
|
||
Name="ToolsListView"
|
||
Grid.Row="0"
|
||
AllowDrop="True"
|
||
ItemsSource="{Binding Tools}"
|
||
MouseDoubleClick="ToolsListView_MouseDoubleClick"
|
||
SelectedItem="{Binding SelectedTool}">
|
||
<ListView.View>
|
||
<GridView>
|
||
<GridViewColumn
|
||
Width="80"
|
||
DisplayMemberBinding="{Binding ToolNumber, StringFormat=T{0:D2}}"
|
||
Header="刀具编号" />
|
||
<GridViewColumn
|
||
Width="80"
|
||
DisplayMemberBinding="{Binding Diameter, StringFormat=F3}"
|
||
Header="孔径(mm)" />
|
||
<GridViewColumn
|
||
Width="70"
|
||
DisplayMemberBinding="{Binding ToolTypeDisplay}"
|
||
Header="类型" />
|
||
<GridViewColumn
|
||
Width="90"
|
||
DisplayMemberBinding="{Binding ToolSuffixTypeDisplay}"
|
||
Header="尾号类型" />
|
||
</GridView>
|
||
</ListView.View>
|
||
<ListView.ItemContainerStyle>
|
||
<Style BasedOn="{StaticResource {x:Type ListViewItem}}" TargetType="ListViewItem">
|
||
<Style.Triggers>
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter Property="Background" Value="#E0E0E0" />
|
||
</Trigger>
|
||
<Trigger Property="IsSelected" Value="True">
|
||
<Setter Property="Background" Value="#0078D4" />
|
||
<Setter Property="Foreground" Value="White" />
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ListView.ItemContainerStyle>
|
||
</ListView>
|
||
|
||
<!-- 插入位置指示器 -->
|
||
<Rectangle
|
||
x:Name="InsertionIndicator"
|
||
Grid.Row="0"
|
||
Height="2"
|
||
Margin="0,0,0,0"
|
||
HorizontalAlignment="Stretch"
|
||
Fill="#FF0078D4"
|
||
IsHitTestVisible="False"
|
||
Visibility="Collapsed" />
|
||
|
||
<!-- 上移/下移按钮 -->
|
||
<StackPanel
|
||
Grid.Row="1"
|
||
Margin="0,5,0,5"
|
||
HorizontalAlignment="Center"
|
||
Orientation="Horizontal">
|
||
<Button
|
||
Name="MoveUpButton"
|
||
Width="80"
|
||
Height="35"
|
||
Margin="5,0"
|
||
Click="MoveUpButton_Click"
|
||
Content="↑ 上移"
|
||
IsEnabled="{Binding CanMoveUp}" />
|
||
<Button
|
||
Name="MoveDownButton"
|
||
Width="80"
|
||
Height="35"
|
||
Margin="5,0"
|
||
Click="MoveDownButton_Click"
|
||
Content="↓ 下移"
|
||
IsEnabled="{Binding CanMoveDown}" />
|
||
</StackPanel>
|
||
</Grid>
|
||
</GroupBox>
|
||
|
||
<!-- 基础信息显示 -->
|
||
<GroupBox
|
||
Grid.Row="0"
|
||
Grid.Column="1"
|
||
Header="基础信息">
|
||
<Grid Margin="10">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 文件名单独一行 -->
|
||
<TextBlock
|
||
Grid.Row="0"
|
||
Text="{Binding FileNameWithoutExtension}"
|
||
VerticalAlignment="Center"
|
||
Margin="0,0,0,5"
|
||
FontWeight="Bold" />
|
||
|
||
<!-- 三个最小直径信息在同一行 -->
|
||
<Grid Grid.Row="1">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="*" />
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||
<TextBlock Text="最小钻咀:" VerticalAlignment="Center" />
|
||
<TextBlock Text="{Binding MinDrillDiameter, StringFormat=F3}" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||
</StackPanel>
|
||
|
||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||
<TextBlock Text="最小槽刀:" VerticalAlignment="Center" />
|
||
<TextBlock Text="{Binding MinSlotDiameter, StringFormat=F3}" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||
</StackPanel>
|
||
|
||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||
<TextBlock Text="最小EA刀:" VerticalAlignment="Center" />
|
||
<TextBlock Text="{Binding MinEADiameter, StringFormat=F3}" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||
</StackPanel>
|
||
</Grid>
|
||
</Grid>
|
||
</GroupBox>
|
||
|
||
<!-- 钻带内容显示 -->
|
||
<GroupBox
|
||
Grid.Row="1"
|
||
Grid.Column="1"
|
||
Header="钻带内容">
|
||
<TextBox
|
||
Name="DrillTapeTextBox"
|
||
HorizontalScrollBarVisibility="Auto"
|
||
IsReadOnly="True"
|
||
Style="{StaticResource CodeTextBoxStyle}"
|
||
Text="{Binding DrillTapeContent}"
|
||
TextWrapping="Wrap"
|
||
VerticalScrollBarVisibility="Auto" />
|
||
</GroupBox>
|
||
</Grid>
|
||
|
||
<!-- 状态栏 -->
|
||
<StatusBar Grid.Row="2">
|
||
<StatusBarItem>
|
||
<TextBlock Text="就绪" />
|
||
</StatusBarItem>
|
||
</StatusBar>
|
||
</Grid>
|
||
</Window> |