Sic.Framework-Nanjing-Baishi/MECF.Framework.UI.Client/Ctrlib/Controls/ModuleStatusIndicator.xaml

53 lines
2.8 KiB
Plaintext
Raw Normal View History

<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.Controls.ModuleStatusIndicator"
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:MECF.Framework.UI.Client.Ctrlib.Controls"
xmlns:converters="clr-namespace:MECF.Framework.UI.Core.Converters;assembly=MECF.Framework.UI.Core"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:BoolReverseConverter x:Key="BoolReverseConverter"/>
<local:ModuleIsOnlineToBgColorConverter x:Key="IsOnlineToBdrColor"/>
<local:ModuleStatusToBackgroundColorConverter x:Key="StatusToBgColor"/>
</UserControl.Resources>
<DockPanel DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Mode=OneTime}">
<Label
DockPanel.Dock="Left"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Width="{Binding CaptionWidth}"
BorderBrush="{Binding IsOnline, Converter={StaticResource IsOnlineToBdrColor}}"
Content="{Binding Caption}"
ToolTip="{Binding ModuleDescription}"
Style="{DynamicResource TopLable_LeftTop}" HorizontalAlignment="Left">
<Label.ContextMenu>
<ContextMenu>
<MenuItem
x:Name="CmSetOnline"
Header="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.Content}"
HeaderStringFormat="Set {0} Online"
IsEnabled="{Binding IsOnline, Converter={StaticResource BoolReverseConverter}}"
Click="CmSetOnline_OnClick"/>
<MenuItem
x:Name="CmSetOffline"
Header="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.Content}"
HeaderStringFormat="Set {0} Offline"
IsEnabled="{Binding IsOnline}"
Click="CmSetOffline_OnClick"/>
</ContextMenu>
</Label.ContextMenu>
</Label>
<TextBox
DockPanel.Dock="Left"
VerticalContentAlignment="Center"
Background="{Binding Status, Converter={StaticResource StatusToBgColor}}"
Style="{StaticResource TextBox_Top}"
Text="{Binding Status, Mode=OneWay}"
IsReadOnly="True"
TextWrapping="Wrap" Margin="0,2,2,2" />
</DockPanel>
</UserControl>