UC_SelectData.xaml 12.6 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1
<UserControl x:Class="FLY.HeatingHelper.UI.UiModule.UC_SelectData.UC_SelectData"
2 3 4 5
             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" 
潘栩锋's avatar
潘栩锋 committed
6
             xmlns:local="clr-namespace:FLY.HeatingHelper.UI.UiModule.UC_SelectData"
7 8
             xmlns:az="clr-namespace:Chart_AlarmZones_WPF_CS"
             xmlns:c1c="clr-namespace:C1.WPF.C1Chart;assembly=C1.WPF.C1Chart.4.5.2"
9 10 11
             xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" 
540597360@qq.com's avatar
540597360@qq.com committed
12
             d:DesignHeight="450" d:DesignWidth="800" Background="WhiteSmoke" x:Name="uc1" Loaded="uc1_Loaded">
13
    <UserControl.Resources>
14 15
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
16 17 18
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
19
                <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />-->
20 21
                 <!--accent resource 
                 change "Cobalt" to the accent color you want--> 
22
                <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cobalt.xaml" />-->
23 24 25
                 <!--theme resource 
                 change "BaseLight" to the theme you want--> 
                <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />-->
26
            </ResourceDictionary.MergedDictionaries>
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
            <Style TargetType="{x:Type Button}" >
                <Setter Property="Background" Value="#cc119eda"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="SnapsToDevicePixels" Value="False"/>
                <Setter Property="FontSize" Value="15" />
                <Setter Property="Height" Value="33" />
                <Setter Property="Width" Value="80" />
                <Setter Property="Margin" Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Grid>
                                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}"  Background="{TemplateBinding Background}"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" CornerRadius="5"/>
                                <ContentPresenter   Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"  />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" TargetName="Border" Value="#66119eda"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Background" TargetName="Border" Value="#ff444444"/>
                                    <Setter Property="Foreground" Value="#ffffffff" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Opacity"  Value="0.3"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="Label" >
                <Setter Property="FontSize" Value="20" />
                <Setter Property="Margin" Value="0,5" />
            </Style>
            <Style TargetType="StackPanel">
                <Setter Property="Width" Value="250" />
                <Setter Property="Margin" Value="10,0" />
            </Style>
66
        </ResourceDictionary>
67
    </UserControl.Resources>
68 69 70
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
71 72
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
73 74 75 76 77
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
78 79
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
80
            </Grid.ColumnDefinitions>
81 82
            <StackPanel Orientation="Vertical" Grid.Column="0" >
                <Label x:Uid="123" Content="数据范围:"  />
83
                <Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="False"  MinWidth="180"
84
                                         SelectedDateTime="{Binding Dat.TotalDataFrom, Mode=OneWay}"
85
                                         Margin="0,0,0,5" 
86 87
                                         IsEnabled="False">
                </Controls:DateTimePicker>
88
                <Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="False"  MinWidth="180"
89
                                         SelectedDateTime="{Binding Path=Dat.TotalDataTo, Mode=OneWay}"
90 91 92 93
                                         Margin="0,1,0,0" IsEnabled="False">

                </Controls:DateTimePicker>
            </StackPanel>
94 95
            <StackPanel Orientation="Vertical" Grid.Column="1" >
                <Label Content="加载数据范围:"   />
96
                <Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="False"  MinWidth="180"
97
                                         SelectedDateTime="{Binding Path=Dat.LoadDataFrom}"
98
                                         Margin="0,0,0,5">
99 100

                </Controls:DateTimePicker>
101
                <Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="False"  MinWidth="180"
102 103
                                         SelectedDateTime="{Binding Path=Dat.LoadDataTo}"
                                         Name="dtp4"
104
                                         Margin="0,1,0,0">
105 106 107 108

                </Controls:DateTimePicker>

            </StackPanel>
109
            <StackPanel Orientation="Vertical" Grid.Column="2">
潘栩锋's avatar
潘栩锋 committed
110 111
                <Controls:ToggleSwitch Content="过滤加热重复项" Margin="30,10" IsOn="{Binding Path=Dat.IsDataFilter}"   Style="{StaticResource MahApps.Styles.ToggleSwitch}" FontSize="15"/>
                <Controls:ToggleSwitch Content="过滤不稳定数据" Margin="30,10" IsOn="{Binding Path=Dat.IsFilterUnstable}"   Style="{StaticResource MahApps.Styles.ToggleSwitch}" FontSize="15"/>
112
                <Button Content="缺省数据范围"  Width="180"
113
                        Command="{Binding DefaultLoadDataRange}"/>
114
                <Button Content="加载数据"   Width="180"
115 116
                        Command="{Binding ReloadData}"/>
            </StackPanel>
117 118 119
            <StackPanel Orientation="Vertical" Grid.Column="3" >
                <Label Content="加载数据数量:"  />
                <TextBox Controls:TextBoxHelper.Watermark="Watermark" Margin="0,5"  FontSize="20"
120
                         Text="{Binding RecordCount, Mode=OneWay}"
121 122 123 124 125 126 127 128 129
                         IsEnabled="False" />
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
130
                <ColumnDefinition Width="auto"/>
131
            </Grid.ColumnDefinitions>
132 133
            <StackPanel Orientation="Vertical" Grid.Column="0" Margin="0,0,5,0" Style="{x:Null}">
                <StackPanel Orientation="Horizontal" Style="{x:Null}">
