89 lines
2.3 KiB
C#
89 lines
2.3 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 实体类
|
|
/// <summary>
|
|
/// 组包时间
|
|
/// </summary>
|
|
private DateTime? _packagingTime;
|
|
public DateTime? PackagingTime
|
|
{
|
|
get { return _packagingTime; }
|
|
set { SetProperty(ref _packagingTime, value); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 采样时间
|
|
/// </summary>
|
|
private DateTime? _samplingTime;
|
|
public DateTime? SamplingTime
|
|
{
|
|
get { return _samplingTime; }
|
|
set { SetProperty(ref _samplingTime, value); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 48V 电压
|
|
/// </summary>
|
|
private float? _voltage48;
|
|
public float? Voltage48
|
|
{
|
|
get { return _voltage48; }
|
|
set { SetProperty(ref _voltage48, value); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 48V 电流
|
|
/// </summary>
|
|
private float? _current48;
|
|
public float? Current48
|
|
{
|
|
get { return _current48; }
|
|
set { SetProperty(ref _current48, value); }
|
|
}
|
|
|
|
|
|
|
|
#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();
|
|
|
|
PackagingTime = data.PackagingTime;
|
|
SamplingTime = data.SamplingTime;
|
|
Voltage48 = data.Voltage48;
|
|
Current48 = data.Current48;
|
|
}
|
|
}
|
|
}
|
|
}
|