mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 11:11:23 +00:00
104 lines
4.5 KiB
XML
104 lines
4.5 KiB
XML
<UserControl x:Class="Examples.WPF.Views.PlcDataView"
|
|
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:vm="clr-namespace:Examples.WPF.ViewModels"
|
|
xmlns:local="clr-namespace:Examples.WPF.Views"
|
|
mc:Ignorable="d"
|
|
d:DataContext="{d:DesignInstance vm:PlcDataViewViewModel, IsDesignTimeCreatable=True}"
|
|
d:DesignHeight="450"
|
|
d:DesignWidth="800">
|
|
<Grid>
|
|
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto"/>
|
|
<RowDefinition Height="auto"/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Menu>
|
|
<MenuItem Header="PLC">
|
|
<MenuItem Header="Disconnect" IsEnabled="{Binding Plc.IsConnected}"
|
|
Click="ClickedDisconnect"/>
|
|
<MenuItem Header="Connect" IsEnabled="{Binding Plc.IsConnected, Converter={StaticResource bInv}}"
|
|
Click="ClickedConnect"/>
|
|
<MenuItem Header="Set Random DT1000" IsEnabled="{Binding Plc.IsConnected}"
|
|
Click="ClickedSetRandom"/>
|
|
<MenuItem Header="Toggle OP mode" IsEnabled="{Binding Plc.IsConnected}"
|
|
Click="ClickedToggleRunMode"/>
|
|
</MenuItem>
|
|
</Menu>
|
|
|
|
<StackPanel Margin="10"
|
|
Grid.Row="1">
|
|
|
|
<TextBlock>
|
|
|
|
<Run Text="{Binding Plc.PlcInfo.TypeName, Mode=OneWay}"
|
|
FontSize="24"
|
|
FontWeight="SemiBold"/>
|
|
|
|
<Run Text="{Binding Plc.PlcInfo.CpuVersion, StringFormat='v{0}', Mode=OneWay}"
|
|
FontSize="24"
|
|
FontWeight="Light"/>
|
|
|
|
</TextBlock>
|
|
|
|
<TextBlock Text="{Binding Plc.PlcInfo.TypeCode, StringFormat='#{0:X}', Mode=OneWay}"
|
|
FontSize="18"/>
|
|
|
|
<ItemsControl ItemsSource="{Binding Plc.PlcInfo.OperationModeTags, Mode=OneWay}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel Orientation="Horizontal"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Background="LightGray"
|
|
CornerRadius="5"
|
|
Margin="2"
|
|
Padding="5">
|
|
<TextBlock Text="{Binding}"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<ItemsControl ItemsSource="{Binding Plc.PlcInfo.HardwareInformationTags, Mode=OneWay}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel Orientation="Horizontal"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Background="LightGray"
|
|
CornerRadius="5"
|
|
Margin="2"
|
|
Padding="5">
|
|
<TextBlock Text="{Binding}"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
</StackPanel>
|
|
|
|
<DataGrid Grid.Row="2"
|
|
AutoGenerateColumns="False"
|
|
IsReadOnly="True"
|
|
ItemsSource="{Binding Plc.Registers, Mode=OneWay}">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="FP Address" Binding="{Binding PLCAddressName}"/>
|
|
<DataGridTextColumn Header="Type" Binding="{Binding UnderlyingSystemType.Name}"/>
|
|
<DataGridTextColumn Header="Value" Binding="{Binding ValueStr}"/>
|
|
<DataGridTextColumn Header="Poll Level" Binding="{Binding PollLevel, Mode=OneWay}"/>
|
|
<DataGridTextColumn Header="Update Frequency" Binding="{Binding UpdateFreqHz, StringFormat='{}{0} Hz',Mode=OneWay}"/>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
|
|
</Grid>
|
|
</UserControl>
|