20211010_CZPM_upperpc/垂直剖面动态观测系统/ViewModel/ListPageViewModel.cs
2023-07-27 11:01:29 +08:00

83 lines
2.4 KiB
C#

using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using .Common;
namespace .ViewModel
{
public class ListPageViewModel : NotifyBase
{
private FrameworkElement _mainContent;
public FrameworkElement MainContent
{
get { return _mainContent; }
set { _mainContent = value; this.DoNotify(); }
}
public CommandBase NavChangedCommand { get; set; }
public ListPageViewModel()
{
//初始化
this.NavChangedCommand = new CommandBase();
this.NavChangedCommand.DoExcute = new Action<object>(DoNavChanged);
//按钮是否可用
this.NavChangedCommand.DoCanExcute = new Func<object, bool>((o) => true);
}
public void DoNavChanged(object obj)
{
GlobalValues.Flash_LIST(obj.ToString(), null, null);
//ClearMemory();
Type type = Type.GetType("垂直剖面动态观测系统.View." + "ParameterView");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
this.MainContent = (FrameworkElement)cti.Invoke(null);
}
public ListPageViewModel(string header, List<SubItem> subItems, PackIconKind icon)
{
Header = header;
SubItems = subItems;
Icon = icon;
}
public ListPageViewModel(string header, UserControl screen, PackIconKind icon)
{
Header = header;
Screen = screen;
Icon = icon;
}
public string Header { get; private set; }
public PackIconKind Icon { get; private set; }
public List<SubItem> SubItems { get; private set; }
public UserControl Screen { get; private set; }
}
public class SubItem
{
public SubItem(string name, List<string> name_List, UserControl screen = null)
{
Name = name;
Name_List = name_List;
Screen = screen;
}
public string Name { get; private set; }
public List<string> Name_List { get; private set; }
public UserControl Screen { get; private set; }
}
}