增加公共操作的方法,过热度和过冷度的配置弹窗设置

This commit is contained in:
2025-01-06 17:55:01 +08:00
parent ff07461818
commit 82ee066300
18 changed files with 673 additions and 43 deletions

View File

@@ -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>
/// 导航到页面信息