[UI.Client]

新增Heater电阻显示控件。
This commit is contained in:
SL 2023-07-19 18:59:24 +08:00
parent d425b908c8
commit 38010aa936
3 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,71 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.Controls.HeaterResPresenter"
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:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
xmlns:ioDevice="clr-namespace:Aitex.Core.Common.DeviceData.IoDevice;assembly=MECF.Framework.Common"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance Type=ioDevice:IoPsuData, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<local:IoPsuResistanceSummaryConverter x:Key="resSummaryConverter" />
</UserControl.Resources>
<Grid Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="23" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0" />
<ColumnDefinition />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="70" />
</Grid.ColumnDefinitions>
<Border
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Padding="5,1"
Background="{DynamicResource Table_BG_Title_Inner}"
BorderBrush="{DynamicResource Table_BD}"
BorderThickness="1,0,1,1">
<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="{Binding Caption,
RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}"
TextWrapping="Wrap" />
</Border>
<Border
Grid.Row="0"
Grid.Column="2"
Padding="5,1"
Background="{DynamicResource Table_BG_Content_Inner}"
BorderBrush="{DynamicResource Table_BD}"
BorderThickness="0,0,1,1">
<deviceControl:AITSensor
HorizontalAlignment="Center"
VerticalAlignment="Center"
CustomColorOff="Lime"
CustomColorOn="Red"
IsCustomRender="True"
LightOnValue="{Binding IsResistanceOutOfRange}" />
</Border>
<Border
Grid.Row="0"
Grid.Column="3"
Padding="5,1"
Background="{DynamicResource Table_BG_Content_Inner}"
BorderBrush="{DynamicResource Table_BD}"
BorderThickness="0,0,1,1">
<TextBlock Text="{Binding Resistance, StringFormat={}{0:F1}}"
ToolTip="{Binding Converter={StaticResource resSummaryConverter}}" />
</Border>
</Grid>
</UserControl>

View File

@ -0,0 +1,56 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using Aitex.Core.Common.DeviceData.IoDevice;
namespace MECF.Framework.UI.Client.Ctrlib.Controls
{
/// <summary>
/// Interaction logic for HeaterResistanceOverview.xaml
/// </summary>
public partial class HeaterResPresenter : UserControl
{
public HeaterResPresenter()
{
InitializeComponent();
}
#region Dps
public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register(
nameof(Caption), typeof(string), typeof(HeaterResPresenter), new PropertyMetadata(default(string)));
public string Caption
{
get => (string)GetValue(CaptionProperty);
set => SetValue(CaptionProperty, value);
}
#endregion
}
internal class IoPsuResistanceSummaryConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IoPsuData data)
{
return $"Realtime: {data.Resistance:F1}Ω" +
$"\r\nLimit High: {data.ResistanceLimitMax:F1}Ω" +
$"\r\nVoltage: {data.OutputVoltageFeedback:F1}V" +
$"\r\nAmps: {data.OutputArmsFeedBack:F1}A";
}
else
{
return "";
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -244,6 +244,9 @@
<Compile Include="CenterViews\Modules\PM\ProcessMonitorView.xaml.cs" />
<Compile Include="CenterViews\Modules\PM\ProcessMonitorViewModel.cs" />
<Compile Include="CenterViews\Modules\PM\ShowCloseMonitorWinEvent.cs" />
<Compile Include="Ctrlib\Controls\HeaterResPresenter.xaml.cs">
<DependentUpon>HeaterResPresenter.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrlib\Controls\PanelLocker.xaml.cs">
<DependentUpon>PanelLocker.xaml</DependentUpon>
</Compile>
@ -885,6 +888,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Ctrlib\Controls\HeaterResPresenter.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="RecipeEditorLib\DGExtension\DataGridRecipe.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>