WinEquipment.xaml 9.75 KB
<win:MyWindow
    xmlns:win="clr-namespace:HHECS.View.Win" x:Class="HHECS.View.EquipmentInfo.WinEquipment"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HHECS.View.EquipmentInfo"
    xmlns:control="clr-namespace:HHECS.Controls"
    mc:Ignorable="d"
        Title="设备管理" Height="450" Width="800">
    <Window.Resources>
        <Style TargetType="StackPanel" >
            <Setter Property="Orientation" Value="Horizontal"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="10,0,0,0"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>
        <Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle}">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Width" Value="100"/>
        </Style>
    </Window.Resources>
    <Grid>
        <TabControl>
            <TabItem x:Name="TIMain" Header="设备">
                <Grid x:Name="GridMain">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"></RowDefinition>
                        <RowDefinition Height="50"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Border  Grid.Row="0" CornerRadius="6" Background="AliceBlue">
                        <WrapPanel>
                            <StackPanel>
                                <TextBlock>设备编码:</TextBlock>
                                <TextBox x:Name="TxtCode"></TextBox>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock>设备名:</TextBlock>
                                <TextBox x:Name="TxtName"></TextBox>
                            </StackPanel>
                        </WrapPanel>
                    </Border>

                    <StackPanel Grid.Row="1" HorizontalAlignment="Right">
                        <Button x:Name="BtnQuery" Click="BtnQuery_Click">查询</Button>
                        <Button x:Name="BtnViewDetail" Click="BtnViewDetail_Click">查看详细</Button>
                        <Button x:Name="BtnAdd" Click="BtnAdd_Click">新增设备</Button>
                        <Button x:Name="BtnEdit" Click="BtnEdit_Click">编辑设备</Button>
                        <Button x:Name="BtnDelete" Click="BtnDelete_Click">删除设备</Button>
                    </StackPanel>
                    <DockPanel Grid.Row="2">
                        <control:DataPager x:Name="page" DockPanel.Dock="Bottom" PageIndex="{Binding PageIndex}" PageSize="{Binding PageSize}" TotalCount="{Binding TotalCount}"
                                   PageChanged="page_PageChanged"></control:DataPager>
                        <DataGrid x:Name="DGMain" >
                            <DataGrid.RowStyle>
                                <Style TargetType="{x:Type DataGridRow}">
                                    <EventSetter Event="MouseDoubleClick" Handler="DataGridRow_MouseDoubleClick"/>
                                </Style>
                            </DataGrid.RowStyle>
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Id" Binding="{Binding Id}"/>
                                <DataGridTextColumn Header="设备编码" Binding="{Binding Code}"/>
                                <DataGridTextColumn Header="设备名" Binding="{Binding Name}"/>
                                <DataGridTextColumn Header="设备类型编码" Binding="{Binding TypeCode}"/>
                                <DataGridTextColumn Header="设备类型名" Binding="{Binding TypeName}"/>
                                <DataGridTextColumn Header="IP" Binding="{Binding IP}"/>
                                <DataGridTextColumn Header="自身地址" Binding="{Binding SelfAddress}"/>
                                <DataGridTextColumn Header="巷道" Binding="{Binding RoadWay}"/>
                                <DataGridTextColumn Header="站台索引" Binding="{Binding StationIndex}"/>
                                <DataGridTextColumn Header="组名" Binding="{Binding GroupName}"/>
                                <DataGridTextColumn Header="描述" Binding="{Binding Desciption}"/>
                                <DataGridCheckBoxColumn Header="禁用" Binding="{Binding Disable}"/>
                                <DataGridTextColumn Header="创建时间" Binding="{Binding Created}"/>
                                <DataGridTextColumn Header="创建人" Binding="{Binding CreatedBy}"/>
                                <DataGridTextColumn Header="更新时间" Binding="{Binding Updated}"/>
                                <DataGridTextColumn Header="更新人" Binding="{Binding UpdatedBy}"/>
                            </DataGrid.Columns>
                        </DataGrid>
                    </DockPanel>
                </Grid>
            </TabItem>
            <TabItem x:Name="TIDetail" Header="设备属性">
                <Grid x:Name="GridDetail">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"></RowDefinition>
                        <RowDefinition Height="60"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <GroupBox Grid.Row="0" Header="设备信息">
                        <WrapPanel>
                            <StackPanel>
                                <TextBlock>设备编码:</TextBlock>
                                <TextBox x:Name="TxtMainCode" IsReadOnly="true" Text="{Binding Code}"></TextBox>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock>设备名:</TextBlock>
                                <TextBox x:Name="TxtMainName" IsReadOnly="true" Text="{Binding Name}"></TextBox>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock>描述:</TextBlock>
                                <TextBox x:Name="TxtDescription" IsReadOnly="true" Text="{Binding Description}"></TextBox>
                            </StackPanel>
                        </WrapPanel>
                    </GroupBox>
                    <GroupBox Grid.Row="1" Header="操作">
                        <StackPanel Grid.Row="1" HorizontalAlignment="Right">
                            <Button x:Name="BtnUpdateDetail" Click="BtnUpdateDetail_Click">刷新</Button>
                            <Button x:Name="BtnSaveProp" Click="BtnSaveProp_Click">保存</Button>
                            <Button x:Name="BtnDeleteProp" Click="BtnDeleteProp_Click">删除</Button>
                            <Button x:Name="BtnSync" Click="BtnSync_Click">同步</Button>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Grid.Row="2" Header="明细列表">
                        <DataGrid x:Name="DGDetail" IsReadOnly="False" AutoGenerateColumns="False">
                            <DataGrid.CellStyle>
                                <Style TargetType="{x:Type DataGridCell}">
                                    <Style.Triggers>
                                        <Trigger Property="IsReadOnly"  Value="False">
                                            <Setter Property="Background" Value="GreenYellow">
                                            </Setter>
                                        </Trigger>

                                    </Style.Triggers>
                                </Style>
                            </DataGrid.CellStyle>
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Id" Binding="{Binding Id}" IsReadOnly="True"/>
                                <!--<DataGridTextColumn Header="设备编码" Binding="{Binding EquipmentCode}"/>
                                <DataGridTextColumn Header="设备名" Binding="{Binding EquipmentName}"/>-->
                                <DataGridTextColumn Header="属性编码" Binding="{Binding EquipmentTypePropTemplateCode}" IsReadOnly="True"/>
                                <DataGridTextColumn Header="OPC句柄" Binding="{Binding ServerHandle}" IsReadOnly="True"/>
                                <DataGridTextColumn Header="地址" Binding="{Binding Address}" IsReadOnly="False"/>
                                <DataGridTextColumn Header="值" Binding="{Binding Value}" IsReadOnly="False"/>
                                <DataGridTextColumn Header="备注" Binding="{Binding Remark}" IsReadOnly="False"/>
                                <DataGridTextColumn Header="创建时间" Binding="{Binding Created}" IsReadOnly="True"/>
                                <DataGridTextColumn Header="创建人" Binding="{Binding CreatedBy}" IsReadOnly="True"/>
                                <DataGridTextColumn Header="更新时间" Binding="{Binding Updated}" IsReadOnly="True"/>
                                <DataGridTextColumn Header="更新人" Binding="{Binding UpdatedBy}" IsReadOnly="True"/>
                            </DataGrid.Columns>
                        </DataGrid>
                    </GroupBox>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</win:MyWindow>