<UserControl x:Class="CyberX8_Themes.UserControls.MotionControl" 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:converters="clr-namespace:CyberX8_Themes.Converters" xmlns:local="clr-namespace:CyberX8_Themes.UserControls" xmlns:Control="clr-namespace:MECF.Framework.UI.Core.Control;assembly=MECF.Framework.UI.Core" mc:Ignorable="d" x:Name="self" d:DesignHeight="850" d:DesignWidth="450"> <UserControl.Resources> <converters:BoolToColor x:Key="boolToColor"/> <converters:BoolToRedColor x:Key="boolToRedColor"/> </UserControl.Resources> <Grid> <GroupBox Header="{Binding ModuleTitle, ElementName=self}" Background="{DynamicResource Table_BD_Title}" BorderBrush="DarkGray"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="35"/> <RowDefinition Height="150"/> <RowDefinition Height="70"/> <RowDefinition Height="180"/> <RowDefinition Height="2"/> <RowDefinition Height="240"/> <RowDefinition Height="60"/> <RowDefinition/> </Grid.RowDefinitions> <WrapPanel Grid.Row="0" VerticalAlignment="Center"> <Label Content="Status" FontSize="16" FontWeight="Bold"/> <TextBlock Background="Black" Foreground="Lime" VerticalAlignment="Center" Text="{Binding MotionData.Status, ElementName=self}" FontWeight="Bold" FontSize="16" Width="365"/> </WrapPanel> <Grid Grid.Row="1"> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="ON" Margin="9,2,359,3" Height="30" Click="SwitchOn_Click"/> <Ellipse Margin="66,9,336,10" Width="16" Height="16" Fill="{Binding MotionData.IsSwitchOn, Converter={StaticResource boolToColor}, ElementName=self}" Stroke="Silver"/> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="OFF" Margin="88,2,280,3" Height="30" Click="SwitchOff_Click"/> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="Home" Margin="325,2,43,3" Height="30" Click="Home_Click"/> <Ellipse Margin="382,9,20,10" Width="16" Height="16" Fill="{Binding MotionData.IsHomed, Converter={StaticResource boolToColor}, ElementName=self}" Stroke="Silver"/> </Grid> <Grid Grid.Row="2"> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="220"/> <ColumnDefinition Width="130"/> <ColumnDefinition Width="80"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="Motor Position" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="0" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.MotorPosition, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="0" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="1" Grid.Column="0" Content="Target Position" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="1" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.TargetPosition, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="1" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="2" Grid.Column="0" Content="Position Error" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="2" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.PositionError, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="2" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="3" Grid.Column="0" Content="Torque" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="3" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.ActualTorque, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="3" Grid.Column="2" Margin="2,0,2,0" Text="%" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="4" Grid.Column="0" Content="Velocity" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="4" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding ElementName=self,Path=MotionData.ActualVelocity, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="4" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/sec" /> </TextBlock.Text> </TextBlock> </Grid> <Grid Grid.Row="3"> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="-jog" Margin="104,2,284,38" Height="30" Click="JogDown_Click"/> <Control:NumbericUpDown HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Top" Width="120" Height="35" MaxValue="100.00" MinValue="-100.00" IncrementValue="{Binding ElementName=self,Path=IncrementValue,Mode=TwoWay}" DigitalMaxLength="2" Value="{Binding ElementName=self,Path=JogValue,Mode=TwoWay}"/> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="+jog" Margin="285,2,103,38" Height="30" Click="JogUp_Click"/> <Button Style="{StaticResource SysBtnStyle}" Width="50" Content="Stop" Margin="184,39,204,1" Height="30" Click="JogStop_Click"/> </Grid> <Grid Grid.Row="4"> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="180"/> <ColumnDefinition Width="85"/> <ColumnDefinition Width="85"/> <ColumnDefinition Width="80"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="Speed" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="0" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputSpeed,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="ProfileVelocity" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}"/> <TextBlock Grid.Column="2" Margin="0,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding ElementName=self,Path=MotionData.ProfileVelocity,StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="0" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/sec" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="1" Grid.Column="0" Content="Acceleration" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="1" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputAcceleration,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="ProfileAccel" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}"/> <TextBlock Grid.Row="1" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding ElementName=self,Path=MotionData.ProfileAccel, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="1" Grid.Column="3" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/s/s" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="2" Grid.Column="0" Content="Deceleration" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="2" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputDeceleration,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="ProfileDecel" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}"/> <TextBlock Grid.Row="2" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding ElementName=self,Path=MotionData.ProfileDecel, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="2" Grid.Column="3" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/s/s" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="3" Grid.Column="0" Content="Home Speed Switch" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="3" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputHomeSpeedSwitch,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="HomingVelocity" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}"/> <TextBlock Grid.Row="3" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.HomingVelocity, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="3" Grid.Column="3" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/sec" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="4" Grid.Column="0" Content="Home Speed Index" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="4" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputHomeSpeedIndex,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="HomingVelocitySlow" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}"/> <TextBlock Grid.Row="4" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.HomingVelocitySlow, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="4" Grid.Column="3" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/sec" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="5" Grid.Column="0" Content="Home Accel/Decel" FontSize="16" FontWeight="Bold"/> <Control:NumbericTextBox Grid.Row="5" Grid.Column="1" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="80" Height="22" Value="{Binding ElementName=self,Path=InputHomeAccelDecel,StringFormat={}{0:F2},Mode=TwoWay}" TextboxName="HomingAccel" KeyOperation="{Binding ElementName=self,Path=KeyDownCommand}" /> <TextBlock Grid.Row="5" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.HomingAccel, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="5" Grid.Column="3" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/s/s" /> </TextBlock.Text> </TextBlock> </Grid> <Grid Grid.Row="6"> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="220"/> <ColumnDefinition Width="130"/> <ColumnDefinition Width="80"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="Home Offset" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="0" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.HomeOffset, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="0" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="1" Grid.Column="0" Content="Position Error Limit" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="1" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.PositionErrorLimit, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="1" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="2" Grid.Column="0" Content="TargetPosition Error Limit" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="2" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.TargetPositionErrorLimit, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="2" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self,Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="3" Grid.Column="0" Content="Torque Limit" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="3" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding ElementName=self,Path=MotionData.TorqueLimit}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="3" Grid.Column="2" Margin="2,0,2,0" Text="%" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="4" Grid.Column="0" Content="E Stop Deceleration" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="4" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.EStopDeceleration, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="4" Grid.Column="2" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"> <TextBlock.Text> <Binding ElementName="self" Path="ModuleUnit" StringFormat=" {0}/s/s" /> </TextBlock.Text> </TextBlock> <Label Grid.Row="5" Grid.Column="0" Content="E Stop Torque" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="5" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.EStopTorque, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="5" Grid.Column="2" Margin="2,0,2,0" Text="%" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="6" Grid.Column="0" Content="Rev Soft Limit" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="6" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.RevSoftLimit, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="6" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self, Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <Label Grid.Row="7" Grid.Column="0" Content="Fwd Soft Limit" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="7" Grid.Column="1" Margin="2,0,2,0" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding MotionData.FwdSoftLimit, ElementName=self, StringFormat=\{0:F2\}}" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> <TextBlock Grid.Row="7" Grid.Column="2" Margin="2,0,2,0" Text="{Binding ElementName=self, Path=ModuleUnit}" TextAlignment="Center" VerticalAlignment="Center" Background="Black" Foreground="Lime" FontSize="16" FontWeight="Bold"/> </Grid> <Grid Grid.Row="7"> <Grid.ColumnDefinitions> <ColumnDefinition Width="299*"/> <ColumnDefinition Width="139*"/> </Grid.ColumnDefinitions> <Label Content="Rev Limit" FontSize="16" FontWeight="Bold" Margin="0,0,181,19" /> <Ellipse Margin="34,24,249,20" Width="16" Height="16" Fill="{Binding MotionData.RevLimited, Converter={StaticResource boolToRedColor}, ElementName=self}" Stroke="Silver"/> <Label Content="Home Switch" FontSize="16" FontWeight="Bold" Margin="160,0,7,19" /> <Ellipse Margin="194,24,89,20" Width="16" Height="16" Fill="{Binding MotionData.HomedSwitched, Converter={StaticResource boolToColor}, ElementName=self}" Stroke="Silver"/> <Label Content="Fwd Limit" FontSize="16" FontWeight="Bold" Margin="26,0,15,19" Grid.Column="1" /> <Ellipse Margin="60,24,63,20" Width="16" Height="16" Fill="{Binding MotionData.FwdLimited, Converter={StaticResource boolToRedColor}, ElementName=self}" Stroke="Silver" Grid.Column="1"/> </Grid> </Grid> </GroupBox> </Grid> </UserControl>