|
@@ -1,109 +1,54 @@
|
|
|
<My:MWindow xmlns:My="clr-namespace:MyWPFControl.Controls;assembly=MyWPFControl"
|
|
|
- x:Class="B20UVLog.Windows.PLCSet"
|
|
|
- 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:B20UVLog.Windows" xmlns:viewmodels="clr-namespace:B20UVLog.ViewModels"
|
|
|
- mc:Ignorable="d"
|
|
|
- WindowStyle="ToolWindow"
|
|
|
- Title="PLC配置" Height="800" Width="1400">
|
|
|
+ x:Class="B20UVLog.Windows.PLCSet"
|
|
|
+ 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:B20UVLog.Windows" xmlns:viewmodels="clr-namespace:B20UVLog.ViewModels"
|
|
|
+ mc:Ignorable="d"
|
|
|
+ WindowStyle="ToolWindow" WindowStartupLocation="CenterScreen"
|
|
|
+ Title="PLC配置" Height="600" Width="1200">
|
|
|
+ <Window.Resources>
|
|
|
+ <Style TargetType="TextBox">
|
|
|
+ <Setter Property="Height" Value="25"/>
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
+ </Style>
|
|
|
+ </Window.Resources>
|
|
|
<Window.DataContext>
|
|
|
<viewmodels:PLCSetViewModel/>
|
|
|
</Window.DataContext>
|
|
|
- <Grid>
|
|
|
- <Grid.ColumnDefinitions>
|
|
|
- <ColumnDefinition Width="*"/>
|
|
|
- <ColumnDefinition Width="300"/>
|
|
|
- </Grid.ColumnDefinitions>
|
|
|
- <DockPanel LastChildFill="True">
|
|
|
- <DockPanel.Resources>
|
|
|
- <Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle}">
|
|
|
- <Setter Property="Margin" Value="10 0 5 0"/>
|
|
|
- <Setter Property="Width" Value="50"/>
|
|
|
- <Setter Property="TextAlignment" Value="Right"/>
|
|
|
- </Style>
|
|
|
- </DockPanel.Resources>
|
|
|
- <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
|
|
|
- <TextBlock >IP地址:</TextBlock>
|
|
|
- <My:MTextBox></My:MTextBox>
|
|
|
- <TextBlock Width="auto">端口:</TextBlock>
|
|
|
- <My:MTextBox></My:MTextBox>
|
|
|
- <My:MButton>测试</My:MButton>
|
|
|
- <My:MButton Type="Primary">保存</My:MButton>
|
|
|
- </StackPanel>
|
|
|
- <Line DockPanel.Dock="Top" Stroke="{StaticResource DefaultBorderBrush}" X1="0" X2="{Binding ActualWidth,RelativeSource={RelativeSource AncestorType=DockPanel}}" StrokeThickness="2" Margin="10"/>
|
|
|
- <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
|
|
|
- <TextBlock>PLC地址:</TextBlock>
|
|
|
- <My:MTextBox Clearable="True"></My:MTextBox>
|
|
|
- <My:MButton Type="Primary">查询</My:MButton>
|
|
|
- <My:MButton Type="Primary">新增</My:MButton>
|
|
|
- <My:MButton Type="Warning">导入</My:MButton>
|
|
|
- </StackPanel>
|
|
|
- <My:MPagination DockPanel.Dock="Bottom" Margin="5"/>
|
|
|
- <My:MDataGrid ItemsSource="{Binding PLCItems}" DockPanel.Dock="Top" Margin="10">
|
|
|
- <DataGrid.Columns>
|
|
|
- <DataGridTextColumn Header="地址" Binding="{Binding}" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTextColumn Header="类型" Binding="{Binding}" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTextColumn Header="值" Binding="{Binding}" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTextColumn Header="开始地址" Binding="{Binding }" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTextColumn Header="结束地址" Binding="{Binding }" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTextColumn Header="地址长度" Binding="{Binding }" Width="100"></DataGridTextColumn>
|
|
|
- <DataGridTemplateColumn>
|
|
|
- <DataGridTemplateColumn.CellTemplate>
|
|
|
- <DataTemplate>
|
|
|
- <StackPanel Orientation="Horizontal">
|
|
|
- <My:MButton IsText="True" Icon="{StaticResource Icon-sign-out-alt}">读取</My:MButton>
|
|
|
- <My:MButton x:Name="Btn_Write" IsText="True" Icon="{StaticResource Icon-sign-in-alt}">写入</My:MButton>
|
|
|
- <StackPanel x:Name="Panel_Value" Orientation="Horizontal" Visibility="Collapsed">
|
|
|
- <My:MTextBox x:Name="Text_Value" Width="80"/>
|
|
|
- <My:MButton x:Name="Btn_Value_OK" Square="True" IsText="True" Icon="{StaticResource Icon-check}"/>
|
|
|
- <My:MButton x:Name="Btn_Value_Cancel" Square="True" IsText="True" Icon="{StaticResource Icon-times}"/>
|
|
|
- </StackPanel>
|
|
|
- <My:MButton IsText="True" Icon="{StaticResource Icon-edit}">编辑</My:MButton>
|
|
|
- <My:MButton IsText="True" Icon="{StaticResource Icon-trash-alt}">删除</My:MButton>
|
|
|
- </StackPanel>
|
|
|
- <DataTemplate.Triggers>
|
|
|
- <EventTrigger SourceName="Btn_Write" RoutedEvent="Button.Click">
|
|
|
- <BeginStoryboard>
|
|
|
- <Storyboard>
|
|
|
- <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Panel_Value"
|
|
|
- Storyboard.TargetProperty="(UIElement.Visibility)">
|
|
|
- <DiscreteObjectKeyFrame KeyTime="0"
|
|
|
- Value="{x:Static Visibility.Visible}"/>
|
|
|
- </ObjectAnimationUsingKeyFrames>
|
|
|
- <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Btn_Write"
|
|
|
- Storyboard.TargetProperty="(UIElement.Visibility)">
|
|
|
- <DiscreteObjectKeyFrame KeyTime="0"
|
|
|
- Value="{x:Static Visibility.Collapsed}"/>
|
|
|
- </ObjectAnimationUsingKeyFrames>
|
|
|
- </Storyboard>
|
|
|
- </BeginStoryboard>
|
|
|
- </EventTrigger>
|
|
|
- <EventTrigger SourceName="Btn_Value_Cancel" RoutedEvent="Button.Click">
|
|
|
- <BeginStoryboard>
|
|
|
- <Storyboard>
|
|
|
- <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Panel_Value"
|
|
|
- Storyboard.TargetProperty="Visibility">
|
|
|
- <DiscreteObjectKeyFrame KeyTime="0"
|
|
|
- Value="{x:Static Visibility.Collapsed}"/>
|
|
|
- </ObjectAnimationUsingKeyFrames>
|
|
|
- <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Btn_Write"
|
|
|
- Storyboard.TargetProperty="Visibility">
|
|
|
- <DiscreteObjectKeyFrame KeyTime="0"
|
|
|
- Value="{x:Static Visibility.Visible}"/>
|
|
|
- </ObjectAnimationUsingKeyFrames>
|
|
|
- </Storyboard>
|
|
|
- </BeginStoryboard>
|
|
|
- </EventTrigger>
|
|
|
- </DataTemplate.Triggers>
|
|
|
- </DataTemplate>
|
|
|
- </DataGridTemplateColumn.CellTemplate>
|
|
|
- </DataGridTemplateColumn>
|
|
|
- </DataGrid.Columns>
|
|
|
- </My:MDataGrid>
|
|
|
- </DockPanel>
|
|
|
- <ListBox Grid.Column="1" Margin="5">
|
|
|
- </ListBox>
|
|
|
+ <Grid Background="White">
|
|
|
+ <Grid.RowDefinitions>
|
|
|
+ <RowDefinition Height="30"/>
|
|
|
+ <RowDefinition Height="30"/>
|
|
|
+ <RowDefinition Height="*"/>
|
|
|
+ </Grid.RowDefinitions>
|
|
|
+ <WrapPanel Grid.Row="0" Orientation="Horizontal">
|
|
|
+ <Label Content="IP地址:"/>
|
|
|
+ <TextBox x:Name="PlcIpAddress" DockPanel.Dock="Left" Width="120"/>
|
|
|
+ <Label Content="端口号:"/>
|
|
|
+ <TextBox x:Name="PlcPort" DockPanel.Dock="Left" Width="120"/>
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnChangeIpAndPort" Content="修改IP地址端口号" Click="BtnChangeIpAndPort_Click" />
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnConnectPLC" Content="连接PLC" Click="BtnConnectPLC_Click" />
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnStartPlcLogMonitor" Content="开启PLC监控" Click="BtnStartPlcLogMonitor_Click" />
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnDisConnectPLC" Content="断开PLC连接" Click="BtnDisConnectPLC_Click" />
|
|
|
+ </WrapPanel>
|
|
|
+ <WrapPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
|
|
+ <Label Content="PLC地址:"/>
|
|
|
+ <TextBox x:Name="PlcAddress" DockPanel.Dock="Left" Width="100"/>
|
|
|
+ <Label Content="写入值:"/>
|
|
|
+ <TextBox x:Name="TxbWriteValue" DockPanel.Dock="Left" Width="150"/>
|
|
|
+ <Label Content="长度:"/>
|
|
|
+ <TextBox x:Name="DataLength" DockPanel.Dock="Left" Text="1" Width="50"/>
|
|
|
+ <Label Content="数据类型:"/>
|
|
|
+ <My:MComboBox x:Name="CmbDataType" DockPanel.Dock="Left" Width="100"/>
|
|
|
+ <CheckBox x:Name="IsBatch" Content="批量" Width="50" VerticalAlignment="Center"/>
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnReadPLC" Content="读取" Click="BtnReadPLC_Click" />
|
|
|
+ <My:MButton Type="Primary" x:Name="BtnWritePLC" Content="写入" Click="BtnWritePLC_Click" />
|
|
|
+ </WrapPanel>
|
|
|
+ <RichTextBox x:Name="RtbRunLog" Grid.Row="2">
|
|
|
+ <FlowDocument>
|
|
|
+ </FlowDocument>
|
|
|
+ </RichTextBox>
|
|
|
</Grid>
|
|
|
</My:MWindow>
|