123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <Window x:Class="XHWK.WKTool.DeviceWindow"
- 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:XHWK.WKTool"
- mc:Ignorable="d"
- Title="设备检测" AllowsTransparency="True"
- ShowInTaskbar="False"
- WindowStartupLocation="CenterOwner"
- WindowStyle="None" BorderThickness="7" Width="650" Height="450">
- <Window.Effect>
- <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
- </Window.Effect>
- <Window.Resources>
- <!--摄像头样式-->
- <Style TargetType="ToggleButton" x:Key="stlToggleButton">
- <Setter Property="Foreground" Value="White"></Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate>
- <Border x:Name="Back" Background="#FFFFFFFF" BorderThickness="0" BorderBrush="Transparent">
- <Path Name="PathFill" Fill="Black" Width="8" Height="6" StrokeThickness="0" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
- <Path.RenderTransform>
- <TransformGroup>
- <ScaleTransform/>
- <SkewTransform/>
- <RotateTransform Angle="180"/>
- <TranslateTransform/>
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="PathFill" Property="Fill" Value="White"></Setter>
- <Setter TargetName="Back" Property="Background" Value="#FFDCDCDC"></Setter>
- <Setter TargetName="Back" Property="BorderBrush" Value="#FFDCDCDC"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="ComboBox" x:Key="stlComboBox">
- <Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
- <Setter Property="HorizontalAlignment" Value="Left"></Setter>
- <Setter Property="Foreground" Value="Black"></Setter>
- <Setter Property="Height" Value="30"></Setter>
- <Setter Property="Margin" Value="0,0,0,0"></Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ComboBox">
- <Grid Background="#F7FDF7">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.8*"/>
- <ColumnDefinition Width="0.2*" MaxWidth="20"/>
- </Grid.ColumnDefinitions>
- <TextBox Grid.Column="0" IsReadOnly="True" VerticalContentAlignment="Center" Text="{TemplateBinding Text}"></TextBox>
- <Border Grid.Column="0" BorderThickness="1,1,1,1" BorderBrush="#FFDCDCDC" CornerRadius="1,0,0,1">
- </Border>
- <Border Grid.Column="1" BorderThickness="0,1,1,1" BorderBrush="#FFDCDCDC" CornerRadius="0,1,1,0">
- <ToggleButton Style="{StaticResource stlToggleButton}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
- </Border>
- <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
- <Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
- <Border.Effect>
- <DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
- </Border.Effect>
- <ScrollViewer Margin="4,6,4,6" Style="{DynamicResource ScrollViewerStyle}" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
- <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
- <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
- </ScrollViewer>
- </Border>
- </Popup>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="50"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <Grid x:Name="GridTitle_Black" Margin="0,0" Grid.Row="0" Background="#FFE9E9E9" MouseLeftButtonDown="Window_MouseLeftButtonDown">
- <TextBlock Text="设备检测" Foreground="#FF333333" FontSize="16" Padding="10,13,0,0" Grid.RowSpan="2"/>
- <Button Cursor="Hand" Grid.Row="0" x:Name="btnDown_Black" Content="×" VerticalAlignment="Top" Foreground="#FF333333" FontSize="30" Padding="10,2,10,0" HorizontalAlignment="Right" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnDown_Click"/>
- </Grid>
- <Grid Grid.Row="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="100*"/>
- <ColumnDefinition Width="300*"/>
- </Grid.ColumnDefinitions>
- <Grid Grid.Column="0">
- <Border BorderBrush="#FFE9E9E9" BorderThickness="1" CornerRadius="7">
- <StackPanel Margin="0,10">
- <Button x:Name="BtnCamera" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="15,10,0,10" HorizontalAlignment="Left" VerticalAlignment="Stretch" Click="BtnCamera_Click">
- <StackPanel Orientation="Horizontal">
- <Image Source="/BlackImages/Device_Camera.png" Margin="6,0" HorizontalAlignment="Left"/>
- <TextBlock Text="摄像头" FontSize="20" Padding="0,2,0,0" HorizontalAlignment="Center"/>
- </StackPanel>
- </Button>
- <Button x:Name="BtnSpeaker" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="15,10,0,10" HorizontalAlignment="Left" VerticalAlignment="Stretch" Click="BtnSpeaker_Click">
- <StackPanel Orientation="Horizontal">
- <Image Source="/BlackImages/Device_Voice.png" Margin="6,0" HorizontalAlignment="Left"/>
- <TextBlock Text="扬声器" FontSize="20" Padding="0,2,0,0" HorizontalAlignment="Center"/>
- </StackPanel>
- </Button>
- <Button x:Name="BtnMicrophone" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="15,10,0,10" HorizontalAlignment="Left" VerticalAlignment="Stretch" Click="BtnMicrophone_Click">
- <StackPanel Orientation="Horizontal">
- <Image Source="/BlackImages/Device_Microphone.png" Margin="6,0" HorizontalAlignment="Left"/>
- <TextBlock Text="麦克风" FontSize="20" Padding="0,2,0,0" HorizontalAlignment="Center"/>
- </StackPanel>
- </Button>
- <Button x:Name="BtnDetectionPage" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="15,10,0,10" HorizontalAlignment="Left" VerticalAlignment="Stretch" Click="BtnDetectionPage_Click">
- <StackPanel Orientation="Horizontal">
- <Image Source="/BlackImages/Device_JC.png" Margin="6,0" HorizontalAlignment="Left"/>
- <TextBlock Text="设备检测" FontSize="20" Padding="0,2,0,0" HorizontalAlignment="Center"/>
- </StackPanel>
- </Button>
- </StackPanel>
- </Border>
- </Grid>
- <Grid x:Name="GridDetection" Grid.Column="1" Margin="25,15" Visibility="Collapsed">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="50*"/>
- <ColumnDefinition Width="50*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- <RowDefinition Height="50*"/>
- </Grid.RowDefinitions>
- <Grid Grid.Row="0" Grid.Column="0">
- <TextBlock Text="设备名称" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF999999" ></TextBlock>
- </Grid>
- <Grid Grid.Row="0" Grid.Column="1">
- <TextBlock Text="检测结果" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF999999" ></TextBlock>
- </Grid>
- <!--摄像头-->
- <Grid Grid.Row="1" Grid.Column="0">
- <TextBlock Text="摄像头" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
- <Grid Grid.Row="1" Grid.Column="1">
- <TextBlock x:Name="TxbCamera" Text="" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
- <!--扬声器-->
- <Grid Grid.Row="2" Grid.Column="0">
- <TextBlock Text="扬声器" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
- <Grid Grid.Row="2" Grid.Column="1">
- <TextBlock x:Name="TxbSpeaker" Text="" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
- <!--麦克风-->
- <Grid Grid.Row="3" Grid.Column="0">
- <TextBlock Text="麦克风" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
- <Grid Grid.Row="3" Grid.Column="1">
- <TextBlock x:Name="TxbMicrophone" Text="" FontSize="17" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF000000" ></TextBlock>
- </Grid>
-
- <Grid Grid.Row="6" Grid.Column="1">
- <Button x:Name="BtnDetection" Grid.Row="2" Width="116" Height="46" Content="开始检测" Foreground="White" FontSize="17" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnDetection_Click">
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="25">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </Grid>
- <Grid x:Name="GridCamera" Grid.Column="1" Visibility="Collapsed">
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,20,0,0">
- <TextBlock Text="摄像头:" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- <ComboBox Text="请选择" Cursor="Hand" Width="210" x:Name="CmbCameraList" Padding="30,0,10,0" Style="{StaticResource stlComboBox}" BorderThickness="0" DisplayMemberPath="Value" FontSize="14" SelectedValuePath="Key" Background="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top" />
- </StackPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,60,0,0">
- <Button x:Name="BtnCameraSave" Grid.Row="2" Width="70" Height="30" Content="设置" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="10,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnCameraSave_Click">
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- <Button x:Name="BtnCameraStat" Grid.Row="2" Width="70" Height="30" Content="检测" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="10,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnCameraStat_Click">
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- <Button x:Name="BtnCameraStop" Grid.Row="2" Width="70" Height="30" Content="停止" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="10,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnCameraStop_Click">
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#CCCCCC</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </StackPanel>
- <Image x:Name="imgPlayer" Width="300" Height="250" HorizontalAlignment="Left" Margin="30,100,0,0" VerticalAlignment="Top" Visibility="Visible"/>
- </Grid>
- <Grid x:Name="GridSpeaker" Grid.Column="1" Visibility="Collapsed">
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,20,0,0">
- <Button x:Name="BtnSpeakerDetection" Grid.Row="2" Width="100" Height="30" Content="播放音频" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="10,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnSpeakerDetection_Click" >
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
-
- <MediaElement x:Name="MediaAudio" Stretch="Fill" LoadedBehavior="Manual" Width="0" Volume="1" MediaOpened="MediaAudio_MediaOpened" MediaEnded="MediaAudio_MediaEnded" Visibility="Hidden"/>
- <!--<Slider x:Name="timelineSlider" Minimum="0" VerticalAlignment="Center" BorderThickness="0,5,0,0" Width="150" Height="30" />-->
- </StackPanel>
-
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,60,0,0">
- <TextBlock Text="声音采集:" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- <TextBlock x:Name="TbxSpeakerDetection" Text="待检测" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- </StackPanel>
- </Grid>
- <Grid x:Name="GridMicrophone" Grid.Column="1" Visibility="Visible">
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,20,0,0">
- <TextBlock Text="麦克风:" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- <ComboBox Text="请选择" Cursor="Hand" Width="210" x:Name="CmbMicrophoneList" Padding="30,0,10,0" Style="{StaticResource stlComboBox}" BorderThickness="0" DisplayMemberPath="Value" FontSize="14" SelectedValuePath="Key" Background="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top" />
- <Button x:Name="BtnMicrophoneSave" Grid.Row="2" Width="70" Height="30" Content="设置" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="10,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnMicrophoneSave_Click">
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </StackPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,60,0,0">
- <Button x:Name="BtnMicrophoneDetection" Grid.Row="2" Width="100" Height="30" Content="开始录音" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnMicrophoneDetection_Click" >
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </StackPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="30,100,0,0">
- <TextBlock Text="麦克风采集:" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- <TextBlock x:Name="TbxMicrophoneDetection" Text="待检测" FontSize="17" Foreground="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" ></TextBlock>
- </StackPanel>
- <Button x:Name="BtnMicrophoneDetectionPlay" Content="播放" Foreground="White" FontSize="15" IsDefault="True" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="30,142,347,214" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="BtnMicrophoneDetectionPlay_Click" >
- <Button.Template>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="7">
- <Border.Background>
- <Brush>#2E8CF0</Brush>
- </Border.Background>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
- </Border>
- </ControlTemplate>
- </Button.Template>
- </Button>
- <MediaElement x:Name="MediaAudioMicPlay" Stretch="Fill" LoadedBehavior="Manual" Width="0" Volume="1" MediaEnded="MediaAudioMicPlay_MediaEnded" Visibility="Hidden"/>
-
- </Grid>
- </Grid>
- </Grid>
- </Window>
|