需求:服务跟随软件运行,不需要单独的启停;唤醒地址由插件生成,界面不必提供复制。 - MainWindow.xaml:删除「停止服务/启动服务」与「复制唤醒地址」按钮; 第③行只保留协议状态文字;标题栏的圆点 + 「运行中 · 地址」继续显示服务状态。 - MainWindow.xaml.cs: - 删除 StartStop_Click(不再允许手动停服务:停了网页看到的现象和"未安装"一模一样); - 删除 CopyLaunchUrl_Click; - UpdateServerState 只刷新状态点/文字;移除 ServiceStateChanged 事件; - 顺手修复「在浏览器打开」指向了已删除的 /api/health → 改为根路径说明页。 - TrayIconService:菜单新增「重启软件」(打开主界面 / 重启软件 / 服务地址 / 版本 / 退出)。 - App:订阅 RestartRequested → RestartApplication(): 用 `cmd /c timeout /t 2 & start "" "<exe>"` 延迟拉起自己,再走正常退出流程 (必须先退出,否则新进程会撞单实例检测、把参数转发给正在退出的旧进程后就没了)。 - README:行为表补「托盘右键重启软件」,并说明主界面不提供启停/复制唤醒地址的原因。 验证:打包 1.0.5 安装后,主界面控件只剩「退出登录 / 复制地址 / 在浏览器打开 / 查询」等, 无启停与复制唤醒地址;协议状态文字正常;托盘菜单代码含「重启软件」。
89 lines
5.1 KiB
XML
89 lines
5.1 KiB
XML
<Window x:Class="YuncangTrace.LocalService.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Title="云仓视频溯源软件(本机服务)"
|
|
Height="620" Width="780"
|
|
MinHeight="520" MinWidth="680"
|
|
WindowStartupLocation="CenterScreen"
|
|
Background="{StaticResource BgBrush}"
|
|
FontFamily="Microsoft YaHei UI, Segoe UI"
|
|
FontSize="13">
|
|
<Grid Margin="18">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- ① 标题 + 运行状态 + 当前登录用户 -->
|
|
<DockPanel Grid.Row="0" Margin="0,0,0,14">
|
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<TextBlock x:Name="UserText" Text="未登录" Foreground="{StaticResource MutedBrush}"
|
|
VerticalAlignment="Center" Margin="0,0,10,0" />
|
|
<Button Content="退出登录" Padding="10,4" Click="Logout_Click" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal">
|
|
<Ellipse x:Name="StatusDot" Width="10" Height="10" Margin="0,0,8,0"
|
|
VerticalAlignment="Center" Fill="{StaticResource BadBrush}" />
|
|
<TextBlock Text="本机服务" FontSize="18" FontWeight="SemiBold" VerticalAlignment="Center" />
|
|
<TextBlock x:Name="StatusText" Text="未启动" Margin="10,0,0,2"
|
|
Foreground="{StaticResource MutedBrush}" VerticalAlignment="Bottom" />
|
|
</StackPanel>
|
|
</DockPanel>
|
|
|
|
<!-- ② 服务地址 -->
|
|
<Border Grid.Row="1" Background="White" BorderBrush="{StaticResource LineBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="12,10" Margin="0,0,0,10">
|
|
<DockPanel>
|
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
|
<Button Content="复制地址" Padding="10,4" Margin="0,0,8,0" Click="CopyAddress_Click" />
|
|
<Button Content="在浏览器打开" Padding="10,4" Click="OpenInBrowser_Click" />
|
|
</StackPanel>
|
|
<TextBlock Text="服务地址" Foreground="{StaticResource MutedBrush}" VerticalAlignment="Center" Margin="0,0,10,0" />
|
|
<TextBox x:Name="AddressBox" IsReadOnly="True" BorderThickness="0" Background="Transparent"
|
|
FontFamily="Consolas, Microsoft YaHei UI" VerticalContentAlignment="Center" />
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- ③ 协议状态(协议由安装包注册、卸载自动取消;本机服务随程序运行,不提供停止/启动按钮) -->
|
|
<TextBlock x:Name="ProtocolText" Grid.Row="2" Margin="2,0,0,6"
|
|
Foreground="{StaticResource MutedBrush}" TextTrimming="CharacterEllipsis" />
|
|
|
|
<!-- ④ 查询测试 -->
|
|
<Border Grid.Row="3" Background="White" BorderBrush="{StaticResource LineBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="12,10" Margin="0,6,0,10">
|
|
<StackPanel>
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Content="查询" Padding="16,5" Margin="8,0,0,0" Click="Query_Click" />
|
|
<TextBlock Text="测试查询" Foreground="{StaticResource MutedBrush}" VerticalAlignment="Center" Margin="0,0,10,0" />
|
|
<TextBox x:Name="QueryBox" Padding="6,3" VerticalContentAlignment="Center"
|
|
ToolTip="输入运单号后回车" KeyDown="QueryBox_KeyDown" />
|
|
</DockPanel>
|
|
<TextBox x:Name="ResultBox" Margin="0,10,0,0" Height="130" IsReadOnly="True"
|
|
AcceptsReturn="True" AcceptsTab="True" TextWrapping="NoWrap"
|
|
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
|
|
FontFamily="Consolas, Microsoft YaHei UI" FontSize="12" Padding="8"
|
|
Background="#F9FAFB" BorderBrush="{StaticResource LineBrush}" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ⑤ 日志 -->
|
|
<Grid Grid.Row="4">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Grid.Row="0" Text="运行日志" Foreground="{StaticResource MutedBrush}" Margin="2,0,0,4" />
|
|
<Border Grid.Row="1" Background="White" BorderBrush="{StaticResource LineBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="4">
|
|
<ListBox x:Name="LogList" BorderThickness="0" Background="Transparent"
|
|
FontFamily="Consolas, Microsoft YaHei UI" FontSize="12"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Auto" />
|
|
</Border>
|
|
</Grid>
|
|
</Grid>
|
|
</Window>
|