2026-06-05 13:44:39 +09:00

146 lines
9.5 KiB
XML

<UserControl x:Class="AuroraPLC.Views.UCPLCBit"
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:AuroraPLC.Views"
xmlns:aurora="clr-namespace:Aurora.View;assembly=Aurora"
xmlns:uiControl="clr-namespace:AuroraUIComponent.UserControls;assembly=AuroraUIComponent"
xmlns:behavior="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=local:UCPLCBitViewModel}"
mc:Ignorable="d"
d:DesignHeight="830" d:DesignWidth="1700"
Background="{StaticResource MahApps.Brushes.ThemeBackground}" FontSize="12" Padding="10 10"
x:Name="uc">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<aurora:SharedResourceDictionary Source="pack://application:,,,/AuroraUIComponent;component/Style/Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="StSignal" TargetType="Ellipse">
<Setter Property="Width" Value="15"/>
<Setter Property="Height" Value="15"/>
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="Stroke" Value="Black"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<aurora:BoolConverter
x:Key="convSignalConv"
FalseValue="Gray"
TrueValue="Lime"/>
</ResourceDictionary>
</UserControl.Resources>
<behavior:Interaction.Triggers>
<behavior:PropertyChangedTrigger Binding="{Binding IsVisible, ElementName=uc}">
<behavior:InvokeCommandAction Command="{Binding CMD_VisibleChanged}" CommandParameter="{Binding IsVisible, ElementName=uc}"/>
</behavior:PropertyChangedTrigger>
</behavior:Interaction.Triggers>
<Grid Margin="5" MouseLeftButtonDown="Filter_LBDown">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<!-- Bit Input Header -->
<Border Grid.Column="0" Margin="0" Style="{StaticResource StGroupBorder}">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}" Margin="20 5"
FontSize="20" FontWeight="Bold"
Text="{Binding [BitInputsTitle], Source={StaticResource langTokens}, FallbackValue=BitInput}"/>
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
<Border>
<StackPanel VerticalAlignment="Center">
<CheckBox Content="{Binding [WithDescriptionOnly], Source={StaticResource langTokens}, FallbackValue=WithDescriptionOnly}" IsChecked="{Binding IsInputShowDescriptionExist}" VerticalAlignment="Center"
FontWeight="Bold" Foreground="#7A7A7A" Margin="5" HorizontalAlignment="Right"/>
<uiControl:UCKeyValueString KeyText="{Binding [Filter], Source={StaticResource langTokens}, FallbackValue=Filter}" ValueText="{Binding FilterInputDescription}" KeyTextWidth="50" ValueTextWidth="150"
KeyDown="Filter_KeyDown"/>
</StackPanel>
</Border>
</StackPanel>
</Grid>
</Border>
<!-- Bit Output Header -->
<Border Grid.Column="1" Margin="10 0 0 0" Style="{StaticResource StGroupBorder}">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}" Margin="20 5"
FontSize="20" FontWeight="Bold"
Text="{Binding [BitOutputsTitle], Source={StaticResource langTokens}, FallbackValue=BitOutput}"/>
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
<GroupBox Header="{Binding [ChangeValue], Source={StaticResource langTokens}, FallbackValue=ChangeValue}" VerticalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Margin="10 2">
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"
Text="{Binding SelectedBitAddress}"/>
<Button Margin="5 0"
Height="40" Padding="20 0"
Command="{Binding CMD_ChangeValue}"
Content="{Binding [Change], Source={StaticResource langTokens}, FallbackValue=Change}"
IsEnabled="{Binding ChangeButtonEnable}"
Style="{StaticResource StButtonAccent}"
FontSize="11"/>
</StackPanel>
</GroupBox>
<Border>
<StackPanel VerticalAlignment="Center">
<CheckBox Content="{Binding [WithDescriptionOnly], Source={StaticResource langTokens}, FallbackValue=WithDescriptionOnly}" IsChecked="{Binding IsOutputShowDescriptionExist}" VerticalAlignment="Center"
FontWeight="Bold" Foreground="#7A7A7A" Margin="5" HorizontalAlignment="Right"/>
<uiControl:UCKeyValueString KeyText="{Binding [Filter], Source={StaticResource langTokens}, FallbackValue=Filter}" ValueText="{Binding FilterOutputDescription}" KeyTextWidth="50" ValueTextWidth="150"
KeyDown="Filter_KeyDown"/>
</StackPanel>
</Border>
</StackPanel>
</Grid>
</Border>
<!-- Bit Input Data -->
<DataGrid Grid.Row="1" ItemsSource="{Binding DigitalInputsView}" Margin="0 10 0 0"
SelectedItem="{Binding SelectedInputItem}"
AutoGenerateColumns="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True"
BorderThickness="1"
DataGrid.RowStyle ="{StaticResource RowStyle}" ColumnHeaderStyle="{StaticResource StDataGridHeaderStyle}">
<DataGrid.Columns>
<DataGridTextColumn Width="1*" Header="{Binding [Address], Source={StaticResource langTokens}, FallbackValue=Address}" Binding="{Binding Address}"/>
<DataGridTextColumn Width="5*" Header="{Binding [Description], Source={StaticResource langTokens}, FallbackValue=Description}" Binding="{Binding Description}"/>
<DataGridTemplateColumn Width="1*" Header="{Binding [Status], Source={StaticResource langTokens}, FallbackValue=Status}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Ellipse Fill="{Binding InPutStatus, Converter={StaticResource convSignalConv}}" Style="{StaticResource StSignal}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<!-- Bit Output Data -->
<DataGrid Grid.Row="1" Grid.Column="1" ItemsSource="{Binding DigitalOutputsView}" SelectedItem="{Binding SelectedOutputItem}" Margin="10 10 0 0"
AutoGenerateColumns="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" BorderThickness="1"
DataGrid.RowStyle ="{StaticResource RowStyle}" ColumnHeaderStyle="{StaticResource StDataGridHeaderStyle}">
<DataGrid.Columns>
<DataGridTextColumn Width="1*" Header="{Binding [Address], Source={StaticResource langTokens}, FallbackValue=Address}" Binding="{Binding Address}"/>
<DataGridTextColumn Width="5*" Header="{Binding [Description], Source={StaticResource langTokens}, FallbackValue=Description}" Binding="{Binding Description}"/>
<DataGridTemplateColumn Width="1*" Header="{Binding [Status], Source={StaticResource langTokens}, FallbackValue=Status}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Ellipse Fill="{Binding OutPutStatus, Converter={StaticResource convSignalConv}}" Style="{StaticResource StSignal}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>