20211124_ZNZT_upperpc/MonitoringTechnology/Views/LYScanPage.xaml

84 lines
4.5 KiB
Plaintext
Raw Normal View History

2023-02-03 00:31:48 +00:00
<Window x:Class="MonitoringTechnology.Views.LYScanPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MonitoringTechnology.Views"
mc:Ignorable="d"
Height="500" Width="750"
Title="蓝牙搜索" WindowStartupLocation="CenterScreen">
<Window.Resources>
<DataTemplate x:Key="DeviceTemplate">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Content="{Binding Name}" FontWeight="Bold" FontSize="18" Foreground="White" />
<StackPanel Grid.Row="1" Orientation="Horizontal" >
<Label Foreground="White">MAC</Label>
<Label Foreground="White" Content="{Binding Mac}"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" >
<Label Foreground="White">厂商数据</Label>
<Label Foreground="White" Content="{Binding MfrDataHex}"/>
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal">
<Label Foreground="White">RSSI</Label>
<Label Foreground="White" Content="{Binding RSSI}"/>
</StackPanel>
</Grid>
</DataTemplate>
2023-03-13 00:52:25 +00:00
2023-02-03 07:14:41 +00:00
<ControlTemplate TargetType="Button" x:Key="ButtonTemplate">
2023-03-13 00:52:25 +00:00
<Border Background="#FF3269DE" CornerRadius="5">
<Grid>
<Border CornerRadius="4" Background="#22FFFFFF" Name="back" Visibility="Hidden"/>
<ContentControl Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}"/>
<Border CornerRadius="4" Background="#22FFFFFF" Name="BK" Visibility="Hidden" BorderThickness="2" BorderBrush="Black"/>
</Grid>
2023-02-03 07:14:41 +00:00
</Border>
<ControlTemplate.Triggers>
2023-03-13 00:52:25 +00:00
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Visibility" Value="Visible" TargetName="back"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Visibility" Value="Visible" TargetName="BK"/>
2023-02-03 07:14:41 +00:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2023-02-03 00:31:48 +00:00
</Window.Resources>
<Grid>
<Grid.Background>
<RadialGradientBrush Center="0.5,0.7" GradientOrigin="0.5,0.7" RadiusY="0.8" RadiusX="0.8">
<GradientStop Color="#FFA4B3D3"/>
<GradientStop Color="#FF302C5D" Offset="0.952"/>
<GradientStop Color="#FF96AAD4" Offset="0.101"/>
</RadialGradientBrush>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="27*"/>
<ColumnDefinition Width="289*"/>
<ColumnDefinition Width="184*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox x:Name="deviceListBox" IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Devices}" ItemTemplate="{StaticResource DeviceTemplate}"
MouseDoubleClick="deviceListBox_MouseDoubleClick" Grid.ColumnSpan="3" Margin="0,0,0,48" Grid.RowSpan="2"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Grid.ColumnSpan="2" Grid.Column="1">
2023-02-03 07:14:41 +00:00
<Button x:Name="btnConnect" Content="连接选中的设备" Margin="0, 10, 10, 10" Height="28" Width="150" FontSize="14"
Click="btnConnect_Click" Template="{StaticResource ButtonTemplate}"/>
<Button x:Name="btnStartScan" Content="扫描设备" Margin="0, 10, 10, 10" Height="28" Width="90" FontSize="14"
Click="btnStartScan_Click" Template="{StaticResource ButtonTemplate}"/>
2023-02-03 00:31:48 +00:00
</StackPanel>
</Grid>
</Window>