packServer/desktop/NtpWindow.xaml
2026-10-19 22:04:19 +08:00

94 lines
6.0 KiB
XML
Raw Permalink 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.NtpWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NTP 校时"
Width="520" SizeToContent="Height"
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">
<StackPanel>
<TextBlock Text="NTP 校时" FontSize="15" FontWeight="SemiBold" />
<TextBlock Text="扫码时间用本机时钟,回放按录像机时间定位;本机时间不准会让录像整体错位。"
FontSize="12" Foreground="{StaticResource MutedBrush}" Margin="0,4,0,14" />
<TextBlock Text="NTP 服务器" FontSize="12" Foreground="{StaticResource MutedBrush}" />
<TextBox x:Name="ServerBox" Padding="6,4" Margin="0,4,0,10"
ToolTip="域名或 IP,例如 ntp.aliyun.com / 112.124.21.102" />
<CheckBox x:Name="EnabledBox" Content="启用 NTP 校时(关闭后不再自动校时)" Margin="0,0,0,6" />
<CheckBox x:Name="StartupBox" Content="启动软件时自动校时" Margin="0,0,0,10" />
<TextBlock x:Name="ServiceModeTip" Text="服务模式:NTP 校时为强制开启,不能停用自动校时。"
FontSize="11" Foreground="#B45309" Margin="0,-4,0,10" Visibility="Collapsed" />
<DockPanel Margin="0,0,0,12" LastChildFill="False">
<TextBlock DockPanel.Dock="Left" Text="自动校时间隔(分钟,0 = 仅启动时)"
FontSize="12" Foreground="{StaticResource MutedBrush}" VerticalAlignment="Center" />
<TextBox x:Name="IntervalBox" DockPanel.Dock="Right" Width="70" Padding="6,4" />
</DockPanel>
<Border Background="#F9FAFB" BorderBrush="{StaticResource LineBrush}" BorderThickness="1"
CornerRadius="6" Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="本机时间:" Foreground="{StaticResource MutedBrush}" Margin="0,0,10,4" />
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="LocalTimeText" Margin="0,0,0,4" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="NTP 时间:" Foreground="{StaticResource MutedBrush}" Margin="0,0,10,4" />
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="ServerTimeText" Text="—" Margin="0,0,0,4" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="偏差:" Foreground="{StaticResource MutedBrush}" Margin="0,0,10,4" />
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="OffsetText" Text="—" Margin="0,0,0,4" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="往返:" Foreground="{StaticResource MutedBrush}" Margin="0,0,10,0" />
<TextBlock Grid.Row="3" Grid.Column="1" x:Name="RttText" Text="—" />
</Grid>
</Border>
<TextBlock x:Name="StatusText" Text="尚未校时" FontSize="12" Margin="0,10,0,0"
Foreground="{StaticResource MutedBrush}" TextWrapping="Wrap" />
<TextBlock Text="提示:修改「自动校时间隔」后需重启软件生效。"
FontSize="11" Foreground="{StaticResource MutedBrush}" Margin="0,4,0,0" />
<!-- 录像机 NTP:拉取当前主体全部 NVR,静默写入与上面一致的 NTP 服务器,并立即生效 -->
<Border Background="#F9FAFB" BorderBrush="{StaticResource LineBrush}" BorderThickness="1"
CornerRadius="6" Padding="10" Margin="0,14,0,0">
<StackPanel>
<DockPanel LastChildFill="False" Margin="0,0,0,8">
<Button x:Name="SyncNvrButton" DockPanel.Dock="Right" Content="同步 NVR 时间"
Padding="14,5" Background="{StaticResource BrandBrush}" Foreground="White"
BorderThickness="0" Cursor="Hand" Click="SyncNvr_Click" />
<TextBlock Text="录像机 NTP(与上方服务器一致,立即生效)" FontSize="12"
Foreground="{StaticResource MutedBrush}" VerticalAlignment="Center" />
</DockPanel>
<TextBox x:Name="NvrResultBox" Height="120" IsReadOnly="True" AcceptsReturn="True"
TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"
FontFamily="Consolas, Microsoft YaHei UI" FontSize="12" Padding="8"
Background="White" BorderBrush="{StaticResource LineBrush}" />
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,14,0,0">
<Button Content="关闭" Padding="14,5" IsCancel="True" Click="Cancel_Click" />
<Button Content="保存" Padding="14,5" Margin="8,0,0,0" Click="Save_Click" />
<Button x:Name="SyncButton" Content="立即校时" Padding="14,5" Margin="8,0,0,0"
Background="{StaticResource BrandBrush}" Foreground="White" BorderThickness="0"
Cursor="Hand" Click="Sync_Click" />
</StackPanel>
</StackPanel>
</Border>
</Window>