增加公共操作的方法,过热度和过冷度的配置弹窗设置
This commit is contained in:
@@ -16,11 +16,12 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// </summary>
|
||||
public class DialogExpInfoViewModel : DialogViewModel
|
||||
{
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql,PPCService pPCService, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
this.Title = "试验信息拓展设置";
|
||||
ConfigService = configService;
|
||||
FreeSql = freeSql;
|
||||
PPCService = pPCService;
|
||||
this.Mapper = mapper;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
|
||||
@@ -37,6 +38,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// FreeSql
|
||||
/// </summary>
|
||||
public IFreeSql FreeSql { get; }
|
||||
public PPCService PPCService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// AutoMap映射
|
||||
@@ -140,7 +142,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
ExpInfoDtoItems.Add(new ExpInfoDto()
|
||||
{
|
||||
|
||||
RfNo = PPCService.SuperHeatCoolConfig.Cryogen,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
202
CapMachine.Wpf/ViewModels/DialogSuperHeatCoolConfigViewModel.cs
Normal file
202
CapMachine.Wpf/ViewModels/DialogSuperHeatCoolConfigViewModel.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Models.PPCalc;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using NPOI.HPSF;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class DialogSuperHeatCoolConfigViewModel : DialogViewModel
|
||||
{
|
||||
public DialogSuperHeatCoolConfigViewModel(PPCService pPCService)
|
||||
{
|
||||
Title = "过热度/过冷度设置";
|
||||
PPCService = pPCService;
|
||||
|
||||
SuperHeatCoolConfig = PPCService.SuperHeatCoolConfig;
|
||||
|
||||
CryogenComboBoxList = new List<ComboBoxModel>()
|
||||
{
|
||||
new ComboBoxModel(){Key="0",Text="R134a" },
|
||||
new ComboBoxModel(){Key="1",Text="R1234yf" },
|
||||
};
|
||||
}
|
||||
|
||||
private List<ComboBoxModel> _CryogenComboBoxList;
|
||||
/// <summary>
|
||||
/// 制冷剂下拉框列表
|
||||
/// </summary>
|
||||
public List<ComboBoxModel> CryogenComboBoxList
|
||||
{
|
||||
get { return _CryogenComboBoxList; }
|
||||
set { _CryogenComboBoxList = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前的过热度和过冷度的配置
|
||||
/// </summary>
|
||||
public SuperHeatCoolConfigModel SuperHeatCoolConfig { get; set; }
|
||||
|
||||
|
||||
private DelegateCommand _OpenSuperHeatCoolPathCmd;
|
||||
/// <summary>
|
||||
/// 打开过热度和过冷度的文件指令
|
||||
/// </summary>
|
||||
public DelegateCommand OpenSuperHeatCoolPathCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_OpenSuperHeatCoolPathCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_OpenSuperHeatCoolPathCmd == null)
|
||||
{
|
||||
_OpenSuperHeatCoolPathCmd = new DelegateCommand(() => OpenSuperHeatCoolPathCmdMethod());
|
||||
}
|
||||
return _OpenSuperHeatCoolPathCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 打开过热度和过冷度的文件文件信息
|
||||
/// </summary>
|
||||
private void OpenSuperHeatCoolPathCmdMethod()
|
||||
{
|
||||
//DbcFilePath
|
||||
try
|
||||
{
|
||||
var TargetFilePath = GetFilePath();
|
||||
if (!string.IsNullOrEmpty(TargetFilePath))
|
||||
{
|
||||
SuperHeatCoolConfig.FluidsPath = TargetFilePath;
|
||||
}
|
||||
//System.Diagnostics.Process.Start(fileName);//打开指定路径下的文件
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show("可能未选择文件路径", "提示", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取保存文件的路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetFilePath()
|
||||
{
|
||||
using (var folderBrowserDialog = new FolderBrowserDialog())
|
||||
{
|
||||
folderBrowserDialog.Description = "请选择一个文件夹";
|
||||
folderBrowserDialog.ShowNewFolderButton = true;
|
||||
|
||||
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
string selectedPath = folderBrowserDialog.SelectedPath;
|
||||
// 处理选中的文件夹路径
|
||||
return selectedPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "Name", Name }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
|
||||
public PPCService PPCService { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
//Name = parameters.GetValue<string>("Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,29 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Core.IService;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class MainViewModel : NavigationViewModel
|
||||
{
|
||||
public MainViewModel(IRegionManager region, INavigationMenuService menuService, SysRunService sysService)
|
||||
public MainViewModel(IRegionManager region, INavigationMenuService menuService, SysRunService sysService, IEventAggregator eventAggregator)
|
||||
{
|
||||
this.region = region;
|
||||
MenuService = menuService;
|
||||
SysService = sysService;
|
||||
EventAggregator = eventAggregator;
|
||||
NavigateCommand = new DelegateCommand<NavigationItem>(Navigate);
|
||||
}
|
||||
|
||||
public INavigationMenuService MenuService { get; }
|
||||
public SysRunService SysService { get; }
|
||||
public IEventAggregator EventAggregator { get; }
|
||||
public DelegateCommand<NavigationItem> NavigateCommand { get; private set; }
|
||||
|
||||
private int selectedIndex = -1;
|
||||
@@ -59,6 +64,38 @@ namespace CapMachine.Wpf.ViewModels
|
||||
IsTopDrawerOpen = false;
|
||||
}
|
||||
|
||||
private DelegateCommand<string> _TopDrawerCmd;
|
||||
/// <summary>
|
||||
/// 顶部弹窗按钮命令
|
||||
/// </summary>
|
||||
public DelegateCommand<string> TopDrawerCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_TopDrawerCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_TopDrawerCmd == null)
|
||||
{
|
||||
_TopDrawerCmd = new DelegateCommand<string>((p) => TopDrawerCmdCall(p));
|
||||
}
|
||||
return _TopDrawerCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 弹窗数据
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
private void TopDrawerCmdCall(string Name)
|
||||
{
|
||||
//测试数据
|
||||
IsTopDrawerOpen = false;
|
||||
|
||||
EventAggregator.GetEvent<ComDialogEvent>().Publish(new ComDialogMsg() { Name = Name, Par = null });
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导航到页面信息
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <param name="machineRtDataService"></param>
|
||||
/// <param name="dialogService"></param>
|
||||
public MonitorViewModel(ConfigService configService, IEventAggregator eventAggregator,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, AlarmService alarmService,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, AlarmService alarmService,PPCService pPCService,
|
||||
MachineRtDataService machineRtDataService, IDialogService dialogService)
|
||||
{
|
||||
ConfigService = configService;
|
||||
@@ -35,6 +35,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
DataRecordService = dataRecordService;
|
||||
SysRunServer = sysRunService;
|
||||
AlarmService = alarmService;
|
||||
PPCService = pPCService;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
DialogService = dialogService;
|
||||
TagManager = MachineRtDataService.TagManger;
|
||||
@@ -69,6 +70,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
public DataRecordService DataRecordService { get; }
|
||||
public SysRunService SysRunServer { get; }
|
||||
public AlarmService AlarmService { get; }
|
||||
public PPCService PPCService { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
public List<ChartRtValue> ListChartRtValue { get; set; } = new List<ChartRtValue>()
|
||||
@@ -239,11 +241,14 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
MachineRtDataService.SysMute();
|
||||
|
||||
//ShowDialogExpInfo();
|
||||
//ShowDialogExpInfo();
|
||||
break;
|
||||
case "试验信息":
|
||||
ShowDialogExpInfo();
|
||||
break;
|
||||
case "SuperHeatCool":
|
||||
//ShowSuperHeatCool();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -441,7 +446,9 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 试验信息弹窗
|
||||
/// </summary>
|
||||
private void ShowDialogExpInfo()
|
||||
{
|
||||
//弹窗
|
||||
@@ -463,6 +470,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取曲线的实时值
|
||||
/// 数据是发布过来
|
||||
|
||||
Reference in New Issue
Block a user