This commit is contained in:
2025-10-29 11:42:58 +08:00
parent 7f6f84cd0e
commit a178c3550e
190 changed files with 81361 additions and 92 deletions

View File

@@ -0,0 +1,136 @@
using FATrace.WPLApp.Core;
using FATrace.WPLApp.ModelDto;
using FATrace.WPLApp.Services;
using FATrace.WPLApp.Views;
using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FATrace.WPLApp.ViewModels
{
public class MainViewModel : NavigationViewModel
{
public MainViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator, NavigationServices navigationServices)
{
this.regionManager = regionManager;
DialogService = dialogService;
NavigationServices = navigationServices;
NavigationItems = NavigationServices.NavItemDtos;
this.regionManager.RegisterViewWithRegion("FootRegion", typeof(FootView));
this.regionManager.RegisterViewWithRegion("HeadRegion", typeof(HeadView));
//this.regionManager.RegisterViewWithRegion("ContentRegion", typeof(ProFlowView));
}
private IRegionManager regionManager { get; set; }
public IDialogService DialogService { get; }
public NavigationServices NavigationServices { get; }
public ObservableCollection<NavItemDto> NavigationItems { get; set; }
private string titel = string.Empty;
/// <summary>
/// 标题
/// </summary>
public string Title
{
get { return titel; }
set { titel = value; RaisePropertyChanged(); }
}
private DelegateCommand<object> _OpenCommand;
/// <summary>
/// 命令
/// </summary>
public DelegateCommand<object> OpenCommand
{
get
{
if (_OpenCommand == null)
{
_OpenCommand = new DelegateCommand<object>((p) => OpenCommandMethod(p));
}
return _OpenCommand;
}
}
private void OpenCommandMethod(object obj)
{
switch (obj.ToString())
{
case "Dashboard":
this.regionManager.Regions["ContentRegion"].RequestNavigate("DashBoardView");
//this.regionManager.Regions["ContentRegion"].Activate(viewA);
break;
case "3D工艺流程":
this.regionManager.Regions["ContentRegion"].RequestNavigate("ProFlowView");
//this.regionManager.Regions["DriveTree"].RequestNavigate("DeviceProtocolTreeView");
//this.regionManager.Regions["ContentRegion"].Activate(viewB);
break;
case "管道线路":
DialogService.ShowDialog("DialogLineSelectView", new DialogParameters() { { "TabIndex", "SeletedGroupTabIndex" } }, (par) =>
{
if (par.Result == ButtonResult.OK)
{
//程序名称
var ReturnValue = par.Parameters.GetValue<string>("Name");
//返回数据刷新Chart
}
else if (par.Result == ButtonResult.Cancel)
{
//取消
}
});
break;
case "报表数据":
this.regionManager.Regions["ContentRegion"].RequestNavigate("ReportView");
//this.regionManager.Regions["ContentRegion"].Activate(viewB);
break;
case "原料使用查询":
this.regionManager.Regions["ContentRegion"].RequestNavigate("RawProUseView");
break;
case "原料入库查询":
this.regionManager.Regions["ContentRegion"].RequestNavigate("RawProInputView");
break;
case "历史报警":
this.regionManager.Regions["ContentRegion"].RequestNavigate("HistoryAlarmView");
//this.regionManager.Regions["ContentRegion"].Activate(viewB);
break;
case "用户登录":
this.regionManager.Regions["ContentRegion"].RequestNavigate("UserView");
//this.regionManager.Regions["ContentRegion"].Activate(Shift);
break;
case "使用手册":
this.regionManager.Regions["ContentRegion"].RequestNavigate("HelpManualView");
//弹窗
break;
default:
break;
}
//this.regionManager.RegisterViewWithRegion("ContentRegion", typeof(CoreShift.Views.Shift.Index));
//MessageBox.Show(obj.ToString());
}
}
}