540597360@qq.com's avatar
540597360@qq.com committed
134
                    <Label Content="分析数据范围:"/>
135
                    <TextBlock Margin="25,10,0,0" FontSize="20">
540597360@qq.com's avatar
540597360@qq.com committed
136 137 138 139 140 141 142
                        <TextBlock.Text>
                            <MultiBinding StringFormat="{}({0:MM/dd HH:mm:ss})-({1:MM/dd HH:mm:ss})">
                                <Binding Path="AnalystDataFrom" />
                                <Binding Path="AnalystDataTo" />
                            </MultiBinding>
                        </TextBlock.Text>
                    </TextBlock>
143
                    <TextBlock Margin="25,10,0,0" FontSize="20">
540597360@qq.com's avatar
540597360@qq.com committed
144 145 146 147 148 149 150 151
                        <TextBlock.Text>
                            <MultiBinding StringFormat="{}({0})-({1})">
                                <Binding Path="Dat.AnalystIndexFrom" />
                                <Binding Path="Dat.AnalystIndexTo" />
                            </MultiBinding>
                        </TextBlock.Text>
                    </TextBlock>
                </StackPanel>
冯伟球's avatar
冯伟球 committed
152
                <Controls:RangeSlider Minimum="0" Margin="20,0"
153
                                      Maximum="{Binding RecordCount, Mode=OneWay}"
154 155
                                      LowerValue="{Binding Dat.AnalystIndexFrom}"
                                      UpperValue="{Binding Dat.AnalystIndexTo}"
潘栩锋's avatar
潘栩锋 committed
156
                                      Style="{StaticResource MahApps.Styles.RangeSlider.Win10}">
157

158 159
                </Controls:RangeSlider>
            </StackPanel>
160
            <Button Content="前一项" 
161
                    Grid.Column="1" MinWidth="80" Margin="5"
162
                    Command="{Binding PreData}"/>
163
            <Button Content="后一项" 
164
                    Grid.Column="2" MinWidth="80" Margin="5"
165
                    Command="{Binding NextData}"/>
166
            <Button Content="缺省项" 
167
                    Grid.Column="3" MinWidth="80" Margin="5"
168
                    Command="{Binding DefaultAnalystData}"/>
169
            <Button Content="test" Click="Button_Click" Grid.Column="4"  
170
                    Command="{Binding Test}" Margin="5" MinWidth="80"
171
                    />
172
        </Grid>
173
        <Border Grid.Row="2" Margin="2,5,2,2">
174 175
            <c1c:C1Chart Name="c1chart" ChartType="columnstacked" 
                         Margin="5,0,0,0" FontSize="12" Loaded="C1chart_Loaded">
176 177
                <c1c:C1Chart.Data>
                    <c1c:ChartData>
178 179 180
                        <c1c:DataSeries ValuesSource="{Binding DS_2sigma}" RenderMode="Default" PlotElementLoaded="DataSeries_PlotElementLoaded"/>
                        <c1c:DataSeries ValuesSource="{Binding DS_2sigmaN}" RenderMode="Default" PlotElementLoaded="DataSeries_PlotElementLoaded"/>
                        <az:AlarmZone Near="{Binding Dat.AnalystIndexFrom}" AxisY="ay1" 
540597360@qq.com's avatar
540597360@qq.com committed
181 182 183 184
                                      Far="{Binding Dat.AnalystIndexTo}" 
                                      LowExtent="-1"
                                      UpperExtent="11"
                                      ConnectionFill="AliceBlue"/>
185
                        <c1c:DataSeries ValuesSource="{Binding DS_thick}" AxisY="ay0" Label="厚度" ChartType="line"/>
186 187 188 189
                    </c1c:ChartData>
                </c1c:C1Chart.Data>
                <c1c:C1Chart.View>
                    <c1c:ChartView>
190 191 192 193 194 195 196 197
                        <c1c:ChartView.PlotAreaRowDefinitions>
                            <c1c:PlotAreaRowDefinition Height="*"/>
                            <c1c:PlotAreaRowDefinition Height="*"/>
                        </c1c:ChartView.PlotAreaRowDefinitions>
                        <c1c:ChartView.PlotAreas>
                            <c1c:PlotArea/>
                            <c1c:PlotArea Row="1"/>
                        </c1c:ChartView.PlotAreas>
198
                        <c1c:ChartView.AxisY>
199 200 201
                            <c1c:Axis Title="2Sigma" Position="Near"
                                  Min="-0.09" Max="0.09" PlotAreaIndex="0" MajorGridStroke="Blue"
                                  MajorUnit="0.03"/>
202
                        </c1c:ChartView.AxisY>
540597360@qq.com's avatar
540597360@qq.com committed
203
                        <c1c:ChartView.AxisX>
204
                            <c1c:Axis Max="{Binding RecordCount, Mode=OneWay}" Min="0"/>
540597360@qq.com's avatar
540597360@qq.com committed
205
                        </c1c:ChartView.AxisX>
540597360@qq.com's avatar
540597360@qq.com committed
206
                        <c1c:Axis Name="ay0" AxisType="Y" Title="厚度" Position="Near" 
207 208
                                  PlotAreaIndex="1"/>
                        <c1c:Axis Visible="False" Min="0" Max="10" PlotAreaIndex="1" Name="ay1"/>
209 210 211 212
                    </c1c:ChartView>
                </c1c:C1Chart.View>
            </c1c:C1Chart>
        </Border>
213 214
    </Grid>
</UserControl>