Commit 2270e8fb authored by 潘栩锋's avatar 潘栩锋 🚴

GetSample 添加 更多报警

parent 9671ddff
......@@ -14,293 +14,305 @@
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:GetSampleVmUt x:Key="unittest"/>
<local:Item2IndexConverter x:Key="i2iConv"/>
<local:Item2DirectionConverter x:Key="i2dConv"/>
<local:PgGetSampleVmUt x:Key="viewModel"/>
</ResourceDictionary>
</Page.Resources>
<Grid d:DataContext="{StaticResource unittest}" >
<Grid d:DataContext="{StaticResource viewModel}" Background="{StaticResource Brushes.Card.Background}">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Name="grid_initparam"/>
<StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
<Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack"/>
<TextBlock Style="{StaticResource TextBlockStyle_Title}" Text="样品标定"/>
<StackPanel Orientation="Horizontal" Background="{StaticResource Brushes.TitleBar.Background}">
<Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"/>
<TextBlock Style="{StaticResource Styles.TitleBar.Text}" >
<Run Text="{Binding InfoName}"/>样品标定
</TextBlock>
</StackPanel>
<ScrollViewer PanningMode="Both" Grid.Row="1" >
<StackPanel >
<StackPanel Orientation="Horizontal" >
<Border Style="{StaticResource BorderStyle_paramSection}">
<TextBlock Text="基本" />
</Border>
<Border Style="{StaticResource Styles.Card.Border}">
<StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="基本"/>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="速度" />
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding Velocity}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" >
<Run >
<MultiBinding Converter="{StaticResource outsp2mpminconv}" Mode="OneWay" StringFormat="{}{0:F1}">
<Binding Path="Velocity" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
<Binding Path="DataContext.Speed1Scale" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="m/min"/>
</TextBlock>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="使能" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding Enable}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="样品半径" />
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="样品半径" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Range}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" >
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding SampleRange}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" >
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="Range" />
<Binding Path="SampleRange" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="mm"/>
</Run>mm
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<!--<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{StaticResource strSampleInterval}" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Interval}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="min"/>
</StackPanel>
</StackPanel>-->
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="移动滤波" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="移动滤波窗口" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Window}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="min"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Window}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="min"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="按%判断异常" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding IsCheckByPercent}" HorizontalAlignment="Left"/>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="按%判断异常" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsCheckByPercent}" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Visibility="{Binding IsCheckByPercent,Converter={StaticResource visbilityconv}, ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="异常比例" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="异常比例" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ErrPercent,StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="%"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding ErrPercent,Converter={StaticResource percentconv}}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Visibility="{Binding IsCheckByPercent,Converter={StaticResource visbilityconv}, ConverterParameter=CollapsedWhenTrue}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="异常值" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="异常AD值" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ErrValue}" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding ErrValue}" />
</StackPanel>
</StackPanel>
<Button Style="{StaticResource ButtonStyle2}" FontSize="27" Command="{Binding GetOrgAdCmd}">
<StackPanel>
<TextBlock Text="计算"/>
<TextBlock Text="原始AD值"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="差异比例" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding CrossErrPercent,Converter={StaticResource percentconv}}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%"/>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}" Text="样品1AD/样品0AD&#13;与上一次比较" />
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonStyle2}" FontSize="27" Click="btnGageInfoClick">
<StackPanel>
<TextBlock Text="机架信息"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="差异时间范围" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding ErrIntervalMin}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="min"/>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}" Text="两次时间点比较,&#13;时间点的间隔最大时长。 大于它无效,不能比较" />
</StackPanel>
</Button>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<sys:Double x:Key="column0_width">50</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeader}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column0_width}"/>
</Style>
<Style x:Key="TextBlockStyle_header" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</StackPanel.Resources>
<Border Style="{StaticResource BorderStyle_paramSection}">
<TextBlock Text="样品"/>
</Border>
</StackPanel>
</Border>
<Border Style="{StaticResource Styles.Card.Border}">
<StackPanel>
<StackPanel.Resources>
<CollectionViewSource Source="{Binding Samples}" x:Key="samplesViewSource" />
</StackPanel.Resources>
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="样品"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_header_no}" Text="序号" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="使能" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="不标定" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="原始AD值" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="位置" />
<StackPanel>
<StackPanel.Resources>
<CollectionViewSource Source="{Binding Samples}" x:Key="samplesViewSource" />
<sys:Double x:Key="column0_width">50</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column0_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
<Style x:Key="TextBlockStyle_header" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader.Editable}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</StackPanel.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_header_no}" Text="序号" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="使能" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="不标定" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="原始AD值" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="位置" />
</StackPanel>
<ItemsControl ItemsSource="{Binding Samples}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Visibility="{Binding IsVisible,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<Rectangle Height="2" Fill="Gray"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Width="{StaticResource column0_width}"
Text="{Binding Name}"/>
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" Width="{StaticResource column_width}"
IsChecked="{Binding Enable}" />
<StackPanel Orientation="Horizontal" Visibility="{Binding Enable,Converter={StaticResource visbilityconv}}">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" Width="{StaticResource column_width}"
IsChecked="{Binding JustForCheck}" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Width="{StaticResource column_width}" TextAlignment="Center"
Text="{Binding OrgAD}" />
<Grid Width="{StaticResource column_width}" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Position}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" >
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="Position" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>mm
</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
<ItemsControl ItemsSource="{Binding Source={StaticResource samplesViewSource}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Rectangle Height="2" Fill="Gray"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Width="{StaticResource column0_width}" Margin="0">
<Run Text="{Binding Path=., Mode=OneWay, Converter={StaticResource i2iConv}, ConverterParameter={StaticResource samplesViewSource}}"/>
</TextBlock>
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}" Width="{StaticResource column_width}" Margin="0"/>
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding JustForCheck}" Width="{StaticResource column_width}" Margin="0"/>
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" TextAlignment="Center" Text="{Binding OrgAD}" Width="{StaticResource column_width}" Margin="0"/>
<StackPanel Orientation="Horizontal" >
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Position}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" >
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="Position" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="mm" />
</TextBlock>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
<Border Style="{StaticResource Styles.Card.Border}">
<StackPanel>
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="位置修正"/>
<StackPanel>
<StackPanel Orientation="Horizontal">
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Orientation="Vertical">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="查找范围" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding SearchRange}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}">
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="Search" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>mm
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel>
<StackPanel.Resources>
<sys:Double x:Key="column0_width">100</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column0_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
<Style x:Key="TextBlockStyle_header" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader.Editable}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</StackPanel.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_header_no}" Text="特征" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="使能" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="位置" />
</StackPanel>
<ItemsControl ItemsSource="{Binding Features}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Rectangle Height="2" Fill="Gray"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Width="{StaticResource column0_width}"
Text="{Binding Name}"/>
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" Width="{StaticResource column_width}"
IsChecked="{Binding Enable}" />
<StackPanel Orientation="Horizontal" Visibility="{Binding Enable,Converter={StaticResource visbilityconv}}">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding StartPos}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="-" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding EndPos}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}">
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="StartPos" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>mm-
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="EndPos" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>mm
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Border Style="{StaticResource BorderStyle_paramSection}">
<TextBlock Text="位置修正" />
</Border>
</StackPanel>
</Border>
<Border Style="{StaticResource Styles.Card.Border}">
<StackPanel>
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="采集记录"/>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" Orientation="Vertical">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="查找范围" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Search}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="Search" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="mm" /></TextBlock>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Square2}" Content="获取" Command="{Binding GetTempDataCmd}"/>
</StackPanel>
<StackPanel>
<StackPanel.Resources>
<sys:Double x:Key="column0_width">50</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeader}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column0_width}"/>
</Style>
<Style x:Key="TextBlockStyle_header" TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="{StaticResource column_width}"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
<CollectionViewSource Source="{Binding Features}" x:Key="featuresViewSource" />
</StackPanel.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_header_no}" Text="特征" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="使能" />
<TextBlock Style="{StaticResource TextBlockStyle_header}" Text="位置" />
</StackPanel>
<ItemsControl ItemsSource="{Binding Source={StaticResource featuresViewSource}}">
<StackPanel Orientation="Horizontal">
<ItemsControl ItemsSource="{Binding TempData}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Rectangle Height="2" Fill="Gray"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" FontSize="20" Width="{StaticResource column0_width}" Margin="0" VerticalAlignment="Center">
<Run Text="{Binding Path=., Mode=OneWay, Converter={StaticResource i2dConv},ConverterParameter={StaticResource featuresViewSource}}"/>
</TextBlock>
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}" Width="{StaticResource column_width}" Margin="0"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding StartPos}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="-" />
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding EndPos}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="StartPos" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="mm" />
<Run Text="-" />
<Run>
<MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
<Binding Path="EndPos" />
<Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
</MultiBinding>
</Run>
<Run Text="mm" />
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<DataGrid ItemsSource="{Binding .}" IsReadOnly="True" Margin="{StaticResource ControlMargin}" AutoGenerateColumns="False" Width="400" TextBlock.FontSize="12" TextBlock.FontWeight="Normal"
>
<DataGrid.Columns>
<DataGridTextColumn Header="复位" Binding="{Binding IsReset}" Width="100"/>
<DataGridTextColumn Header="时间" Binding="{Binding Time,StringFormat={}{0:HH:mm:ss}}" FontSize="10" Width="100"/>
<DataGridTextColumn Header="AD" Binding="{Binding Ad}" Width="100"/>
<DataGridTextColumn Header="滤波AD" Binding="{Binding FilterAd}" Width="100"/>
</DataGrid.Columns>
</DataGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<Button Style="{StaticResource Styles.Button.Apply}" VerticalAlignment="Bottom" Margin="0,0,20,-45"
<Button Style="{StaticResource Styles.Button.Apply}" VerticalAlignment="Bottom" Margin="0,0,20,20"
Command="{Binding ApplyCmd}"/>
</Grid>
</Page>
......@@ -19,10 +19,8 @@ namespace FLY.Thick.Base.UI
{
IGetSampleService getSampleService;
IInitParamService initParamService;
IGageInfoService gageInfoService;
IUnityContainer container;
GetSampleVm viewModel;
PgGetSampleVm viewModel;
public PgGetSample()
{
......@@ -30,32 +28,22 @@ namespace FLY.Thick.Base.UI
}
[InjectionMethod]
public void Init(
IUnityContainer container,
IGetSampleService getSampleService,
IInitParamService initParamService,
IGageInfoService gageInfoService)
string infoName = null)
{
this.getSampleService = getSampleService;
this.initParamService = initParamService;
this.gageInfoService = gageInfoService;
this.container = container;
viewModel = new GetSampleVm();
viewModel.Init(getSampleService, gageInfoService);
viewModel = new PgGetSampleVm();
viewModel.Init(getSampleService, infoName);
this.DataContext = viewModel;
this.grid_initparam.DataContext = this.initParamService;
}
private void btnGageInfoClick(object sender, RoutedEventArgs e)
{
Page p = (container.IsRegistered<Page>("pgGageInfo")) ? container.Resolve<Page>("pgGageInfo") : container.Resolve<PgGageInfo>(); ;
//container.BuildUp(p);
NavigationService.Navigate(p);
}
}
public class GetSampleVm : INotifyPropertyChanged
public class PgGetSampleVm : INotifyPropertyChanged
{
#region 参数
......@@ -101,7 +89,7 @@ namespace FLY.Thick.Base.UI
/// <summary>
/// 参数:样品点参数
/// </summary>
public SampleCell[] Samples { get; private set; }
public SampleCellView[] Samples { get; set; }
/// <summary>
/// 参数:特征查找范围
/// </summary>
......@@ -109,67 +97,121 @@ namespace FLY.Thick.Base.UI
/// <summary>
/// 参数:特征参数
/// </summary>
public SampleFeature[] Features { get; private set; }
public SampleFeatureView[] Features { get; set; }
#endregion
#region Command
public RelayCommand ApplyCmd { get; }
public RelayCommand GetOrgAdCmd { get; }
public RelayCommand ApplyCmd { get; private set; }
public RelayCommand GetTempDataCmd { get; private set; }
#endregion
public event PropertyChangedEventHandler PropertyChanged;
public List<List<TempFilterData>> TempData { get; private set; }
public string InfoName { get; set; }
IGetSampleService getSampleService;
IGageInfoService gageInfoService;
ItemsControl tempdatas;
public GetSampleVm()
public PgGetSampleVm()
{
ApplyCmd = new RelayCommand(Apply);
GetTempDataCmd = new RelayCommand(GetTempData);
}
[InjectionMethod]
public void Init(
IGetSampleService getSampleService,
IGageInfoService gageInfoService)
string infoName)
{
InfoName = infoName;
this.getSampleService = getSampleService;
this.gageInfoService = gageInfoService;
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.Enable), this, nameof(Enable));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.SampleRange), this, nameof(SampleRange));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.Window), this, nameof(Window));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.IsCheckByPercent), this, nameof(IsCheckByPercent));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.ErrPercent), this, nameof(ErrPercent));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.ErrValue), this, nameof(ErrValue));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.SearchRange), this, nameof(SearchRange));
Samples = new SampleCell[this.getSampleService.Samples.Count()];
Features = new SampleFeature[this.getSampleService.Features.Count()];
for (int i = 0; i < Samples.Count(); i++)
{
Samples[i] = new SampleCell();
Misc.BindingOperations.SetBinding(this.getSampleService.Samples[i], nameof(SampleCell.Enable), Samples[i], nameof(SampleCell.Enable));
Misc.BindingOperations.SetBinding(this.getSampleService.Samples[i], nameof(SampleCell.JustForCheck), Samples[i], nameof(SampleCell.JustForCheck));
Misc.BindingOperations.SetBinding(this.getSampleService.Samples[i], nameof(SampleCell.OrgAD), Samples[i], nameof(SampleCell.OrgAD));
Misc.BindingOperations.SetBinding(this.getSampleService.Samples[i], nameof(SampleCell.Position), Samples[i], nameof(SampleCell.Position));
}
for (int i = 0; i < Features.Count(); i++)
{
Features[i] = new SampleFeature();
Misc.BindingOperations.SetBinding(this.getSampleService.Features[i], nameof(SampleFeature.Enable), Features[i], nameof(SampleFeature.Enable));
Misc.BindingOperations.SetBinding(this.getSampleService.Features[i], nameof(SampleFeature.StartPos), Features[i], nameof(SampleFeature.StartPos));
Misc.BindingOperations.SetBinding(this.getSampleService.Features[i], nameof(SampleFeature.EndPos), Features[i], nameof(SampleFeature.EndPos));
}
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.CrossErrPercent), this, nameof(CrossErrPercent));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.ErrIntervalMin), this, nameof(ErrIntervalMin));
}
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.SearchRange), this, nameof(SearchRange));
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.Samples), ()=> {
var samples = this.getSampleService.Samples;
if (samples == null)
{
Samples = null;
}
else
{
Samples = new SampleCellView[samples.Count()];
for (int i = 0; i < Samples.Count(); i++)
{
Samples[i] = new SampleCellView() { Name = i.ToString() };
var sampleView = Samples[i];
Misc.BindingOperations.SetBinding(samples[i], nameof(SampleCell.Enable), sampleView, nameof(SampleCellView.Enable));
Misc.BindingOperations.SetBinding(samples[i], nameof(SampleCell.JustForCheck), sampleView, nameof(SampleCellView.JustForCheck));
Misc.BindingOperations.SetBinding(samples[i], nameof(SampleCell.OrgAD), sampleView, nameof(SampleCellView.OrgAD));
Misc.BindingOperations.SetBinding(samples[i], nameof(SampleCell.Position), sampleView, nameof(SampleCellView.Position));
}
updateSampleCellViewVisible();
for (int i = 0; i < Samples.Count(); i++) {
var sampleView = Samples[i];
sampleView.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(SampleCellView.Enable))
{
updateSampleCellViewVisible();
}
};
}
}
});
Misc.BindingOperations.SetBinding(this.getSampleService, nameof(this.getSampleService.Features), () => {
var features = this.getSampleService.Features;
if (features == null)
{
Features = null;
}
else
{
int cnt = Math.Min(features.Count(), 2);
Features = new SampleFeatureView[cnt];
for (int i = 0; i < Features.Count(); i++)
{
Features[i] = new SampleFeatureView();
var featureView = Features[i];
if (i == 0)
featureView.Name = "正向";
else
featureView.Name = "反向";
Misc.BindingOperations.SetBinding(features[i], nameof(SampleFeature.Enable), featureView, nameof(SampleFeatureView.Enable));
Misc.BindingOperations.SetBinding(features[i], nameof(SampleFeature.StartPos), featureView, nameof(SampleFeatureView.StartPos));
Misc.BindingOperations.SetBinding(features[i], nameof(SampleFeature.EndPos), featureView, nameof(SampleFeatureView.EndPos));
}
}
});
}
protected void updateSampleCellViewVisible()
{
if (Samples == null)
return;
for (int i = 0; i < Samples.Count(); i++) {
if (i == 0)
Samples[i].IsVisible = true;
else
{
Samples[i].IsVisible = Samples[i-1].Enable;
}
}
}
private void Apply()
{
if (!WdPassword.Authorize("GetSample"))
......@@ -179,11 +221,12 @@ namespace FLY.Thick.Base.UI
this.getSampleService.Enable = this.Enable;
this.getSampleService.SampleRange = this.SampleRange;
this.getSampleService.Velocity = this.Velocity;
this.getSampleService.Window = this.Window;
this.getSampleService.IsCheckByPercent = this.IsCheckByPercent;
this.getSampleService.ErrPercent = this.ErrPercent;
this.getSampleService.ErrValue = this.ErrValue;
this.getSampleService.CrossErrPercent = this.CrossErrPercent;
this.getSampleService.ErrIntervalMin = this.ErrIntervalMin;
for (int i = 0; i < Samples.Count(); i++)
{
......@@ -213,20 +256,32 @@ namespace FLY.Thick.Base.UI
TimeSpan.FromSeconds(2));
}
private void GetTempData()
{
getSampleService.GetTempFilterDatas((asyncContext, retData) =>
{
var ll = retData as List<List<TempFilterData>>;
TempData = ll;
FLY.ControlLibrary.Window_Tip.Show("加载完成",
$"共加载{ll.Count()}列数据",
TimeSpan.FromSeconds(2));
}, null);
}
}
public class GetSampleVmUt : INotifyPropertyChanged
public class PgGetSampleVmUt : PgGetSampleVm
{
public GetSampleVmUt()
public PgGetSampleVmUt()
{
Samples = new SampleCell[3];
Samples = new SampleCellView[3];
for (int i = 0; i < Samples.Count(); i++)
{
SampleCell sampleCell = new SampleCell();
SampleCellView sampleCell = new SampleCellView() { Name = i.ToString() };
Samples[i] = sampleCell;
}
Features = new SampleFeature[2];
Features[0] = new SampleFeature();
Features[1] = new SampleFeature();
Features = new SampleFeatureView[2];
Features[0] = new SampleFeatureView() { Name = "正向" };
Features[1] = new SampleFeatureView() { Name = "反向" };
Enable = true;
......@@ -234,138 +289,87 @@ namespace FLY.Thick.Base.UI
Features[0].Enable = true;
updateSampleCellViewVisible();
}
}
#region IGetSampleService 成员
/// <summary>
/// 样品点
/// </summary>
public class SampleCellView : INotifyPropertyChanged
{
/// <summary>
/// 参数:使能
/// 序号
/// </summary>
public bool Enable { get; set; }
public string Name { get; set; }
/// <summary>
/// 参数:速度
/// 显示出来
/// </summary>
public UInt32 Velocity { get; set; }
public bool IsVisible { get; set; }
/// <summary>
/// 参数:样品点范围
/// 参数:使能
/// </summary>
public int Range { get; set; }
public bool Enable { get; set; }
/// <summary>
/// 参数:移动滤波 ,窗口值
/// 参数:只检查不标定
/// </summary>
public int Window { get; set; }
public bool JustForCheck { get; set; }
/// <summary>
/// 使用%方式检查异常
/// </summary>
public bool IsCheckByPercent { get; set; }
/// <summary>
/// 异常%
/// 参数:原始AD值
/// </summary>
public double ErrPercent { get; set; }
/// <summary>
/// 异常值
/// </summary>
public int ErrValue { get; set; }
/// <summary>
/// 参数:样品点参数
/// </summary>
public SampleCell[] Samples { get; }
/// <summary>
/// 参数:特征查找范围
/// </summary>
public int Search { get; set; }
/// <summary>
/// 参数:特征参数
/// </summary>
public SampleFeature[] Features { get; }
public int OrgAD { get; set; }
/// <summary>
/// 状态:从flyad7 得到的。 用于绘制图
/// 参数:位置
/// </summary>
public int PosOfGrid { get; set; } = 10;
public int Position { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
/// <summary>
/// 列表转序号
/// 样品正向校正特征
/// </summary>
[ValueConversion(typeof(object), typeof(int))]
public class Item2IndexConverter : IValueConverter
public class SampleFeatureView : INotifyPropertyChanged
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
/// <summary>
/// 序号
/// </summary>
public string Name { get; set; }
int result = -1;
if (value != null)
{
/// <summary>
/// 参数:使能
/// </summary>
public bool Enable { get; set; }
var collectionViewSource = parameter as CollectionViewSource;
if (collectionViewSource != null)
{
var cv = (CollectionView)collectionViewSource.View;
//在 设计模式中, View为null, 所以下面必须判断
if (cv != null)
{
result = cv.IndexOf(value);
}
}
}
return result >= 0 ? result : System.Windows.DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
/// <summary>
/// 参数:开始位置
/// </summary>
public int StartPos { get; set; }
/// <summary>
/// 列表转序号
/// </summary>
[ValueConversion(typeof(object), typeof(string))]
public class Item2DirectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
var collectionViewSource = parameter as CollectionViewSource;
if (collectionViewSource != null)
{
var cv = (CollectionView)collectionViewSource.View;
//在 设计模式中, View为null, 所以下面必须判断
if (cv != null)
{
switch (cv.IndexOf(value))
{
case 0:
return "正向";
case 1:
return "反向";
/// <summary>
/// 参数:结束位置
/// </summary>
public int EndPos { get; set; }
}
}
}
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
}
using FLY.Thick.Base.IService;
using FObjBase;
using FObjBase.Reflect;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FLY.Thick.Base.Client
......@@ -90,6 +93,12 @@ namespace FLY.Thick.Base.Client
{
Call(nameof(Apply));
}
[Call(typeof(List<List<TempFilterData>>))]
public void GetTempFilterDatas(AsyncCBHandler asyncDelegate, object asyncContext)
{
Call(nameof(GetTempFilterDatas),null, asyncDelegate,asyncContext);
}
#endregion
}
......
......@@ -90,6 +90,9 @@ namespace FLY.Thick.Base.IService
/// 应用
/// </summary>
void Apply();
[Call(typeof(List<List<TempFilterData>>))]
void GetTempFilterDatas(AsyncCBHandler asyncDelegate, object asyncContext);
}
......
......@@ -707,17 +707,15 @@ _end:
/// </summary>
/// <param name="asyncCB"></param>
/// <param name="asyncContext"></param>
public void GetTempFilterDatas(AsyncCBHandler asyncCB, object asyncContext)
public void GetTempFilterDatas(AsyncCBHandler asyncDelegate, object asyncContext)
{
List<List<TempFilterData>> ret = new List<List<TempFilterData>>();
for (int i = 0; i < Samples.Count(); i++) {
SampleCell sample = Samples[i];
if (sample.Enable)
ret.Add(tempFilters[i].GetDatas());
else
ret.Add(null);
}
asyncCB(asyncContext, ret);
asyncDelegate(asyncContext, ret);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment