You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aucma.Scada/Aucma.Scada.UI/viewModel/InventoryInfo/InventoryInfoViewModel.cs

77 lines
2.0 KiB
C#

using Aucma.Scada.UI.Page.InventoryInfo;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HighWayIot.Log4net;
using System;
namespace Aucma.Scada.UI.viewModel.InventoryInfo
{
public class InventoryInfoViewModel : ViewModelBase
{
private LogHelper logHelper = LogHelper.Instance;
private ShellInventory shellInventory = new ShellInventory();
private LinerInventory linerInventory = new LinerInventory();
public InventoryInfoViewModel()
{
InventoryOnClickCommand = new RelayCommand<object>(obj => InventoryOnClick(obj));
InventoryControl = shellInventory;
}
#region 参数定义
public System.Windows.Controls.UserControl _content;
public System.Windows.Controls.UserControl InventoryControl
{
get { return _content; }
set
{
_content = value;
RaisePropertyChanged(nameof(InventoryControl));
}
}
#endregion
#region 事件定义
/// <summary>
/// 界面跳转按钮事件
/// </summary>
public RelayCommand<object> InventoryOnClickCommand { get; set; }
#endregion
/// <summary>
/// 逻辑实现
/// </summary>
private void InventoryOnClick(object obj)
{
try
{
string info = obj as string;
switch (info)
{
case "shellInventory":
InventoryControl = shellInventory;
break;
case "linerInventory":
InventoryControl = linerInventory;
break;
default:
InventoryControl = shellInventory;
break;
}
}
catch (Exception ex)
{
logHelper.Error("界面跳转逻辑异常", ex);
}
}
}
}