FixGraph.xaml 15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
<UserControl x:Class="FLY.Thick.BlowingScan.UI.Client.UIModule.FixGraph"
             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:FLY.Thick.BlowingScan.UI.Client.UIModule"
             xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             
             mc:Ignorable="d" 
             
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <SolidColorBrush x:Key="TextBrush" Color="#4C4949" />
            <SolidColorBrush x:Key="GrayBrush1" Color="#FF727272"/>
            <SolidColorBrush x:Key="GrayBrush2" Color="#FF858484" />
            <SolidColorBrush x:Key="SemiTransparentGreyBrush" Color="#30909090"/>
            <SolidColorBrush x:Key="SemiTransparentActiveBrush" Color="#50008BE5"/>
            <SolidColorBrush x:Key="WhiteBrush" Color="White"/>
            <Style x:Key="TitleStyle" TargetType="TextBlock">
                <Setter Property="Width" Value="50"/>
                <Setter Property="Foreground" Value="{DynamicResource GrayBrush1}"/>
                <Setter Property="FontSize" Value="16"/>
                <Setter Property="TextAlignment" Value="Right"/>
            </Style>
            <Style x:Key="ValueStyle" TargetType="TextBlock">
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
                <Setter Property="FontSize" Value="20"/>
                <Setter Property="Padding" Value="5,0"/>
            </Style>
            <Style x:Key="UnitStyle" TargetType="TextBlock">
                <Setter Property="Foreground" Value="{DynamicResource GrayBrush2}"/>
                <Setter Property="FontSize" Value="15"/>
                <Setter Property="VerticalAlignment" Value="Bottom"/>
            </Style>
            <local:FixGraphViewModel_UnitTest x:Key="viewModel" Max="65540" Min="655" Average="123" Sigma3="3.2"/>
        </ResourceDictionary>
    </UserControl.Resources>
    <Border Style="{StaticResource BorderStyle_module}" >
        <Grid d:DataContext="{StaticResource viewModel}">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="453"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <lvc:CartesianChart Grid.Row="1" Grid.ColumnSpan="2" Margin="5,-5,2,2"
                                Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" >
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries 
                        Values="{Binding Values}"
                        StrokeThickness = "3"
                        Stroke = "{StaticResource Color_theme_static}"
                        Fill = "Transparent"
                        PointGeometry ="{x:Null}"/>
                </lvc:CartesianChart.Series>
                <lvc:CartesianChart.AxisX>
                    <lvc:Axis LabelFormatter="{Binding XFormatter}" FontSize="16" 
                          MaxValue="{Binding XMax}" MinValue="{Binding XMin}">
                        <lvc:Axis.Separator>
                            <lvc:Separator Stroke="LightGray"/>
                        </lvc:Axis.Separator>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisX>
                <lvc:CartesianChart.AxisY>
                    <lvc:Axis LabelFormatter="{Binding YFormatter}" MaxValue="{Binding YMax}" MinValue="{Binding YMin}" Panel.ZIndex="0">
                        <lvc:Axis.Separator>
                            <lvc:Separator StrokeThickness="1" Stroke="LightGray" />
                        </lvc:Axis.Separator>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisY >
            </lvc:CartesianChart>
            <Viewbox >
                <StackPanel Orientation="Horizontal" Margin="5">
                    <Button Width="40" Height="40" VerticalAlignment="Top" Style="{StaticResource ButtonStyle_empty}" 
                        Click="Button_info_click" Margin="5">
                        <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                            <Ellipse Fill="{StaticResource Color_theme_activity}"/>
                            <Path Width="20" Height="20" Stretch="Uniform" Fill="White" Data="{StaticResource geometry_i}"/>
                        </Grid>
                    </Button>
                    <Grid Grid.Column="1" Margin="10,0" >
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock FontSize="24" Foreground="{StaticResource Color_theme_activity}" Text="定点图"/>
                                <StackPanel Orientation="Horizontal" Visibility="{Binding IsADMode,Converter={StaticResource visbilityconv}}">
                                    <TextBlock FontSize="16" Margin="3,0" Width="auto" Text="AD值"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Margin="5">
                                    <TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Time,StringFormat={}{0:HH:mm:ss}}"/>

                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <StackPanel Orientation="Horizontal" Margin="5,0">
                                    <TextBlock Style="{StaticResource TitleStyle}" Text="间隔:" />
                                    <TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Intervalms}"/>
                                    <TextBlock Style="{StaticResource UnitStyle}" Text="ms" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="5,0">
                                    <TextBlock Style="{StaticResource TitleStyle}" Text="混合:" />
                                    <TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Mix}"/>
                                </StackPanel>

                            </StackPanel>
                        </StackPanel>
                    </Grid>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,10">
                        <StackPanel.Resources>
                            <Style TargetType="{x:Type Path}" x:Key="PathStyle_icon">
                                <Setter Property="Fill" Value="{StaticResource Color_theme_activity}"/>
                                <Setter Property="Stretch" Value="Uniform"/>
                                <Setter Property="Width" Value="40"/>
                                <Setter Property="Height" Value="40"/>
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
                            </Style>
                        </StackPanel.Resources>
                        <Button Click="button_pause_Click" Style="{StaticResource ButtonStyle_empty}" Margin="5,0">
                            <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                                <Rectangle Fill="{StaticResource Color_theme_activity}" Width="40" Height="40"/>
                                <Path Fill="White" Stretch="Uniform" Width="20" Height="20">
                                    <Path.Style>
                                        <Style TargetType="Path" >
                                            <Setter Property="Data" Value="{StaticResource Geometry_stop}"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsPaused}" Value="True">
                                                    <Setter Property="Data" Value="{StaticResource Geometry_play}"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Path.Style>
                                </Path>
                            </Grid>
                        </Button>
                        <Button Click="button_save_Click" Style="{StaticResource ButtonStyle_empty}" Margin="5,0" IsEnabled="{Binding IsPaused}">
                            <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                                <Rectangle  Width="40" Height="40">
                                    <Rectangle.Style>

                                        <Style TargetType="Rectangle" >
                                            <Setter Property="Fill" Value="{StaticResource Color_theme_activity}"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsPaused}" Value="false">
                                                    <Setter Property="Fill" Value="{StaticResource Color_theme_noact}"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Rectangle.Style>
                                </Rectangle>
                                <Path Data="{StaticResource Geometry_floppy}" Fill="White" Stretch="Uniform" Width="20" Height="20"/>
                            </Grid>
                        </Button>
                        <Button Click="button_analyze_Click" Style="{StaticResource ButtonStyle_empty}" Margin="5,0" IsEnabled="{Binding IsPaused}">
                            <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                                <Rectangle Width="40" Height="40">
                                    <Rectangle.Style>
                                        <Style TargetType="Rectangle" >
                                            <Setter Property="Fill" Value="{StaticResource Color_theme_activity}"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsPaused}" Value="False">
                                                    <Setter Property="Fill" Value="{StaticResource Color_theme_noact}"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Rectangle.Style>
                                </Rectangle>
                                <Path Data="{StaticResource Geometry_chart-line}" Fill="White" Stretch="Uniform" Width="20" Height="20"/>
                            </Grid>
                        </Button>
                    </StackPanel>
                </StackPanel>
            </Viewbox>

            <Grid Grid.Column="1" Grid.RowSpan="2" Margin="10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Panel.ZIndex="1" 
                  Background="{StaticResource SemiTransparentGreyBrush}" >
                <WrapPanel Orientation="Horizontal" Margin="10">
                    <WrapPanel.Resources>
                        <Style TargetType="Viewbox">
                            <Setter Property="Height" Value="25"/>
                            <Setter Property="Width" Value="130"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                        </Style>
                    </WrapPanel.Resources>
                    <StackPanel>
                        <Viewbox >
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource TitleStyle}" Text="最大: "/>
                                <TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Max,StringFormat={}{0:F1}}"/>
                            </StackPanel>
                        </Viewbox>
                        <Viewbox >
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource TitleStyle}" Text="最小: "/>
                                <TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Min,StringFormat={}{0:F1}}"/>
                            </StackPanel>
                        </Viewbox>
                    </StackPanel>
                    <StackPanel >
                        <Viewbox >
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource TitleStyle}" 
                                           Foreground="{DynamicResource WhiteBrush}"
                                           Background="{DynamicResource TextBrush}"
                                           Opacity="0.8"
                                           Text="平均: "
                                           />
                                <TextBlock Style="{StaticResource ValueStyle}" 
                                           Foreground="{DynamicResource WhiteBrush}"
                                           Background="{DynamicResource TextBrush}"
                                           Text="{Binding Average,StringFormat={}{0:F1}}" 
                                           />
                            </StackPanel>
                        </Viewbox>
                        <Viewbox>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource TitleStyle}" 
                                           Foreground="Black"
                                           Background="{DynamicResource WhiteBrush}" 
                                           Opacity="0.8"
                                           Text="3σ: " 
                                           />
                                <TextBlock Style="{StaticResource ValueStyle}" 
                                           Foreground="{DynamicResource TextBrush}"
                                           Background="{DynamicResource WhiteBrush}"
                                           Text="{Binding Sigma3,StringFormat={}{0:F1}}"  
                                           />
                            </StackPanel>
                        </Viewbox>
                    </StackPanel>
                </WrapPanel>
            </Grid>

        </Grid>
    </Border>

</UserControl>