50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using LiveCharts.Defaults;
|
|
using LiveCharts.Wpf;
|
|
using LiveCharts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using InSituLaboratory.Models;
|
|
using InSituLaboratory.Entities.ExperimentalStationEntities;
|
|
using Prism.Regions;
|
|
using InSituLaboratory.IService;
|
|
|
|
namespace InSituLaboratory.ViewModels.Pages
|
|
{
|
|
public class DashboardViewModel : ViewModelBase
|
|
{
|
|
#region 实体类
|
|
public SysStatusModel SysStatusModel { get; set; } = new SysStatusModel();
|
|
|
|
#endregion
|
|
|
|
ISysStatusService _sysStatusService;
|
|
public DashboardViewModel(IRegionManager regionManager, ISysStatusService isysStatusService) : base(regionManager)
|
|
{
|
|
PageTitle = "数据中心";
|
|
IsCanClose = false;
|
|
_sysStatusService = isysStatusService;
|
|
|
|
this.Refresh();
|
|
}
|
|
|
|
public override void Refresh()
|
|
{
|
|
var sysStatuslist = _sysStatusService.GetSysStauts().ToList();
|
|
if (sysStatuslist.Count() != 0)
|
|
{
|
|
var data = _sysStatusService.GetSysStauts().First();
|
|
|
|
SysStatusModel.PackagingTime = data.PackagingTime;
|
|
SysStatusModel.SamplingTime = data.SamplingTime;
|
|
SysStatusModel.Voltage48 = data.Voltage48;
|
|
SysStatusModel.Current48 = data.Current48;
|
|
SysStatusModel.BaseStation48VLeakageCS = data.BaseStation48VLeakageCS;
|
|
}
|
|
}
|
|
}
|
|
}
|