packServer/desktop/Views/RenameChannelWindow.xaml
liufumingren ed063db9f4 桌面端补上「通道改名」:已添加的通道不用再删了重加
之前通道一旦添加就只能删掉再添加来改名,而删除会让服务器软删该通道、
解绑工作台,还容易把通道号换掉。

- 扫码通道页新增「重命名」按钮(选中一行才可用),弹 RenameChannelWindow:
  只改名字、通道号不动
- ScanService.RenameChannelAsync:名字落本机 channels.json 后用普通推送同步服务器
  (POST /api/scan/channels 按 channelId 更新 channelName,不走 replace 全量对账);
  名字没变就不推服务器
- 可选「同时把名称写入设备」(SYS.HostName,默认勾选,设备 IP 未知时禁用):
  与添加通道一致,写失败只提示、不回滚本机改名
- 服务模式下本机只写通道文件,后台服务发现文件变化会自己重载并重连
- 删除通道按钮同样改成「选中才可用」,避免点了没反应

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-23 21:39:28 +08:00

40 lines
2.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<Window x:Class="YuncangTrace.LocalService.RenameChannelWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="重命名通道"
Height="380" Width="460"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
Background="{StaticResource BgBrush}"
FontFamily="Microsoft YaHei UI, Segoe UI"
FontSize="13">
<Border Background="White" BorderBrush="{StaticResource LineBrush}" BorderThickness="1"
CornerRadius="10" Margin="18" Padding="18">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Text="重命名扫码通道" FontSize="15" FontWeight="SemiBold" />
<TextBlock x:Name="ChannelText" DockPanel.Dock="Top" FontSize="12"
Foreground="{StaticResource MutedBrush}" Margin="0,4,0,12" TextWrapping="Wrap" />
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,14,0,0">
<Button Content="取消" Padding="14,5" IsCancel="True" Click="Cancel_Click" />
<Button x:Name="OkButton" Content="保存" Padding="14,5" Margin="8,0,0,0" IsDefault="True"
Background="{StaticResource BrandBrush}" Foreground="White" BorderThickness="0"
Cursor="Hand" Click="Ok_Click" />
</StackPanel>
<StackPanel>
<TextBlock Text="通道名" FontWeight="SemiBold" Margin="0,0,0,4" />
<TextBox x:Name="NameBox" Height="28" Padding="6,3" VerticalContentAlignment="Center"
MaxLength="32" />
<TextBlock Text="只改名字,通道号不动;服务器会按通道号更新名称(工作台里看到的也是新名字)"
FontSize="12" Foreground="{StaticResource MutedBrush}" Margin="0,4,0,14" TextWrapping="Wrap" />
<CheckBox x:Name="WriteDeviceBox" Content="同时把名称写入设备(SYS.HostName)" IsChecked="True"
VerticalContentAlignment="Center" />
<TextBlock Text="与添加通道时一致:写进设备后,设备面板和其他上位机看到的也是这个名字;写失败不影响本机改名"
FontSize="12" Foreground="{StaticResource MutedBrush}" Margin="0,4,0,0" TextWrapping="Wrap" />
</StackPanel>
</DockPanel>
</Border>
</Window>