2026-01-26 18:56:53 +09:00

145 lines
8.5 KiB
XML

<UserControl x:Class="WeldingCommon.Views.UCSingleAxisStatus"
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:WeldingCommon.Views"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:view="clr-namespace:Aurora.View;assembly=Aurora"
xmlns:usercontrols="clr-namespace:AuroraUIComponent.UserControls;assembly=AuroraUIComponent"
mc:Ignorable="d" Name="uc"
d:DesignHeight="600" d:DesignWidth="200" Width="200" Height="600" Background="Black"
d:DataContext="{d:DesignInstance Type=local:UCSingleAxisStatusViewModel}">
<UserControl.Resources>
<view:BoolConverter x:Key="StatusFillColor" TrueValue="Green" FalseValue="Red"/>
<Style x:Key="StEllipse" TargetType="Ellipse">
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="StTextBlock" TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="Black"/>
<Setter Property="FontSize" Value="17"/>
<Setter Property="Width" Value="190"/>
<Setter Property="Height" Value="30"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
<Style x:Key="StBorder" TargetType="Border">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</UserControl.Resources>
<i:Interaction.Triggers>
<i:PropertyChangedTrigger Binding="{Binding IsVisible, ElementName=uc}">
<i:InvokeCommandAction Command="{Binding CMD_VisibleChanged}" CommandParameter="{Binding IsVisible, ElementName=uc}"/>
</i:PropertyChangedTrigger>
</i:Interaction.Triggers>
<StackPanel Orientation="Vertical">
<usercontrols:UCKeyComboBox KeyText="Motor Axis" ItemList="{Binding MotorIDList}"
ValueItem="{Binding SelectedMotorID}" KeyTextFgColor="White" KeyTextBgColor="Black"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button FontSize="20" Width="80" Margin="5" Command="{Binding CMD_DECCOMBOMOTORID}" >◀</Button>
<Button FontSize="20" Width="80" Margin="5" Command="{Binding CMD_INCCOMBOMOTORID}" >▶</Button>
</StackPanel>
<Grid Height="35" Margin="5">
<Button FontSize="18" Command="{Binding CMD_ServoOnOff}" Width="190" Content="{Binding strMotorServoOnOffStatus}"></Button>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding bMotorServoOnOffStatus , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5">
<Button FontSize="18" Command="{Binding CMD_ResetAlarm}" Width="190">Alarm</Button>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorAlarmStatus , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" >In Motion</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorInMotion , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" >In Position</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorInPosition , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border BorderBrush="White" BorderThickness="1">
<TextBlock Style="{StaticResource StTextBlock}" >Home</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorHomeStatus , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" >(+) Limit</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorPlusLimitStatus , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" >(-) Limit</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorMinusLimitStatus , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" >EMG</TextBlock>
</Border>
<Ellipse Style="{StaticResource StEllipse}" Fill="{Binding MotorEmergencyStop , Converter={StaticResource StatusFillColor}}"
HorizontalAlignment="Left" Margin="10,0,0,0"></Ellipse>
</Grid>
<Grid Height="35" Margin="5,0,5,5">
<Border Style="{StaticResource StBorder}">
<TextBlock Style="{StaticResource StTextBlock}" Text="{Binding AlarmCode}"></TextBlock>
</Border>
</Grid>
<Grid Height="140" Margin="5,0,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Style="{StaticResource StBorder}" Grid.Column="0" Grid.Row="0">
<TextBlock Style="{StaticResource StTextBlock}" >Target Pos</TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="0" Grid.Row="1">
<TextBlock Style="{StaticResource StTextBlock}" >Actual Pos</TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="0" Grid.Row="2">
<TextBlock Style="{StaticResource StTextBlock}" >Pos Error</TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="0" Grid.Row="3">
<TextBlock Style="{StaticResource StTextBlock}" >Velocity</TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="1" Grid.Row="0">
<TextBlock Style="{StaticResource StTextBlock}" Text="{Binding TargetPos, StringFormat={}{0:0.000}}"></TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="1" Grid.Row="1">
<TextBlock Style="{StaticResource StTextBlock}" Text="{Binding ActualPos, StringFormat={}{0:0.000}}"></TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="1" Grid.Row="2">
<TextBlock Style="{StaticResource StTextBlock}" Text="{Binding PosError, StringFormat={}{0:0.000}}"></TextBlock>
</Border>
<Border Style="{StaticResource StBorder}" Grid.Column="1" Grid.Row="3">
<TextBlock Style="{StaticResource StTextBlock}" Text="{Binding Velocity}"></TextBlock>
</Border>
</Grid>
</StackPanel>
</UserControl>