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 /// /// 逻辑实现 /// [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); } } } }