DynAreaWinder.xaml 9.17 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1
<UserControl x:Class="FLY.Winder.UI.Client.UiModule.DynAreaWinder"
潘栩锋's avatar
潘栩锋 committed
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.Winder.UI.Client.UiModule"
潘栩锋's avatar
潘栩锋 committed
7 8 9
      xmlns:conv="clr-namespace:FLY.Winder.UI.Client.Converter"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"  
      mc:Ignorable="d" 
潘栩锋's avatar
潘栩锋 committed
10 11
      d:DesignWidth="292">
    <UserControl.Resources>
潘栩锋's avatar
潘栩锋 committed
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
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Winder.UI.Client;component/UnitTests/UnitTests_winder.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Winder.UI.Client;component/Themes/Dictionary_MyStyle.xaml"/>

            </ResourceDictionary.MergedDictionaries>

            <sys:Double x:Key="FontSize_title">18</sys:Double>
            <sys:Double x:Key="FontSize_unit">12</sys:Double>
            

            <Style TargetType="{x:Type Path}" x:Key="PathStyle_icon">
                <Setter Property="Fill" Value="White"/>
                <Setter Property="Stretch" Value="Uniform"/>
                <Setter Property="Width" Value="30"/>
                <Setter Property="Height" Value="30"/>
                <Setter Property="SnapsToDevicePixels" Value="True"/>
            </Style>

            <local:DynAreaViewModelParams x:Key="unitests_props" IsError="False" Error="报警MSG"/>
            <conv:IsGTMultiValueConverter x:Key="isgtconv"/>
            <conv:RatioConverter x:Key="ratioconv" />
        </ResourceDictionary>
潘栩锋's avatar
潘栩锋 committed
37
    </UserControl.Resources>
潘栩锋's avatar
潘栩锋 committed
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
    
    <Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="Button_Click">
        <Grid>
            <Grid x:Name="grid_winder" d:DataContext="{StaticResource unittests_windersystem}"/>
            <Grid x:Name="grid_error" d:DataContext="{StaticResource unitests_props}"/>

            <Border Style="{StaticResource BorderStyle_module}" 
                    DataContext="{Binding DataContext,ElementName=grid_winder}">
                <StackPanel Orientation="Vertical" >
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="速度"  Margin="4" FontSize="{StaticResource FontSize_title}"/>

                        <Viewbox Grid.Column="1" Grid.Row="1"  MaxHeight="80" HorizontalAlignment="Left">
                            <StackPanel Orientation="Horizontal">

                                <TextBlock Margin="4" >
                                    <Run Text="{Binding Accessory.Velocity,StringFormat={}{0:F1}}"  FontSize="60" />
                                </TextBlock>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m/min" FontSize="20" />
                            </StackPanel>
                        </Viewbox>

                    </Grid>
                    <Grid Margin="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid Margin="2" Name="grid1" DataContext="{Binding Items[0]}" Background="{StaticResource Color_theme_static}">

                            <Rectangle HorizontalAlignment="Left" Fill="{StaticResource Color_theme_activity}">
                                <Rectangle.Width>
                                    <MultiBinding Converter="{StaticResource ratioconv}" Mode="OneWay">
                                        <Binding Path="MeasureLen" />
                                        <Binding Path="MeasureLenSet" />
                                        <Binding Path="ActualWidth" ElementName="grid1"/>
                                    </MultiBinding>
                                </Rectangle.Width>
                            </Rectangle>
                            <StackPanel Orientation="Horizontal" >
                                <TextBlock Text="内收卷" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" Foreground="LightGray" Margin="2" />
                                <Viewbox Margin="5,0" MaxWidth="80" MaxHeight="26">
                                    <StackPanel Orientation="Horizontal" >
                                        <TextBlock Text="{Binding MeasureLen, StringFormat={}{0:F0}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" />
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m" FontSize="12" Foreground="LightGray"/>
                                    </StackPanel>
                                </Viewbox>
                            </StackPanel>
                        </Grid>

                        <Grid Margin="2" Grid.Column="1" DataContext="{Binding Items[1]}" Background="{StaticResource Color_theme_static}">
                            <Rectangle HorizontalAlignment="Left" Fill="{StaticResource Color_theme_activity}">
                                <Rectangle.Width>
                                    <MultiBinding Converter="{StaticResource ratioconv}" Mode="OneWay">
                                        <Binding Path="MeasureLen" />
                                        <Binding Path="MeasureLenSet" />
                                        <Binding Path="ActualWidth" ElementName="grid1"/>
                                    </MultiBinding>
                                </Rectangle.Width>
                            </Rectangle>
                            <StackPanel Orientation="Horizontal" >
103
                                <TextBlock Text=" 外收卷" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" Foreground="LightGray" Margin="2" />
潘栩锋's avatar
潘栩锋 committed
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
                                <Viewbox Margin="5,0" MaxWidth="80" MaxHeight="26">
                                    <StackPanel Orientation="Horizontal" >
                                        <TextBlock Text="{Binding MeasureLen, StringFormat={}{0:F0}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" />
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m" FontSize="12" Foreground="LightGray"/>
                                    </StackPanel>
                                </Viewbox>
                            </StackPanel>
                        </Grid>
                    </Grid>
                </StackPanel>
            </Border>

            <Border Style="{StaticResource BorderStyle_module}" Background="Red" 
                    DataContext="{Binding DataContext,ElementName=grid_error}"
                    Visibility="{Binding IsError,Converter={StaticResource visbilityconv}}">
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Path Margin="5" Fill="White" Stretch="Uniform" Width="60" Height="60" SnapsToDevicePixels="True" Data="{StaticResource Geometry_alert-circle-outline}"  >
                        <Path.Style>
                            <Style TargetType="Path">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsError}" Value="True">
                                        <DataTrigger.EnterActions>
                                            <BeginStoryboard>
                                                <Storyboard RepeatBehavior="Forever" >
                                                    <DoubleAnimation BeginTime="0:0:0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:01" />
                                                    <DoubleAnimation BeginTime="0:0:1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:01" />
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </DataTrigger.EnterActions>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Path.Style>
                    </Path>
                    <TextBlock Grid.Column="1" Margin="5" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="30" Foreground="White" Text="{Binding Error}"/>
                </Grid>

            </Border>

        </Grid>
    </Button>
潘栩锋's avatar
潘栩锋 committed
149
</UserControl>