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

312 lines
19 KiB
XML

<UserControl x:Class="AuroraLaser.Views.UCLaserCompactInfo"
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:AuroraLaser.Views"
xmlns:behavior="http://schemas.microsoft.com/xaml/behaviors"
xmlns:aurora="clr-namespace:Aurora.View;assembly=Aurora"
d:DataContext="{d:DesignInstance Type=local:UCLaserCompactInfoViewModel}"
mc:Ignorable="d" IsEnabled="{Binding IsActivated}"
d:DesignHeight="450" d:DesignWidth="300" x:Name="uc">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<aurora:SharedResourceDictionary Source="pack://application:,,,/AuroraUIComponent;component/Style/Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="TextBoxBorder" TargetType="Border">
<Setter Property="Background" Value="{StaticResource BLGPurple}"/>
<Setter Property="BorderBrush" Value="#401A69"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="MinHeight" Value="28"/>
</Style>
<Style TargetType="Button" BasedOn="{StaticResource StButtonAccent}">
<Setter Property="MinHeight" Value="30"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontSize" Value="11.5"/>
<Setter Property="Foreground" Value="{StaticResource BLGLightGray}"/>
</Style>
<aurora:BoolConverter
x:Key="convSignalConv"
FalseValue="#2a2a2a"
TrueValue="LimeGreen"/>
<Style BasedOn="{StaticResource {x:Type TextBlock}}"
x:Key="TextBlockLaserMode" TargetType="TextBlock">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Padding" Value="0 2 0 2"/>
</Style>
</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>
<GroupBox Header="{Binding LaserInfo}" Style="{StaticResource StGroupBox2nd}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*" x:Name="ErrorMessage"/>
<RowDefinition Height="0.2*" x:Name="margin_end0"/>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="5">
<TextBlock Text="Serial Number : "/>
<TextBlock Text="{Binding SerialNumber, FallbackValue=SN123456}"/>
</DockPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Background="{StaticResource BLGPurple}"
HorizontalAlignment="Stretch"
Text="Laser Mode"/>
<TextBlock Background="{Binding Path=IsActivated, Converter={StaticResource convSignalConv}}"
HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="Peltier Ctrl : Only Cooling"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActivated}" Value="True">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsPeltierCtrlHeatingCooling}" Value="True">
<Setter Property="Text" Value="Peltier Ctrl : Heating + Cooling"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Background="{Binding Path=IsActivated, Converter={StaticResource convSignalConv}}"
HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="Current Set : Internal"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActivated}" Value="True">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsCurrentSetExternal}" Value="True">
<Setter Property="Text" Value="Current Set : External"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Background="{Binding Path=IsActivated, Converter={StaticResource convSignalConv}}"
HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="Laser Control : Internal"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActivated}" Value="True">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLaserCtrlExternal}" Value="True">
<Setter Property="Text" Value="Laser Control : External"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Background="{Binding Path=IsActivated, Converter={StaticResource convSignalConv}}"
HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="Laser Pulse : Off"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActivated}" Value="True">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsPulseOn}" Value="True">
<Setter Property="Text" Value="Laser Pulse : On"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Background="{Binding Path=IsActivated, Converter={StaticResource convSignalConv}}"
HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="VT100 : Off"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActivated}" Value="True">
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsVT100On}" Value="True">
<Setter Property="Text" Value="VT100 : On"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="5">
<TextBlock Background="{StaticResource BLGPurple}"
HorizontalAlignment="Stretch"
Text="Laser Status"/>
<TextBlock HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Text" Value="Power Off"/>
<Setter Property="Background" Value="#2a2a2a"/>
<Setter Property="Foreground" Value="#bbbbbb"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsPowerOn}" Value="True">
<Setter Property="Text" Value="Power On"/>
<Setter Property="Background" Value="LimeGreen"/>
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock HorizontalAlignment="Stretch" Padding="0 2 0 2">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Text" Value="Laser Off"/>
<Setter Property="Background" Value="#2a2a2a"/>
<Setter Property="Foreground" Value="#bbbbbb"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLaserOn}" Value="True">
<Setter Property="Text" Value="Laser On"/>
<Setter Property="Background" Value="LimeGreen"/>
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock HorizontalAlignment="Stretch" Padding="0 2 0 2"
Text="Error">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Background" Value="#2a2a2a"/>
<Setter Property="Foreground" Value="#bbbbbb"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLaserErrStatus}" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock HorizontalAlignment="Stretch" Padding="0 2 0 2"
Text="Fatal Error">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Background" Value="#2a2a2a"/>
<Setter Property="Foreground" Value="#bbbbbb"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLaserFatalErr}" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Black"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock HorizontalAlignment="Stretch" Padding="0 2 0 2"
Text="Emission">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Background" Value="#2a2a2a"/>
<Setter Property="Foreground" Value="#bbbbbb"/>
<Setter Property="Text" Value="No Emission"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsLaserFatalErr}" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Text" Value="Is Emitting"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Grid>
<DockPanel Grid.Row="2" MinHeight="40">
<GroupBox Style="{StaticResource StGBMonitor}" Header="Temperature" MinWidth="100">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="{Binding LaserActualTemp}" Grid.Column="0" HorizontalAlignment="Right" Margin="10,5,0,0" FontSize="20"/>
<TextBlock Text="℃" Grid.Column="1" Margin="10,5,0,0" FontSize="10"/>
</StackPanel>
</GroupBox>
<GroupBox Style="{StaticResource StGBMonitor}" Header="Actual Power">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="{Binding LaserActualPower}" Grid.Column="0" HorizontalAlignment="Right" Margin="10,5,0,0" FontSize="20"/>
<TextBlock Text="%" Grid.Column="1" Margin="10,5,0,0" FontSize="10"/>
</StackPanel>
</GroupBox>
</DockPanel>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2"
Background="{StaticResource BLGPurple}"
HorizontalAlignment="Stretch"
Text="Error Message"/>
<TextBox Grid.Row="1"
Margin="5"
IsReadOnly="True"
Text="{Binding ErrorMsg}" TextWrapping="Wrap"
TextAlignment="left" VerticalContentAlignment="Top"
Padding="5">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ErrorMsgFgColor}" Value="Red">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding ErrorMsgFgColor}" Value="Yellow">
<Setter Property="Foreground" Value="Yellow"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<Grid Grid.Row="1" Grid.Column="1" Margin="3">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Grid.Row="1"
Content="Alarm&#10;Reset" Margin="2" TextBlock.TextAlignment="Center"
Command="{Binding CMD_AlarmReset}"/>
</Grid>
</Grid>
</Grid>
</GroupBox>
</UserControl>