This commit is contained in:
2024-12-18 15:50:21 +08:00
parent 684973e6b7
commit b2c54119ea
214 changed files with 65908 additions and 8461 deletions

View File

@@ -0,0 +1,48 @@
<UserControl
x:Class="CapMachine.Shared.Controls.ChartListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="800"
d:DesignWidth="360"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<ItemsControl>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ListView
x:Name="LvChartRtValueSingle"
Grid.Column="1"
Foreground="Black"
Style="{x:Null}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Name}">
<GridViewColumn.Header>
<TextBlock Background="Transparent" Text="{Binding dd}" />
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding LeftCursorValue, StringFormat={}{0:N2}}" Header="左游标" />
<GridViewColumn DisplayMemberBinding="{Binding Unit}" Header="单位" />
</GridView>
</ListView.View>
<!-- 设置ListViewItem的背景色模拟网格效果 -->
<!--<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Background" Value="LightGray" />
</Style>
</ListView.ItemContainerStyle>-->
</ListView>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CapMachine.Shared.Controls
{
/// <summary>
/// ChartListView.xaml 的交互逻辑
/// </summary>
public partial class ChartListView : UserControl
{
public ChartListView()
{
InitializeComponent();
}
}
}

View File

@@ -6,8 +6,8 @@
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="MeterInstance"
d:DesignHeight="160"
d:DesignWidth="160"
Width="130"
Height="155"
BorderBrush="Gray"
mc:Ignorable="d">
<Grid>
@@ -25,29 +25,29 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
FontSize="24"
FontSize="22"
Foreground="White"
Text="PV" />
<TextBlock
Margin="10,0,5,0"
Margin="5,0,5,0"
VerticalAlignment="Center"
FontSize="24"
FontSize="20"
Foreground="White"
Text="25.45" />
Text="{Binding ElementName=MeterInstance, Path=PVValue}" />
<TextBlock
Margin="5,0"
Margin="2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DockPanel.Dock="Right"
FontSize="14"
FontSize="12"
Foreground="White"
Text="Kg" />
Text="{Binding ElementName=MeterInstance, Path=Unit}" />
</DockPanel>
<DockPanel Margin="5,-3,5,0">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
FontSize="22"
FontSize="20"
FontStyle="Italic"
Foreground="Gold"
Text="SV" />
@@ -56,15 +56,15 @@
VerticalAlignment="Center"
FontSize="20"
Foreground="Gold"
Text="25.45" />
<TextBlock
Margin="5,0"
Text="{Binding ElementName=MeterInstance, Path=SVValue}" />
<!--<TextBlock
Margin="2,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DockPanel.Dock="Right"
FontSize="12"
Foreground="Gold"
Text="Kg" />
Text="{Binding ElementName=MeterInstance, Path=Unit}" />-->
</DockPanel>
</StackPanel>
@@ -74,15 +74,79 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="0,5,0,0">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="手自动" />
<StackPanel Margin="0,3,0,0">
<!--
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去
-->
<ToggleButton
x:Name="ToggleBtnAutoHand"
Width="40"
Click="ToggleBtnAutoHand_Click_1"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
IsChecked="{Binding ElementName=MeterInstance, Path=AutoHandState}"
Style="{StaticResource MaterialDesignSwitchToggleButton}"
ToolTip="手自动" />
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="自动" />
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}" />
</StackPanel>
<StackPanel Grid.Column="1" Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去
-->
<TextBox
x:Name="HandValueMV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueMV_KeyDown"
Text="{Binding ElementName=MeterInstance, Path=HandValueMVParameter}"
ToolTip="按【Enter】回车键才会发送生效"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="MV"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
</StackPanel>
<StackPanel Grid.Column="2" Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去
-->
<TextBox
x:Name="HandValueSV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueSV_KeyDown"
Text="{Binding ElementName=MeterInstance, Path=HandValueSVParameter}"
ToolTip="按【Enter】回车键才会发送生效"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="SV"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
</StackPanel>
</Grid>
@@ -94,9 +158,9 @@
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
FontSize="16"
Foreground="White"
Text="吸气温度" />
Text="{Binding ElementName=MeterInstance, Path=MeterName}" />
</Border>
</Grid>
</UserControl>

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@@ -18,11 +20,27 @@ namespace CapMachine.Shared.Controls
/// <summary>
/// Meter.xaml 的交互逻辑
/// </summary>
public partial class Meter : UserControl
public partial class Meter : UserControl, INotifyPropertyChanged
{
public Meter()
{
InitializeComponent();
//ToggleBtnAutoHand.Click += ToggleBtnAutoHand_Click;
}
/// <summary>
/// 未使用 直接界面Command绑定AutoHandCommand请参考界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ToggleBtnAutoHand_Click(object sender, RoutedEventArgs e)
{
if (AutoHandCommand != null && AutoHandCommand.CanExecute(AutoHandCommandParameter))
{
AutoHandCommand.Execute(AutoHandCommandParameter);
}
}
/// <summary>
@@ -42,7 +60,265 @@ namespace CapMachine.Shared.Controls
public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(Meter), new PropertyMetadata("名称"));
/// <summary>
/// SV数据
/// </summary>
public double SVValue
{
get
{
return (double)base.GetValue(Meter.SVValueProperty);
}
set
{
base.SetValue(Meter.SVValueProperty, value);
}
}
public static readonly DependencyProperty SVValueProperty = DependencyProperty.Register("SVValue", typeof(double), typeof(Meter), new PropertyMetadata(0.0));
/// <summary>
/// PV数据
/// </summary>
public double PVValue
{
get
{
return (double)base.GetValue(Meter.PVValueProperty);
}
set
{
base.SetValue(Meter.PVValueProperty, value);
}
}
public static readonly DependencyProperty PVValueProperty = DependencyProperty.Register("PVValue", typeof(double), typeof(Meter), new PropertyMetadata(0.0));
/// <summary>
/// 单位
/// </summary>
public string Unit
{
get
{
return (string)base.GetValue(Meter.UnitProperty);
}
set
{
base.SetValue(Meter.UnitProperty, value);
}
}
public static readonly DependencyProperty UnitProperty = DependencyProperty.Register("Unit", typeof(string), typeof(Meter), new PropertyMetadata(""));
/// <summary>
/// 手自动的值
/// </summary>
public bool AutoHandState
{
get
{
return (bool)base.GetValue(Meter.AutoHandStateProperty);
}
set
{
base.SetValue(Meter.AutoHandStateProperty, value);
}
}
public static readonly DependencyProperty AutoHandStateProperty = DependencyProperty.Register("AutoHandState", typeof(bool), typeof(Meter), new PropertyMetadata(false));
private string _AutoStateMsg = "自动";
/// <summary>
/// 手自动的消息
/// </summary>
public string AutoStateMsg
{
get { return _AutoStateMsg; }
set
{
_AutoStateMsg = value;
OnRaisePropertyChanged("AutoStateMsg");
}
}
//public string AutoStateMsg { get; set; } = "自动";
/// <summary>
/// 手自动切换 命令
/// </summary>
public ICommand AutoHandCommand
{
get { return (ICommand)GetValue(AutoHandCommandProperty); }
set { SetValue(AutoHandCommandProperty, value); }
}
public static readonly DependencyProperty AutoHandCommandProperty =
DependencyProperty.Register("AutoHandCommand", typeof(ICommand), typeof(Meter), new PropertyMetadata(default(ICommand)));
/// <summary>
/// AutoHandCommand 参数
/// </summary>
public object AutoHandCommandParameter
{
get
{
return (object)base.GetValue(Meter.AutoHandCommandParameterProperty);
}
set
{
base.SetValue(Meter.AutoHandCommandParameterProperty, value);
}
}
public static readonly DependencyProperty AutoHandCommandParameterProperty = DependencyProperty.Register("AutoHandCommandParameter", typeof(object), typeof(Meter), new PropertyMetadata(true));
//public event PropertyChangedEventHandler? PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// 直接更新数据
/// </summary>
/// <param name="propertyName"></param>
protected void OnRaisePropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary>
/// 手自动切换
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ToggleBtnAutoHand_Click_1(object sender, RoutedEventArgs e)
{
var control = sender as ToggleButton;
if (control != null && control.IsChecked == true)
{
AutoStateMsg = "手动";
IsHandValueShow= "Visible";
}
else
{
AutoStateMsg = "自动";
IsHandValueShow = "Hidden";
}
}
private string _IsHandValueShow= "Hidden";
/// <summary>
/// 手动设置的是值是否显示
/// </summary>
public string IsHandValueShow
{
get { return _IsHandValueShow; }
set
{
_IsHandValueShow = value;
OnRaisePropertyChanged("IsHandValueShow");
}
}
/// <summary>
/// 手自给值 命令
/// </summary>
public ICommand HandValueCommand
{
get { return (ICommand)GetValue(HandValueCommandProperty); }
set { SetValue(HandValueCommandProperty, value); }
}
public static readonly DependencyProperty HandValueCommandProperty =
DependencyProperty.Register("HandValueCommand", typeof(ICommand), typeof(Meter), new PropertyMetadata(default(ICommand)));
/// <summary>
/// 手自给值 参数 MV
/// </summary>
public object HandValueMVParameter
{
get
{
return (object)base.GetValue(Meter.HandValueMVParameterProperty);
}
set
{
base.SetValue(Meter.HandValueMVParameterProperty, value);
}
}
public static readonly DependencyProperty HandValueMVParameterProperty = DependencyProperty.Register("HandValueMVParameter", typeof(object), typeof(Meter), new PropertyMetadata(0));
/// <summary>
/// 手自给值 参数 SV
/// </summary>
public object HandValueSVParameter
{
get
{
return (object)base.GetValue(Meter.HandValueSVParameterProperty);
}
set
{
base.SetValue(Meter.HandValueSVParameterProperty, value);
}
}
public static readonly DependencyProperty HandValueSVParameterProperty = DependencyProperty.Register("HandValueSVParameter", typeof(object), typeof(Meter), new PropertyMetadata(0));
/// <summary>
/// 手动给值回车检测
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HandValueMV_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
if (HandValueCommand != null && HandValueCommand.CanExecute(HandValueMVParameter))
{
//HandValueParameter 此时无法更新到最新的值(旧值),可能因为RaisePropertyChanged在ViewModel上不受这边的控制了所以直接取控件的数据
//HandValueParameter 没有使用直接取控件的值HandValueParameter作为初始值使用
if (int.TryParse(HandValueMV.Text, out int Result))
{
//把整个控件打包发送过去无法访问Textbox的值那么直接传送模型的数据给ViewModel
HandValueCommand.Execute(new MeterChannelValue() { Name = MeterName, Value = Result,Type="MV" });
}
}
}
}
/// <summary>
/// 手动给值回车检测
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HandValueSV_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
if (HandValueCommand != null && HandValueCommand.CanExecute(HandValueSVParameter))
{
//HandValueParameter 此时无法更新到最新的值(旧值),可能因为RaisePropertyChanged在ViewModel上不受这边的控制了所以直接取控件的数据
//HandValueParameter 没有使用直接取控件的值HandValueParameter作为初始值使用
if (int.TryParse(HandValueSV.Text, out int Result))
{
//把整个控件打包发送过去无法访问Textbox的值那么直接传送模型的数据给ViewModel
HandValueCommand.Execute(new MeterChannelValue() { Name = MeterName, Value = Result, Type = "SV" });
}
}
}
}
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Shared.Controls
{
/// <summary>
/// 仪表数据传输的值
/// </summary>
public class MeterChannelValue
{
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 值
/// </summary>
public object Value { get; set; }
}
}

