wenxiangchao
4 天以前 2e889843b4c171f2d6ad8e0d53084040703d11f6
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
<UserControl x:Class="Plugin.CurrentSensorControl.SingleSensor"
             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:Plugin.CurrentSensorControl"
             mc:Ignorable="d" 
            xmlns:hb="clr-namespace:HMI.Base;assembly=HMI.Base"
            xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
            xmlns:ui="clr-namespace:HMI.UI;assembly=HMI.UI"
            xmlns:mdi="clr-namespace:HMI.UI.MDI;assembly=HMI.UI"
            xmlns:pw="https://opensource.panuon.com/wpf"
            xmlns:pu="https://opensource.panuon.com/wpf-ui"
            xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
             Background="#FFF"
             Padding="5"
             Width="Auto"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <pu:StyleDictionary Includes="TabControl" />
                <ResourceDictionary Source="/HMI.UI;component/Style/PanuonListView.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <Style TargetType="TextBox" x:Key="labelText">
                <Setter Property="Height" Value="35"/>
                <Setter Property="FontSize" Value="20"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Width" Value="120"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
 
    <GroupBox Header="{x:Null}" Padding="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="12"/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" dp:StackPanelHelper.ChildSpace="5">
                <!--<TextBox IsReadOnly="True" Text="{Binding SensorName}" Style="{StaticResource labelText}">
                    <TextBox.ToolTip>
                        <ToolTip Padding="5" BorderThickness="1" BorderBrush="Black" Background="Yellow" Content="1231231"/>
                    </TextBox.ToolTip>
                </TextBox>-->
 
                <ui:ScrollLabel Width="80" Value="{Binding SensorName}"/>
                <ui:LightBall Size="30" Value="{Binding IsConnected}"/>
                <Button x:Name="controlBtn" Click="controlBtn_Click">
                    <Button.Style>
                        <Style TargetType="Button" BasedOn="{StaticResource ResetBtn}">
                            <Setter Property="Content" Value="连接"/>
                            <Setter Property="Background" Value="{DynamicResource GreenVerBar}"/>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsConnected}" Value="True">
                                    <Setter Property="Background" Value="{DynamicResource DangerVerBar}"/>
                                    <Setter Property="Content" Value="断开"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>
            </StackPanel>
            <pu:FormGroup Grid.Row="1" Header="电流(A)" Style="{StaticResource InputFormGroupStyle}">
                <TextBox IsReadOnly="True" Text="{Binding Current}" Style="{StaticResource EditorTextBoxStyle}"/>
            </pu:FormGroup>
            <Label Grid.Row="2" Foreground="Red" Padding="0" FontSize="10" Content="{Binding ErrMsg}"/>
        </Grid>
    </GroupBox>
</UserControl>