134 lines
4.9 KiB
C#
134 lines
4.9 KiB
C#
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.Collections.ObjectModel;
|
||
|
||
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("LogView");
|
||
break;
|
||
case "用户登录":
|
||
this.regionManager.Regions["ContentRegion"].RequestNavigate("LoginView");
|
||
//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());
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|