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.

63 lines
1.7 KiB
C#

using Aucma.Scada.UI.Page.InventoryInfo;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using System;
namespace Aucma.Scada.UI.ViewModel.InventoryInfo
{
public partial class InventoryInfoViewModel : ObservableObject
{
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(InventoryInfoViewModel));
private ShellInventory shellInventory = new ShellInventory();
private LinerInventory linerInventory = new LinerInventory();
public InventoryInfoViewModel()
{
InventoryControl = shellInventory;
}
#region 参数定义
public System.Windows.Controls.UserControl _content;
public System.Windows.Controls.UserControl InventoryControl
{
get => _content;
set => SetProperty(ref _content, value);
}
#endregion
/// <summary>
/// 逻辑实现
/// </summary>
[RelayCommand]
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);
}
}
}
}