116 lines
3.8 KiB
C#
116 lines
3.8 KiB
C#
|
|
using MainShell.HeightMeasure.ViewModel;
|
|||
|
|
using MainShell.Models;
|
|||
|
|
using MaxwellFramework.Core.Interfaces;
|
|||
|
|
using Stylet;
|
|||
|
|
using StyletIoC;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Collections.ObjectModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace MainShell.ParaSetting.ViewModel
|
|||
|
|
{
|
|||
|
|
internal class ParaSettingViewModel : BaseScreen, IPage
|
|||
|
|
{
|
|||
|
|
public string Name => "PageSettings";
|
|||
|
|
private const string DEVICEPOSITION = "设备点位参数";
|
|||
|
|
private const string DEVICERUNSETTING = "设备运行参数";
|
|||
|
|
private const string DEVICESAFESETTING = "设备安全参数";
|
|||
|
|
private const string DEVICEBASESETTING = "设备基础参数";
|
|||
|
|
private readonly Dictionary<string, Screen> _viewModelDict = new Dictionary<string, Screen>();
|
|||
|
|
public ObservableCollection<MenuItemWrap> MenuItemWraps { get; private set; }
|
|||
|
|
|
|||
|
|
private MenuItemWrap _selectedMenuItem;
|
|||
|
|
|
|||
|
|
public MenuItemWrap SelectedMenuItem
|
|||
|
|
{
|
|||
|
|
get { return _selectedMenuItem; }
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (SetAndNotify(ref _selectedMenuItem, value))
|
|||
|
|
{
|
|||
|
|
CurrentScreen = _viewModelDict[value.Header];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
private Screen _currentScreen;
|
|||
|
|
|
|||
|
|
public Screen CurrentScreen
|
|||
|
|
{
|
|||
|
|
get { return _currentScreen; }
|
|||
|
|
set { SetAndNotify(ref _currentScreen, value); }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DeviceRunSettingViewModel _deviceRunSettingViewModel;
|
|||
|
|
[Inject]
|
|||
|
|
public DeviceRunSettingViewModel DeviceRunSettingViewModel
|
|||
|
|
{
|
|||
|
|
get { return _deviceRunSettingViewModel; }
|
|||
|
|
set { _deviceRunSettingViewModel = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DevicePositionViewModel _devicePositionViewModel;
|
|||
|
|
[Inject]
|
|||
|
|
public DevicePositionViewModel DevicePositionViewModel
|
|||
|
|
{
|
|||
|
|
get { return _devicePositionViewModel; }
|
|||
|
|
set { _devicePositionViewModel = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DeviceFoundationViewModel _deviceFoundationViewModel;
|
|||
|
|
[Inject]
|
|||
|
|
public DeviceFoundationViewModel DeviceFoundationViewModel
|
|||
|
|
{
|
|||
|
|
get { return _deviceFoundationViewModel; }
|
|||
|
|
set { _deviceFoundationViewModel = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DeviceSafetyViewModel _deviceSafetyViewModel;
|
|||
|
|
[Inject]
|
|||
|
|
public DeviceSafetyViewModel DeviceSafetyViewModel
|
|||
|
|
{
|
|||
|
|
get { return _deviceSafetyViewModel; }
|
|||
|
|
set { _deviceSafetyViewModel = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public ParaSettingViewModel()
|
|||
|
|
{
|
|||
|
|
InitMenuItems();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void OnViewLoaded()
|
|||
|
|
{
|
|||
|
|
base.OnViewLoaded();
|
|||
|
|
if (_viewModelDict.Count == 0)
|
|||
|
|
{
|
|||
|
|
InitViewModelDict();
|
|||
|
|
}
|
|||
|
|
if (SelectedMenuItem == null)
|
|||
|
|
SelectedMenuItem = MenuItemWraps[0];
|
|||
|
|
}
|
|||
|
|
private void InitMenuItems()
|
|||
|
|
{
|
|||
|
|
MenuItemWraps = new ObservableCollection<MenuItemWrap>
|
|||
|
|
{
|
|||
|
|
new MenuItemWrap() { Header=DEVICEPOSITION,Tag=DEVICEPOSITION },
|
|||
|
|
|
|||
|
|
new MenuItemWrap() { Header=DEVICERUNSETTING,Tag=DEVICERUNSETTING },
|
|||
|
|
|
|||
|
|
new MenuItemWrap() { Header=DEVICESAFESETTING,Tag=DEVICESAFESETTING },
|
|||
|
|
|
|||
|
|
new MenuItemWrap() { Header=DEVICEBASESETTING,Tag=DEVICEBASESETTING },
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
private void InitViewModelDict()
|
|||
|
|
{
|
|||
|
|
_viewModelDict.Clear();
|
|||
|
|
_viewModelDict.Add(DEVICEPOSITION, DevicePositionViewModel);
|
|||
|
|
_viewModelDict.Add(DEVICERUNSETTING, DeviceRunSettingViewModel);
|
|||
|
|
_viewModelDict.Add(DEVICESAFESETTING, DeviceSafetyViewModel);
|
|||
|
|
_viewModelDict.Add(DEVICEBASESETTING, DeviceFoundationViewModel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|