View File

@@ -9,7 +9,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="MeterConfigInstance"
d:DesignHeight="400"
d:DesignWidth="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<local:BoolNgConvert x:Key="BoolNgConverter" />
@@ -29,31 +29,18 @@
</Grid.RowDefinitions>
<DockPanel Background="White">
<!--<StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
<Border Background="#FF03A9F4">
<TextBlock
Margin="15,0,5,0"
Margin="0,0,5,0"
VerticalAlignment="Center"
Text="常值/斜率:" />
<ToggleButton
x:Name="TBSwitchConstSlop"
Command="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopCommand}"
CommandParameter="{Binding ElementName=TBSwitchConstSlop, Path=IsChecked}"
IsChecked="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopPar}"
Style="{StaticResource MaterialDesignSwitchToggleButton}"
ToolTip="常值和斜率选项" />
-->
<!-- IsChecked="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopPar}" -->
<!--
</StackPanel>-->
DockPanel.Dock="Right"
FontSize="18"
Foreground="White"
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}"
TextAlignment="Right" />
</Border>
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
DockPanel.Dock="Right"
FontSize="18"
Foreground="Blue"
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}"
TextAlignment="Right" />
</DockPanel>
<TabControl
x:Name="MainTabControl"
@@ -77,11 +64,29 @@
</i:EventTrigger>
</i:Interaction.Triggers>
<!-- IsEnabled="{Binding IsChecked, ElementName=TBSwitchConstSlop, Converter={StaticResource BoolNgConverter}}" -->
<TabItem Header="常值">
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<!--<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily=".../Assets/Fonts/#iconfont"
FontSize="20"
Foreground="White"
Text="&#xea1d;" />-->
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="常值" />
</StackPanel>
</TabItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
@@ -101,13 +106,37 @@
Content="确定"
Foreground="White" />
</StackPanel>
<StackPanel Grid.Row="2" VerticalAlignment="Center">
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Foreground="Gray"
Text="持续时间请参照速度时间" />
</StackPanel>
</Grid>
</TabItem>
<!-- IsEnabled="{Binding IsChecked, ElementName=TBSwitchConstSlop}" -->
<TabItem Header="斜率">
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<!--<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily=".../Assets/Fonts/#iconfont"
FontSize="20"
Foreground="White"
Text="&#xea1d;" />-->
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="斜率" />
</StackPanel>
</TabItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="55" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
@@ -116,9 +145,12 @@
<ColumnDefinition Width="0.8*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="1.4*" />
<ColumnDefinition Width="1.5*" />
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="0.8*" />
</Grid.ColumnDefinitions>
<StackPanel Margin="1,10,0,0">
<!--<StackPanel Margin="1,10,0,0">
<TextBox
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="序号"
@@ -172,10 +204,10 @@
</TextBox.ToolTip>
</TextBox>
</StackPanel>
<StackPanel Grid.Column="3" Margin="1,10,3,0">
<StackPanel Grid.Column="3" Margin="1,10,0,0">
<TextBox
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="持时间"
materialDesign:HintAssist.Hint="持时间"
FontSize="13"
FontWeight="Bold"
IsEnabled="True"
@@ -190,7 +222,83 @@
Text="维持时间" />
</TextBox.ToolTip>
</TextBox>
</StackPanel>-->
<StackPanel Margin="3,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="序号"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StepNo}"
TextWrapping="NoWrap"
ToolTip="新增时自动填充序号;可手动修改序号"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
<StackPanel Grid.Column="1" Margin="2,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="起始值"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StartValue}"
TextWrapping="NoWrap"
ToolTip="起始值"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
<StackPanel Grid.Column="2" Margin="2,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="结束值"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.EndValue}"
TextWrapping="NoWrap"
ToolTip="结束值"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
<StackPanel Grid.Column="3" Margin="2,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="持续时间"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.KeepTime, Converter={StaticResource SecToStrConverter}}"
TextWrapping="NoWrap"
ToolTip="持续时间"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
<StackPanel Grid.Column="4" Margin="2,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="PID"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.PIDNo}"
TextWrapping="NoWrap"
ToolTip="PID"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
<StackPanel Grid.Column="5" Margin="2,5,3,0">
<TextBox
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="限幅"
FontSize="16"
FontWeight="Bold"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.LimitNo}"
TextWrapping="NoWrap"
ToolTip="限幅"
VerticalScrollBarVisibility="Disabled" />
</StackPanel>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button
@@ -276,7 +384,8 @@
<ListView
x:Name="listviewMeter"
Foreground="Black"
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}">
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=MeterSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewMeter, Path=SelectedItem}" />
@@ -286,21 +395,30 @@
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
<GridViewColumn
Width="40"
Width="38"
DisplayMemberBinding="{Binding StepNo}"
Header="序号" />
<GridViewColumn
Width="60"
Width="58"
DisplayMemberBinding="{Binding StartValue}"
Header="起始值" />
<GridViewColumn
Width="60"
Width="58"
DisplayMemberBinding="{Binding EndValue}"
Header="结束值" />
<GridViewColumn
Width="100"
Width="85"
DisplayMemberBinding="{Binding KeepTime, Converter={StaticResource SecToStrConverter}}"
Header="维持时间" />
<GridViewColumn
Width="40"
DisplayMemberBinding="{Binding PIDNo}"
Header="PID" />
<GridViewColumn
Width="42"
DisplayMemberBinding="{Binding LimitNo}"
Header="限幅" />
</GridView>
</ListView.View>
@@ -314,7 +432,114 @@
</Border>
</Grid>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="其他" />
</StackPanel>
</TabItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock
Margin="5"
VerticalAlignment="Center"
FontSize="22"
Text="默认参数设置" />
</StackPanel>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Center"
Orientation="Horizontal">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock
Margin="5"
VerticalAlignment="Center"
FontSize="14"
Text="PIDNo:" />
<TextBox
Width="40"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding ElementName=MeterConfigInstance, Path=DefaultPIDNo}" />
</StackPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock
Margin="5"
VerticalAlignment="Center"
FontSize="14"
Text="限幅No:" />
<TextBox
Width="40"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding ElementName=MeterConfigInstance, Path=DefaultLimitNo}" />
</StackPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock
Margin="0,5"
VerticalAlignment="Center"
FontSize="14"
Text="报警限幅No:" />
<TextBox
Width="40"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding ElementName=MeterConfigInstance, Path=DefaultAlarmNo}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" VerticalAlignment="Center">
<TextBlock
Margin="5"
HorizontalAlignment="Center"
FontSize="14"
Foreground="Gray"
Text="默认数据将为常值配置使用"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel
Grid.Row="4"
HorizontalAlignment="Center"
Cursor=""
Orientation="Horizontal">
<Button
Margin="10,0"
Command="{Binding ElementName=MeterConfigInstance, Path=ParConfigCommand}"
CommandParameter="PID"
Content="PID参数"
Foreground="White" />
<Button
Margin="10,0"
Command="{Binding ElementName=MeterConfigInstance, Path=ParConfigCommand}"
CommandParameter="Limit"
Content="限幅参数"
Foreground="White" />
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</Grid>

View File

@@ -247,5 +247,71 @@ namespace CapMachine.Shared.Controls
}
public static readonly DependencyProperty IsTimeOkProperty = DependencyProperty.Register("IsTimeOk", typeof(bool), typeof(MeterConfig), new PropertyMetadata(false));
/// <summary>
/// PIDNo
/// </summary>
public int DefaultPIDNo
{
get
{
return (int)base.GetValue(MeterConfig.PIDNoProperty);
}
set
{
base.SetValue(MeterConfig.PIDNoProperty, value);
}
}
public static readonly DependencyProperty PIDNoProperty = DependencyProperty.Register("PIDNo", typeof(int), typeof(MeterConfig), new PropertyMetadata(1));
/// <summary>
/// DefaultLimitNo
/// </summary>
public int DefaultLimitNo
{
get
{
return (int)base.GetValue(MeterConfig.DefaultLimitNoProperty);
}
set
{
base.SetValue(MeterConfig.DefaultLimitNoProperty, value);
}
}
public static readonly DependencyProperty DefaultLimitNoProperty = DependencyProperty.Register("DefaultLimitNo", typeof(int), typeof(MeterConfig), new PropertyMetadata(1));
/// <summary>
/// DefaultAlarmNo
/// </summary>
public int DefaultAlarmNo
{
get
{
return (int)base.GetValue(MeterConfig.DefaultAlarmNoProperty);
}
set
{
base.SetValue(MeterConfig.DefaultAlarmNoProperty, value);
}
}
public static readonly DependencyProperty DefaultAlarmNoProperty = DependencyProperty.Register("DefaultAlarmNo", typeof(int), typeof(MeterConfig), new PropertyMetadata(1));
/// <summary>
/// ParConfig 命令
/// </summary>
public ICommand ParConfigCommand
{
get { return (ICommand)GetValue(ParConfigCommandProperty); }
set { SetValue(ParConfigCommandProperty, value); }
}
public static readonly DependencyProperty ParConfigCommandProperty =
DependencyProperty.Register("ParConfigCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
}
}

View File

@@ -23,5 +23,20 @@ namespace CapMachine.Shared.Controls
/// 维持时间
/// </summary>
public double KeepTime { get; set; }
/// <summary>
/// PIDNo
/// </summary>
public int PIDNo { get; set; }
/// <summary>
/// LimitNo
/// </summary>
public int LimitNo { get; set; }
/// <summary>
/// AlarmNo
/// </summary>
public int AlarmNo { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
<UserControl
x:Class="CapMachine.Shared.Controls.ValueShow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="UserControlInstance"
d:DesignHeight="46"
d:DesignWidth="110"
mc:Ignorable="d">
<StackPanel>
<StackPanel>
<TextBlock
FontSize="16"
Foreground="DarkSlateBlue"
Text="{Binding ElementName=UserControlInstance, Path=CellTitle}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Border Background="Gray" CornerRadius="4">
<TextBlock
Width="70"
Margin="2,0,0,0"
FontSize="20"
FontWeight="Bold"
Foreground="White"
Text="{Binding ElementName=UserControlInstance, Path=CellValue}" />
</Border>
<TextBlock
Margin="3,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="14"
FontWeight="Bold"
Foreground="Gray"
Text="{Binding ElementName=UserControlInstance, Path=CellUnit}" />
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CapMachine.Shared.Controls
{
/// <summary>
/// ValueShow.xaml 的交互逻辑
/// </summary>
public partial class ValueShow : UserControl
{
public ValueShow()
{
InitializeComponent();
}
/// <summary>
/// Value 数据
/// </summary>
public double CellValue
{
get
{
return (double)base.GetValue(ValueShow.CellValueProperty);
}
set
{
base.SetValue(ValueShow.CellValueProperty, value);
}
}
public static readonly DependencyProperty CellValueProperty = DependencyProperty.Register("CellValue", typeof(double), typeof(ValueShow), new PropertyMetadata(0.0));
/// <summary>
/// 单位
/// </summary>
public string CellUnit
{
get
{
return (string)base.GetValue(ValueShow.CellUnitProperty);
}
set
{
base.SetValue(ValueShow.CellUnitProperty, value);
}
}
public static readonly DependencyProperty CellUnitProperty = DependencyProperty.Register("CellUnit", typeof(string), typeof(ValueShow), new PropertyMetadata(""));
/// <summary>
/// 名称 标题
/// </summary>
public string CellTitle
{
get
{
return (string)base.GetValue(ValueShow.CellTitleProperty);
}
set
{
base.SetValue(ValueShow.CellTitleProperty, value);
}
}
public static readonly DependencyProperty CellTitleProperty = DependencyProperty.Register("CellTitle", typeof(string), typeof(ValueShow), new PropertyMetadata("DarkSlateBlue"));
}
}