| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- <UserControl x:Class="TeamAAS_VP.Views.Product.VisionStaticAccuracyAnalyzer"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:prism="http://prismlibrary.com/"
- xmlns:wf="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
- xmlns:vp="clr-namespace:Cognex.VisionPro;assembly=Cognex.VisionPro.Controls"
- xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
- xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
- xmlns:sys="clr-namespace:System;assembly=mscorlib"
- xmlns:uControl="clr-namespace:TeamAAS_VP.Controls"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels.Product"
- xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
- xmlns:lex="http://wpflocalizeextension.codeplex.com"
- lex:LocalizeDictionary.DesignCulture="zh-CN"
- lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
- lex:ResxLocalizationProvider.DefaultDictionary="Lang"
- prism:ViewModelLocator.AutoWireViewModel="True"
- mc:Ignorable="d"
- d:DataContext="{d:DesignInstance Type=vm:VisionStaticAccuracyAnalyzerViewModel}"
- d:Height="600"
- d:Width="1024"
- MinHeight="700"
- MinWidth="900"
- d:Background="White"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- FontFamily="{DynamicResource DefaultFont}">
- <prism:Dialog.WindowStyle>
- <Style TargetType="Window">
- <Setter Property="prism:Dialog.WindowStartupLocation"
- Value="CenterScreen" />
- <Setter Property="AllowDrop"
- Value="True" />
- <Setter Property="ShowInTaskbar"
- Value="True" />
- <!--<Setter Property="SizeToContent"
- Value="WidthAndHeight" />-->
- <Setter Property="WindowState"
- Value="Maximized" />
- <Setter Property="Topmost"
- Value="True" />
- </Style>
- </prism:Dialog.WindowStyle>
- <UserControl.Resources>
- <!-- 样式定义 -->
- <Style TargetType="Button"
- BasedOn="{StaticResource MaterialDesignFlatDarkBgButton}">
- <Setter Property="Padding"
- Value="10 5" />
- <Setter Property="Margin"
- Value="5" />
- <Setter Property="FontSize"
- Value="14" />
- <Setter Property="BorderThickness"
- Value="0" />
- </Style>
- <Style TargetType="TextBlock">
- <Setter Property="VerticalAlignment"
- Value="Center" />
- <Setter Property="Margin"
- Value="5" />
- </Style>
- <Style TargetType="TextBox"
- BasedOn="{StaticResource MaterialDesignTextBox}">
- <Setter Property="Margin"
- Value="5" />
- <Setter Property="VerticalContentAlignment"
- Value="Center" />
- </Style>
- <Style x:Key="DataGridStyle"
- TargetType="DataGrid"
- BasedOn="{StaticResource MaterialDesignDataGrid}">
- <Setter Property="Margin"
- Value="5" />
- <Setter Property="AutoGenerateColumns"
- Value="False" />
- <Setter Property="CanUserAddRows"
- Value="False" />
- <Setter Property="CanUserDeleteRows"
- Value="False" />
- <Setter Property="IsReadOnly"
- Value="True" />
- <Setter Property="AlternatingRowBackground"
- Value="#F5F5F5" />
- </Style>
- <Style x:Key="TitleStyle"
- TargetType="TextBlock">
- <Setter Property="FontSize"
- Value="16" />
- <Setter Property="FontWeight"
- Value="Bold" />
- <Setter Property="Margin"
- Value="0 10 0 5" />
- <Setter Property="Foreground"
- Value="#2C3E50" />
- </Style>
- </UserControl.Resources>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="2*" />
- <ColumnDefinition Width="3*" />
- </Grid.ColumnDefinitions>
- <!-- 左侧控制面板 -->
- <Border Grid.Column="0"
- BorderBrush="#BDC3C7"
- BorderThickness="0 0 1 0">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <!-- 测试设置区域 -->
- <Border Grid.Row="0"
- Background="#ECF0F1"
- Padding="10">
- <StackPanel>
- <TextBlock Style="{StaticResource TitleStyle}"
- Text="测试设置" />
- <Grid Margin="0 10 0 0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <TextBlock Text="重复次数:"
- Grid.Column="0" />
- <mah:NumericUpDown Grid.Column="1"
- Value="{Binding RepeatCount, Mode=TwoWay}"
- Minimum="1"
- d:Value="10"
- TextAlignment="Center"
- HorizontalContentAlignment="Center"
- HorizontalAlignment="Stretch"
- IsEnabled="{Binding IsRunning,Converter={StaticResource InvertBooleanConverter}}" />
- <!--<Button x:Name="btnSetCount"
- Grid.Column="2"
- Content="设置"
- Width="60" />-->
- </Grid>
- <Separator Margin="0 15 0 10" />
- <!-- 控制按钮 -->
- <WrapPanel HorizontalAlignment="Center">
- <Button x:Name="btnStart"
- Content="开始测试"
- Background="#27AE60"
- Foreground="White"
- MinWidth="100"
- Height="35"
- FontWeight="Bold"
- Command="{Binding StartTestCommand}" />
- <Button x:Name="btnStop"
- Content="停止"
- Background="#E74C3C"
- Foreground="White"
- MinWidth="100"
- Height="35"
- d:IsEnabled="False"
- Command="{Binding StopTestCommand}" />
- <Button x:Name="btnPause"
- Content="暂停"
- Background="#F39C12"
- Foreground="White"
- MinWidth="100"
- Height="35"
- d:IsEnabled="False"
- Command="{Binding PauseTestCommand}" />
- </WrapPanel>
- </StackPanel>
- </Border>
- <!-- 进度显示 -->
- <Border Grid.Row="1"
- Background="#F8F9FA"
- Padding="10">
- <StackPanel>
- <TextBlock Style="{StaticResource TitleStyle}"
- Text="测试进度" />
- <Grid Margin="0 10 0 0">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <ProgressBar Grid.Row="0"
- Height="25"
- Margin="5"
- Minimum="0"
- Maximum="{Binding RepeatCount,Mode=TwoWay}"
- Value="{Binding CurrentProgress,Mode=TwoWay}"
- IsEnabled="False"
- d:Maximum="100"
- d:Value="50" />
- <TextBlock Grid.Row="1"
- HorizontalAlignment="Center"
- FontSize="12"
- Foreground="#7F8C8D"
- d:Text="等待开始..."
- Text="{Binding Message}" />
- </Grid>
- <!-- 统计信息 -->
- <WrapPanel Margin="0 15 0 0"
- HorizontalAlignment="Center">
- <Border Background="#3498DB"
- Padding="10 5"
- Margin="5"
- CornerRadius="3">
- <StackPanel>
- <TextBlock Text="已完成"
- Foreground="White"
- FontSize="11" />
- <TextBlock x:Name="txtCompleted"
- Text="{Binding CurrentProgress}"
- d:Text="0"
- Foreground="White"
- FontSize="16"
- FontWeight="Bold"
- HorizontalAlignment="Center" />
- </StackPanel>
- </Border>
- <Border Background="#2ECC71"
- Padding="10 5"
- Margin="5"
- CornerRadius="3">
- <StackPanel>
- <TextBlock Text="成功率"
- Foreground="White"
- FontSize="11" />
- <TextBlock x:Name="txtSuccessRate"
- d:Text="0%"
- Text="{Binding SuccessRate, StringFormat={}{0:F2}%}"
- Foreground="White"
- FontSize="16"
- FontWeight="Bold"
- HorizontalAlignment="Center" />
- </StackPanel>
- </Border>
- <Border Background="#E74C3C"
- Padding="10 5"
- Margin="5"
- CornerRadius="3">
- <StackPanel>
- <TextBlock Text="失败数"
- Foreground="White"
- FontSize="11" />
- <TextBlock x:Name="txtFailedCount"
- d:Text="0"
- Text="{Binding FailCount}"
- Foreground="White"
- FontSize="16"
- FontWeight="Bold"
- HorizontalAlignment="Center" />
- </StackPanel>
- </Border>
- </WrapPanel>
- </StackPanel>
- </Border>
- <!-- 测试结果列表 -->
- <Border Grid.Row="2"
- Background="White"
- Padding="10">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <TextBlock Style="{StaticResource TitleStyle}"
- Text="测试结果列表" />
- <DataGrid x:Name="dgResults"
- Grid.Row="1"
- Style="{StaticResource DataGridStyle}"
- MaxHeight="300"
- AutoGenerateColumns="True"
- CanUserAddRows="False"
- IsReadOnly="True"
- ItemsSource="{Binding TestResult.DefaultView}"
- AutoGeneratingColumn="DataGrid_AutoGeneratingColumn" />
- </Grid>
- </Border>
- <!-- 导出按钮 -->
- <Border Grid.Row="3"
- Background="#ECF0F1"
- Padding="10">
- <StackPanel>
- <WrapPanel HorizontalAlignment="Right">
- <Button x:Name="btnExportCSV"
- Content="导出CSV"
- Background="#3498DB"
- Foreground="White"
- MinWidth="100"
- Command="{Binding ExportCSVCommand}" />
- <Button x:Name="btnExportReport"
- Content="生成报告"
- Background="#9B59B6"
- Foreground="White"
- MinWidth="100"
- Command="{Binding ExportReportCommand}" />
- <Button x:Name="btnClearData"
- Content="清空数据"
- Background="#95A5A6"
- Foreground="White"
- MinWidth="100"
- Command="{Binding ClearDataCommand}" />
- </WrapPanel>
- <!-- 精度统计 -->
- <Border Margin="0 10 0 0"
- Background="#F8F9FA"
- Padding="10"
- CornerRadius="5">
- <StackPanel>
- <StackPanel Orientation="Horizontal"
- Margin="0 0 0 5">
- <TextBlock Text="精度统计"
- FontWeight="Bold" />
- <ComboBox ItemsSource="{Binding ResultDataColumns}"
- SelectedItem="{Binding SelectedDataColumn, Mode=TwoWay}"
- Margin="5,0">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding ColumnName}" />
- </DataTemplate>
- </ComboBox.ItemTemplate>
- <b:Interaction.Triggers>
- <b:EventTrigger EventName="SelectionChanged">
- <b:InvokeCommandAction Command="{Binding SelectColumnCommand}"/>
- </b:EventTrigger>
- </b:Interaction.Triggers>
- </ComboBox>
- </StackPanel>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0">
- <TextBlock Text="标准差:">
- <Run x:Name="runStdX"
- d:Text="0.000"
- Text="{Binding StabilityMetrics.StdDeviation,StringFormat={}{0:F3}}"
- Foreground="#2C3E50"
- FontWeight="Bold" />
- </TextBlock>
- <TextBlock Text="3σ范围:">
- <Run x:Name="runStdY"
- d:Text="±0.000"
- Text="{Binding StabilityMetrics.ThreeSigmaRange,StringFormat={}±{0:F3}}"
- Foreground="#2C3E50"
- FontWeight="Bold" />
- </TextBlock>
- </StackPanel>
- <StackPanel Grid.Column="1">
- <TextBlock Text="峰度:">
- <Run x:Name="runAvgDeviation"
- d:Text="0.000"
- Text="{Binding StabilityMetrics.Kurtosis,StringFormat={}{0:F3}}"
- Foreground="#2C3E50"
- FontWeight="Bold" />
- </TextBlock>
- <TextBlock Text="极差:">
- <Run x:Name="runMaxDeviation"
- d:Text="0.000"
- Text="{Binding StabilityMetrics.Range,StringFormat={}{0:F3}}"
- Foreground="#2C3E50"
- FontWeight="Bold" />
- </TextBlock>
- </StackPanel>
- </Grid>
- </StackPanel>
- </Border>
- </StackPanel>
- </Border>
- </Grid>
- </Border>
- <Grid Grid.Column="1">
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <!-- 右侧图像显示区域 -->
- <Border Grid.Column="1"
- Background="#2C3E50">
- <!-- 图像显示画布 -->
- <wf:WindowsFormsHost>
- <vp:CogRecordDisplay x:Name="display" />
- </wf:WindowsFormsHost>
- </Border>
- <StackPanel Grid.Row="3"
- Orientation="Horizontal"
- VerticalAlignment="Center"
- HorizontalAlignment="Right">
- <Button Height="30"
- MinWidth="100"
- Content="{lex:Loc 确定}"
- materialDesign:ButtonAssist.CornerRadius="10"
- ToolTip="{lex:Loc 确定}"
- Command="{Binding ConfirmCommand}" />
- <Button Height="30"
- Margin="10,0"
- MinWidth="100"
- materialDesign:ButtonAssist.CornerRadius="10"
- ToolTip="{lex:Loc 取消}"
- Content="{lex:Loc 取消}"
- Command="{Binding CancelCommand}" />
- </StackPanel>
- </Grid>
- <materialDesign:Snackbar Grid.ColumnSpan="2"
- Opacity="0.8"
- HorizontalContentAlignment="Center"
- FontSize="14"
- MessageQueue="{Binding MessageQueue}"
- VerticalAlignment="Bottom" />
- </Grid>
- </UserControl>
|