Commit c3ec3eb7 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 支持大AD盒的 16位输入,8位输出显示

parent 1ca3aa5a
......@@ -349,8 +349,8 @@ namespace FlyADBase
ID,
FLYAD7_OBJ_INTERFACE.FLYIO_OBJ_INTERFACE.GET_IO);
NotifyPropertyChanged("Pos1LCShift");//写入到AD盒
NotifyPropertyChanged("Pos2Comp");//写入到AD盒
NotifyPropertyChanged(nameof(Pos1LCShift));//写入到AD盒
NotifyPropertyChanged(nameof(Pos2Comp));//写入到AD盒
SyncPos2Clear();
SyncClear();
......@@ -516,12 +516,12 @@ namespace FlyADBase
Array.Copy(pack.code, Code, pack.code.Length);
Code[6] = 0x06;
NotifyPropertyChanged("Code");
NotifyPropertyChanged(nameof(Code));
Surplus = pack.surplus;
Array.Copy(pack.access, Access, pack.access.Length);
NotifyPropertyChanged("Access");
NotifyPropertyChanged(nameof(Access));
} break;
case FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.GET_ZERO_POS:
......@@ -976,12 +976,12 @@ namespace FlyADBase
public int ADMax { get; } = 65535;
/// <summary>
/// 输入口状态,只有12位有效
/// 输入口状态,只有12位有效, 大AD盒 16位
/// </summary>
public UInt16 IStatus { get; private set; } = 0xffff;
/// <summary>
/// 输出口状态,只有4位有效
/// 输出口状态,只有4位有效, 大AD盒 8位
/// </summary>
public UInt16 OStatus { get; private set; } = 0xffff;
......
......@@ -103,23 +103,43 @@
<StackPanel >
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="入" Style="{StaticResource ItemHeaderStyle}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=15}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=14}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<Grid Margin="2">
......@@ -129,11 +149,23 @@
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<TextBlock Text="出" Style="{StaticResource ItemHeaderStyle}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<Grid Margin="1" >
......
......@@ -16,10 +16,16 @@
<Setter Property="Margin" Value="5,0"/>
</Style>
<Style x:Key="IOStyle" TargetType="Rectangle" >
<Setter Property="Width" Value="11" />
<Setter Property="Width" Value="10" />
<Setter Property="Height" Value="12" />
<Setter Property="Margin" Value="1" />
</Style>
<Style x:Key="IOTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#FF119EDA" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="10"/>
</Style>
<Style x:Key="BtnStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{StaticResource AccentBaseColorBrush}"/>
......
......@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.Base.UI.UiModule"
d:DesignWidth="250"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
......@@ -12,10 +13,16 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="Rectangle" x:Key="RectangleStyle_IO">
<Setter Property="Width" Value="11" />
<Setter Property="Height" Value="24" />
<Setter Property="Margin" Value="2" />
<Style TargetType="Rectangle" x:Key="IOStyle">
<Setter Property="Width" Value="9" />
<Setter Property="Height" Value="20" />
<Setter Property="Margin" Value="1" />
</Style>
<Style x:Key="IOTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource Color_theme_background}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="9"/>
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_ItemHeader">
<Setter Property="FontWeight" Value="Bold"/>
......@@ -25,7 +32,7 @@
<Setter Property="Foreground" Value="#FF3B3B3B"/>
<Setter Property="Margin" Value="5,0"/>
</Style>
<local:DynAreaIOViewModel_UnitTest x:Key="viewModel" IsError="True" ErrMsg="枫莱尔控制器连接断开" />
<local:DynAreaIOViewModel_UnitTest x:Key="viewModel" IsError="False" ErrMsg="枫莱尔控制器连接断开" />
</ResourceDictionary>
</UserControl.Resources>
<Button Click="Border_IO_Click" Style="{StaticResource ButtonStyle_empty}" d:DataContext="{StaticResource viewModel}">
......@@ -35,22 +42,32 @@
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="入" Style="{StaticResource TextBlockStyle_ItemHeader}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=15}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=14}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<Grid Margin="2">
......@@ -61,10 +78,19 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<TextBlock Text="出" Style="{StaticResource TextBlockStyle_ItemHeader}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource RectangleStyle_IO}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1" Visibility="{Binding IsForever,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment