回差值和界面功能增加
This commit is contained in:
@@ -205,6 +205,7 @@ namespace CapMachine.Wpf
|
|||||||
containerRegistry.RegisterDialog<DialogPIDConfigView, DialogPIDConfigViewModel>();
|
containerRegistry.RegisterDialog<DialogPIDConfigView, DialogPIDConfigViewModel>();
|
||||||
containerRegistry.RegisterDialog<DialogLimitConfigView, DialogLimitConfigViewModel>();
|
containerRegistry.RegisterDialog<DialogLimitConfigView, DialogLimitConfigViewModel>();
|
||||||
containerRegistry.RegisterDialog<DialogSuperHeatCoolConfigView, DialogSuperHeatCoolConfigViewModel>();
|
containerRegistry.RegisterDialog<DialogSuperHeatCoolConfigView, DialogSuperHeatCoolConfigViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<DialogTherdyConfigView, DialogTherdyConfigViewModel>();
|
||||||
containerRegistry.RegisterDialog<DialogLogicRuleView, DialogLogicRuleViewModel>();
|
containerRegistry.RegisterDialog<DialogLogicRuleView, DialogLogicRuleViewModel>();
|
||||||
containerRegistry.RegisterDialog<DialogCanLinConfigImExportView, DialogCanLinConfigImExportViewModel>();
|
containerRegistry.RegisterDialog<DialogCanLinConfigImExportView, DialogCanLinConfigImExportViewModel>();
|
||||||
containerRegistry.RegisterDialog<DialogCANFdSchConfigView, DialogCANFdSchConfigViewModel>();
|
containerRegistry.RegisterDialog<DialogCANFdSchConfigView, DialogCANFdSchConfigViewModel>();
|
||||||
|
|||||||
15
CapMachine.Wpf/Models/PPCalc/TherdyConfigModel.cs
Normal file
15
CapMachine.Wpf/Models/PPCalc/TherdyConfigModel.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.PPCalc
|
||||||
|
{
|
||||||
|
public class TherdyConfigModel : BindableBase
|
||||||
|
{
|
||||||
|
private double _h3TempOffset_C = -10.0;
|
||||||
|
|
||||||
|
public double H3TempOffset_C
|
||||||
|
{
|
||||||
|
get { return _h3TempOffset_C; }
|
||||||
|
set { _h3TempOffset_C = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,6 +62,9 @@ namespace CapMachine.Wpf.Services
|
|||||||
case "过热度/过冷度配置":
|
case "过热度/过冷度配置":
|
||||||
ShowSuperHeatCool(msg.Par);
|
ShowSuperHeatCool(msg.Par);
|
||||||
break;
|
break;
|
||||||
|
case "COP物性参数回差":
|
||||||
|
ShowTherdyConfig(msg.Par);
|
||||||
|
break;
|
||||||
case "规则转换":
|
case "规则转换":
|
||||||
if (SysRunServer.MachineRunState1.IsRunState)
|
if (SysRunServer.MachineRunState1.IsRunState)
|
||||||
{
|
{
|
||||||
@@ -104,7 +107,19 @@ namespace CapMachine.Wpf.Services
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// COP物性参数回差配置弹窗
|
||||||
|
/// </summary>
|
||||||
|
private void ShowTherdyConfig(object par)
|
||||||
|
{
|
||||||
|
DialogService.ShowDialog("DialogTherdyConfigView", new DialogParameters() { { "Name", par } }, (dialogResult) =>
|
||||||
|
{
|
||||||
|
if (dialogResult.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
PPCService.ReloadTherdyH3TempOffset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 过热度和过冷度配置弹窗
|
/// 过热度和过冷度配置弹窗
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace CapMachine.Wpf.Services
|
|||||||
new NavigationItem("", "计算信息","",new ObservableCollection<NavigationItem>()
|
new NavigationItem("", "计算信息","",new ObservableCollection<NavigationItem>()
|
||||||
{
|
{
|
||||||
new NavigationItem("SuperHeatCool","过热度/过冷度配置","DialogSuperHeatCoolConfigView"),
|
new NavigationItem("SuperHeatCool","过热度/过冷度配置","DialogSuperHeatCoolConfigView"),
|
||||||
|
new NavigationItem("","COP物性参数回差","DialogTherdyConfigView"),
|
||||||
//new NavigationItem("Palette","过冷度",""),
|
//new NavigationItem("Palette","过冷度",""),
|
||||||
}),
|
}),
|
||||||
new NavigationItem("", "规则设置","",new ObservableCollection<NavigationItem>()
|
new NavigationItem("", "规则设置","",new ObservableCollection<NavigationItem>()
|
||||||
|
|||||||
114
CapMachine.Wpf/ViewModels/DialogTherdyConfigViewModel.cs
Normal file
114
CapMachine.Wpf/ViewModels/DialogTherdyConfigViewModel.cs
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
using CapMachine.Core;
|
||||||
|
using CapMachine.Wpf.Models.PPCalc;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.ViewModels
|
||||||
|
{
|
||||||
|
public class DialogTherdyConfigViewModel : DialogViewModel
|
||||||
|
{
|
||||||
|
private const string H3TempOffsetConfigKey = "Therdy_H3TempOffset_C";
|
||||||
|
|
||||||
|
public DialogTherdyConfigViewModel()
|
||||||
|
{
|
||||||
|
TherdyConfig = new TherdyConfigModel();
|
||||||
|
LoadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _h3TempOffsetText = string.Empty;
|
||||||
|
public string H3TempOffsetText
|
||||||
|
{
|
||||||
|
get { return _h3TempOffsetText; }
|
||||||
|
set { _h3TempOffsetText = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public TherdyConfigModel TherdyConfig { get; set; }
|
||||||
|
|
||||||
|
private DelegateCommand saveCmd;
|
||||||
|
public DelegateCommand SaveCmd
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (saveCmd == null)
|
||||||
|
{
|
||||||
|
saveCmd = new DelegateCommand(SaveCmdMethod);
|
||||||
|
}
|
||||||
|
return saveCmd;
|
||||||
|
}
|
||||||
|
set { saveCmd = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DelegateCommand cancelCmd;
|
||||||
|
public DelegateCommand CancelCmd
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (cancelCmd == null)
|
||||||
|
{
|
||||||
|
cancelCmd = new DelegateCommand(CancelCmdMethod);
|
||||||
|
}
|
||||||
|
return cancelCmd;
|
||||||
|
}
|
||||||
|
set { cancelCmd = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadConfig()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string raw = ConfigHelper.GetValue(H3TempOffsetConfigKey);
|
||||||
|
if (!string.IsNullOrWhiteSpace(raw) && double.TryParse(raw, NumberStyles.Float, CultureInfo.InvariantCulture, out var v))
|
||||||
|
{
|
||||||
|
TherdyConfig.H3TempOffset_C = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
H3TempOffsetText = TherdyConfig.H3TempOffset_C.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveConfig()
|
||||||
|
{
|
||||||
|
ConfigHelper.SetValue(H3TempOffsetConfigKey, TherdyConfig.H3TempOffset_C.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveCmdMethod()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!double.TryParse(H3TempOffsetText, NumberStyles.Float, CultureInfo.InvariantCulture, out var offsetC))
|
||||||
|
{
|
||||||
|
MessageBox.Show("回差值格式不正确,请输入数字(例如 -10)。", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TherdyConfig.H3TempOffset_C = offsetC;
|
||||||
|
SaveConfig();
|
||||||
|
DialogParameters pars = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "H3TempOffset_C", TherdyConfig.H3TempOffset_C }
|
||||||
|
};
|
||||||
|
RaiseRequestClose(new DialogResult(ButtonResult.OK, pars));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelCmdMethod()
|
||||||
|
{
|
||||||
|
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
LoadConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
CapMachine.Wpf/Views/DialogTherdyConfigView.xaml
Normal file
59
CapMachine.Wpf/Views/DialogTherdyConfigView.xaml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="CapMachine.Wpf.Views.DialogTherdyConfigView"
|
||||||
|
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.Wpf.Views"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Width="800"
|
||||||
|
Height="240"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<StackPanel
|
||||||
|
Margin="20"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Margin="10,0,10,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="26"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="DimGray"
|
||||||
|
Text="排气压力饱和温度回差(℃):" />
|
||||||
|
<TextBox
|
||||||
|
Width="160"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
FontSize="24"
|
||||||
|
Text="{Binding H3TempOffsetText, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="0,10,20,10"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Button
|
||||||
|
Margin="10,0"
|
||||||
|
Command="{Binding SaveCmd}"
|
||||||
|
Content="确定"
|
||||||
|
Foreground="White" />
|
||||||
|
<Button
|
||||||
|
Margin="10,0"
|
||||||
|
Command="{Binding CancelCmd}"
|
||||||
|
Content="取消"
|
||||||
|
Foreground="White" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
12
CapMachine.Wpf/Views/DialogTherdyConfigView.xaml.cs
Normal file
12
CapMachine.Wpf/Views/DialogTherdyConfigView.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Views
|
||||||
|
{
|
||||||
|
public partial class DialogTherdyConfigView : UserControl
|
||||||
|
{
|
||||||
|
public DialogTherdyConfigView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user