完成测序仪页面的数据展示功能
This commit is contained in:
parent
e79ff5ded8
commit
1525e684e2
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LiveCharts;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
@ -70,8 +71,25 @@ namespace InSituLaboratory.Entities.Sensor
|
|||||||
public int DataIdNum { get; set; }
|
public int DataIdNum { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ChartsModel SequencerChartsTem { get; set; } = new ChartsModel()
|
||||||
|
{
|
||||||
|
Values = new ChartValues<float>(),
|
||||||
|
Value_Name = "试剂温度",
|
||||||
|
X_Time = new List<string>(),
|
||||||
|
Y_MinValue = Convert.ToInt32(tools.GetAppSetting("测序仪试剂温度Min")),
|
||||||
|
Y_MaxValue = Convert.ToInt32(tools.GetAppSetting("测序仪试剂温度Max"))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public ChartsModel SequencerChartsCon { get; set; } = new ChartsModel()
|
||||||
|
{
|
||||||
|
Values = new ChartValues<float>(),
|
||||||
|
Value_Name = "样本浓度",
|
||||||
|
X_Time = new List<string>(),
|
||||||
|
Y_MinValue = Convert.ToInt32(tools.GetAppSetting("测序仪样本浓度Min")),
|
||||||
|
Y_MaxValue = Convert.ToInt32(tools.GetAppSetting("测序仪样本浓度Max"))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,6 +159,35 @@ namespace InSituLaboratory.IService.Sensor
|
|||||||
IEnumerable<CO2IsotopsModel> GetCO2ISotopeData(string key, int pageSize, int pageIndex, out int totalCount);
|
IEnumerable<CO2IsotopsModel> GetCO2ISotopeData(string key, int pageSize, int pageIndex, out int totalCount);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 测序仪
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<SequencerModel> GetSequencer();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据--图表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<SequencerModel> GetSequencerData();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据--分页 按时间倒序排序
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<SequencerModel> GetSequencerData(string key, int pageSize, int pageIndex, out int totalCount);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -234,6 +234,49 @@ namespace InSituLaboratory.Service.Sensor
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 测序仪
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SequencerModel> GetSequencer()
|
||||||
|
{
|
||||||
|
return this.Query<SequencerModel>(m => true).OrderByDescending(n => n.CreateTime).AsNoTracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据---图表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SequencerModel> GetSequencerData()
|
||||||
|
{
|
||||||
|
return this.Query<SequencerModel>(m => true).OrderBy(m => m.CreateTime).AsNoTracking().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取测序仪数据--分页 按时间倒序排序
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SequencerModel> GetSequencerData(string key, int pageSize, int pageIndex, out int totalCount)
|
||||||
|
{
|
||||||
|
var pResult = this.QueryPage<SequencerModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
||||||
|
|
||||||
|
totalCount = pResult.TotalCount;
|
||||||
|
|
||||||
|
return pResult.DataList;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,6 @@
|
|||||||
<add key="甲烷同位素分析仪丰度Max" value="10"/>
|
<add key="甲烷同位素分析仪丰度Max" value="10"/>
|
||||||
<add key="甲烷同位素分析仪丰度Min" value="0"/>
|
<add key="甲烷同位素分析仪丰度Min" value="0"/>
|
||||||
|
|
||||||
|
|
||||||
<add key="CO2同位素分析仪光强Max" value="10"/>
|
<add key="CO2同位素分析仪光强Max" value="10"/>
|
||||||
<add key="CO2同位素分析仪光强Min" value="0"/>
|
<add key="CO2同位素分析仪光强Min" value="0"/>
|
||||||
<add key="CO2同位素分析仪激光温度Max" value="10"/>
|
<add key="CO2同位素分析仪激光温度Max" value="10"/>
|
||||||
@ -70,6 +69,11 @@
|
|||||||
<add key="CO2同位素分析仪12CO2浓度Min" value="0"/>
|
<add key="CO2同位素分析仪12CO2浓度Min" value="0"/>
|
||||||
<add key="CO2同位素分析仪12C同位素丰度Max" value="10"/>
|
<add key="CO2同位素分析仪12C同位素丰度Max" value="10"/>
|
||||||
<add key="CO2同位素分析仪12C同位素丰度Min" value="0"/>
|
<add key="CO2同位素分析仪12C同位素丰度Min" value="0"/>
|
||||||
|
|
||||||
|
<add key="测序仪试剂温度Max" value="10"/>
|
||||||
|
<add key="测序仪试剂温度Min" value="0"/>
|
||||||
|
<add key="测序仪样本浓度Max" value="10"/>
|
||||||
|
<add key="测序仪样本浓度Min" value="0"/>
|
||||||
<!--文件下载-->
|
<!--文件下载-->
|
||||||
<add key="MEMSSPFolder" value="D:\\Download\\"/>
|
<add key="MEMSSPFolder" value="D:\\Download\\"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
|||||||
@ -514,5 +514,94 @@ namespace InSituLaboratory.Base
|
|||||||
return successFlag;
|
return successFlag;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 二氧化碳同位素分析仪
|
||||||
|
/// <summary>
|
||||||
|
/// 获取类的属性集合(以便生成CSV文件的所有Column标题)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static PropertyInfo[] GetSequencerInfoArray()
|
||||||
|
{
|
||||||
|
PropertyInfo[] props = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Type type = typeof(SequencerModels);
|
||||||
|
object obj = Activator.CreateInstance(type);
|
||||||
|
props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{ }
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save the List data to CSV file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="BaseStationList">data source</param>
|
||||||
|
/// <param name="filePath">file path</param>
|
||||||
|
/// <returns>success flag</returns>
|
||||||
|
public static bool SaveSequencerDataToCSVFile(ObservableCollection<SequencerModels> BaseStationList, string filePath)
|
||||||
|
{
|
||||||
|
bool successFlag = true;
|
||||||
|
|
||||||
|
StringBuilder strColumn = new StringBuilder();
|
||||||
|
StringBuilder strValue = new StringBuilder();
|
||||||
|
StreamWriter sw = null;
|
||||||
|
PropertyInfo[] props = GetSequencerInfoArray();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sw = new StreamWriter(filePath);
|
||||||
|
for (int i = 0; i < props.Length; i++)
|
||||||
|
{
|
||||||
|
strColumn.Append(props[i].Name);
|
||||||
|
strColumn.Append(",");
|
||||||
|
}
|
||||||
|
strColumn.Remove(strColumn.Length - 1, 1);
|
||||||
|
sw.WriteLine(strColumn); //write the column name
|
||||||
|
|
||||||
|
for (int i = 0; i < BaseStationList.Count; i++)
|
||||||
|
{
|
||||||
|
strValue.Remove(0, strValue.Length); //clear the temp row value
|
||||||
|
strValue.Append(BaseStationList[i].Id);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].CreateTime);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].SamplingTime);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].Tem);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].Hum);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].Pressure);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].Insulation);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].ReagentTemperature);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].SampleConcentration);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].CurrentWorkflow);
|
||||||
|
|
||||||
|
sw.WriteLine(strValue); //write the row value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
successFlag = false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (sw != null)
|
||||||
|
{
|
||||||
|
sw.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return successFlag;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,20 @@
|
|||||||
using Prism.Regions;
|
using InSituLaboratory.Base;
|
||||||
|
using InSituLaboratory.Controls;
|
||||||
|
using InSituLaboratory.Entities;
|
||||||
|
using InSituLaboratory.Entities.Sensor;
|
||||||
|
using InSituLaboratory.IService.Sensor;
|
||||||
|
using InSituLaboratory.Models.Sendsor;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Regions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace InSituLaboratory.ViewModels.Pages.Sensor
|
namespace InSituLaboratory.ViewModels.Pages.Sensor
|
||||||
{
|
{
|
||||||
@ -12,9 +23,167 @@ namespace InSituLaboratory.ViewModels.Pages.Sensor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SequencerViewModel : ViewModelBase
|
internal class SequencerViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
public SequencerViewModel(IRegionManager regionManager) : base(regionManager)
|
#region 实体类
|
||||||
|
public SequencerModel sequencerModel { get; set; } = new SequencerModel();
|
||||||
|
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||||
|
|
||||||
|
public ObservableCollection<SequencerModel> sequencerModellist { get; set; } = new ObservableCollection<SequencerModel>();
|
||||||
|
public ObservableCollection<SequencerModels> sequencerModelslist { get; set; } = new ObservableCollection<SequencerModels>();
|
||||||
|
|
||||||
|
public DispatcherTimer timerDownloadDataMsgHidden = new DispatcherTimer();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
ISensorService _iSensorService;
|
||||||
|
public SequencerViewModel(IRegionManager regionManager, ISensorService iSensorService) : base(regionManager)
|
||||||
{
|
{
|
||||||
PageTitle = "测序仪";
|
PageTitle = "测序仪";
|
||||||
|
_iSensorService = iSensorService;
|
||||||
|
|
||||||
|
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||||
|
{
|
||||||
|
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||||
|
this.Refresh();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.Refresh();
|
||||||
|
|
||||||
|
timerDownloadDataMsgHidden.Interval = TimeSpan.FromSeconds(2);
|
||||||
|
timerDownloadDataMsgHidden.Tick += TimerDownloadDataMsgHidden_Tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据刷新
|
||||||
|
/// </summary>
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
sequencerModellist.Clear();
|
||||||
|
sequencerModelslist.Clear();
|
||||||
|
sequencerModel.SequencerChartsTem.Values.Clear();
|
||||||
|
sequencerModel.SequencerChartsTem.X_Time.Clear();
|
||||||
|
sequencerModel.SequencerChartsCon.Values.Clear();
|
||||||
|
sequencerModel.SequencerChartsCon.X_Time.Clear();
|
||||||
|
|
||||||
|
var sequencerlistforchart = _iSensorService.GetSequencerData();
|
||||||
|
var sequencerlist = _iSensorService.GetSequencerData(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||||
|
|
||||||
|
///状态监控
|
||||||
|
if (sequencerlist.Count() != 0)
|
||||||
|
{
|
||||||
|
var data = _iSensorService.GetSequencer().FirstOrDefault();
|
||||||
|
sequencerModel.Tem = data.Tem;
|
||||||
|
sequencerModel.Hum = data.Hum;
|
||||||
|
sequencerModel.Pressure = data.Pressure;
|
||||||
|
sequencerModel.Insulation = data.Insulation;
|
||||||
|
sequencerModel.SamplingTime = data.SamplingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
///列表清单数据
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in sequencerlist)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
sequencerModellist.Add(new SequencerModel
|
||||||
|
{
|
||||||
|
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||||
|
SamplingTime = item.SamplingTime,
|
||||||
|
CreateTime = item.CreateTime,
|
||||||
|
Tem = item.Tem,
|
||||||
|
Hum = item.Hum,
|
||||||
|
Pressure = item.Pressure,
|
||||||
|
Insulation = item.Insulation,
|
||||||
|
ReagentTemperature = item.ReagentTemperature,
|
||||||
|
SampleConcentration = item.SampleConcentration,
|
||||||
|
CurrentWorkflow = item.CurrentWorkflow
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
///图表数据及下载
|
||||||
|
int indexm = 0;
|
||||||
|
foreach (var item in sequencerlistforchart)
|
||||||
|
{
|
||||||
|
indexm++;
|
||||||
|
sequencerModelslist.Add(new SequencerModels
|
||||||
|
{
|
||||||
|
Id = indexm,
|
||||||
|
SamplingTime = item.SamplingTime,
|
||||||
|
CreateTime = item.CreateTime,
|
||||||
|
Tem = item.Tem,
|
||||||
|
Hum = item.Hum,
|
||||||
|
Pressure = item.Pressure,
|
||||||
|
Insulation = item.Insulation,
|
||||||
|
ReagentTemperature = item.ReagentTemperature,
|
||||||
|
SampleConcentration = item.SampleConcentration,
|
||||||
|
CurrentWorkflow = item.CurrentWorkflow
|
||||||
|
});
|
||||||
|
if (sequencerModel.SequencerChartsTem.Values.Count >= Convert.ToInt32(tools.GetAppSetting("Chart_Limit")))
|
||||||
|
{
|
||||||
|
sequencerModel.SequencerChartsTem.Values.RemoveAt(0);
|
||||||
|
sequencerModel.SequencerChartsTem.X_Time.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sequencerModel.SequencerChartsCon.Values.Count >= Convert.ToInt32(tools.GetAppSetting("Chart_Limit")))
|
||||||
|
{
|
||||||
|
sequencerModel.SequencerChartsCon.Values.RemoveAt(0);
|
||||||
|
sequencerModel.SequencerChartsCon.X_Time.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sequencerModel.SequencerChartsTem.Values.Add(Convert.ToSingle(item.ReagentTemperature));
|
||||||
|
sequencerModel.SequencerChartsTem.X_Time.Add(item.SamplingTime.ToShortTimeString());
|
||||||
|
|
||||||
|
sequencerModel.SequencerChartsCon.Values.Add(Convert.ToSingle(item.SampleConcentration));
|
||||||
|
sequencerModel.SequencerChartsCon.X_Time.Add(item.SamplingTime.ToShortTimeString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新分页组件的页码
|
||||||
|
PaginationModel.FillPageNumbers(totalCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据下载
|
||||||
|
/// </summary>
|
||||||
|
public override void DoDownload()
|
||||||
|
{
|
||||||
|
DownloadDataBtnIsEnabled = false;
|
||||||
|
DownloadDataMsgVisibility = Visibility.Visible;
|
||||||
|
string baseStationFolder = "";
|
||||||
|
System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); //选择文件夹
|
||||||
|
//注意,此处一定要手动引入System.Window.Forms空间,否则你如果使用默认的DialogResult会发现没有OK属性
|
||||||
|
if (FolderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
baseStationFolder = FolderBrowserDialog.SelectedPath + "\\";
|
||||||
|
}
|
||||||
|
|
||||||
|
//string baseStationFolder = tools.GetAppSetting("MEMSSPFolder");
|
||||||
|
string savePath = CSVDownload.CreateFile(baseStationFolder, "测序仪_Data_" + DateTime.Now.ToString("yyyyMMddHHmmss"), "csv");
|
||||||
|
|
||||||
|
bool result = CSVDownload.SaveSequencerDataToCSVFile(sequencerModelslist, savePath);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
DownloadDataMsg = "下载数据成功!";
|
||||||
|
DownloadDataMsgForeground = new SolidColorBrush(Colors.Green);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DownloadDataMsg = "下载数据失败!";
|
||||||
|
DownloadDataMsgForeground = new SolidColorBrush(Colors.Red);
|
||||||
|
}
|
||||||
|
|
||||||
|
timerDownloadDataMsgHidden.Start();
|
||||||
|
DownloadDataBtnIsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定时器停止
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void TimerDownloadDataMsgHidden_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DownloadDataMsgVisibility = Visibility.Hidden;
|
||||||
|
|
||||||
|
// 停止定时器
|
||||||
|
(sender as DispatcherTimer).Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,12 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:converters="clr-namespace:InSituLaboratory.Base;assembly=InSituLaboratory.Base"
|
||||||
|
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||||
|
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.Sensor"
|
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.Sensor"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d" Template="{StaticResource PageSearchAndDownloadTempalte}"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
FontFamily="{StaticResource DigitalDisplay}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -3,10 +3,259 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:converters="clr-namespace:InSituLaboratory.Base;assembly=InSituLaboratory.Base"
|
||||||
|
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||||
|
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.Sensor"
|
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.Sensor"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d" Template="{StaticResource PageSearchAndDownloadTempalte}"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
FontFamily="{StaticResource DigitalDisplay}">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<converters:SensorStateConvert x:Key="SensorStateConvert" />
|
||||||
|
<Style TargetType="GroupBox">
|
||||||
|
<Setter Property="Margin" Value="10,5" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="GroupBox">
|
||||||
|
<Grid>
|
||||||
|
<!-- 左上角 -->
|
||||||
|
<Polyline HorizontalAlignment="Left" VerticalAlignment="Top" Points="0 30, 0 10, 10 0, 30 0" Stroke="#9918AABD" StrokeThickness="1" />
|
||||||
|
<!-- 左上角点 -->
|
||||||
|
<Ellipse Width="4" Height="4" Margin="24,-2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#9918AABD" />
|
||||||
|
<Ellipse Width="4" Height="4" Margin="-2,24,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#9918AABD" />
|
||||||
|
<!-- 右上角 -->
|
||||||
|
<Path HorizontalAlignment="Right" VerticalAlignment="Top" Data="M0 0, 3 3, 30 3, 33 0, 68 0, 73 7,78 7, 78 10M8 0, 25 0" Stroke="#5518AABD" />
|
||||||
|
<!-- 左下角 -->
|
||||||
|
<Polyline HorizontalAlignment="Left" VerticalAlignment="Bottom" Points="0,0 0,15 10,15" Stroke="#5518AABD" />
|
||||||
|
<!-- 右下角 -->
|
||||||
|
<Polyline HorizontalAlignment="Right" VerticalAlignment="Bottom" Points="10,0 0,10" Stroke="#5518AABD" />
|
||||||
|
<!-- 右下角图标 -->
|
||||||
|
<Polygon HorizontalAlignment="Right" VerticalAlignment="Bottom" Fill="#9918AABD" Points="0,7 7 7 7 0" />
|
||||||
|
|
||||||
|
<Border Margin="30,-0.5,78,0" VerticalAlignment="Top" BorderBrush="#5518AABD" BorderThickness="0,1,0,0" />
|
||||||
|
<Border Margin="0,10" HorizontalAlignment="Right" BorderBrush="#5518AABD" BorderThickness="0,0,1,0" />
|
||||||
|
<Border Margin="10,0" VerticalAlignment="Bottom" BorderBrush="#5518AABD" BorderThickness="0,1,0,0" />
|
||||||
|
<Border Margin="-0.5,15" HorizontalAlignment="Left" BorderBrush="#5518AABD" BorderThickness="0,0,1,0" />
|
||||||
|
|
||||||
|
<!-- 箭头 -->
|
||||||
|
<Path Margin="10,13" HorizontalAlignment="Left" VerticalAlignment="Top" Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#9918AABD" />
|
||||||
|
<Path Margin="16,13" HorizontalAlignment="Left" VerticalAlignment="Top" Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#5518AABD" />
|
||||||
|
<!-- 字体 -->
|
||||||
|
<TextBlock Margin="25,8" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="#18AABD" Text="{TemplateBinding Header}" FontSize="18"/>
|
||||||
|
<!-- 占位对象 -->
|
||||||
|
<ContentPresenter />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="100"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid >
|
||||||
|
<!--状态监控-->
|
||||||
|
<GroupBox Header="测序仪状态监控" Margin="12,12,12,5">
|
||||||
|
<Grid >
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="设备温度" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||||
|
<Border Grid.Column="1" Width="20" Height="20" Background="{Binding sequencerModel.Tem, Converter={StaticResource ResourceKey=SensorStateConvert}}" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="设备湿度" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||||
|
<Border Grid.Column="1" Width="20" Height="20" Background="{Binding sequencerModel.Hum, Converter={StaticResource ResourceKey=SensorStateConvert}}" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="设备压力" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||||
|
<Border Grid.Column="1" Width="20" Height="20" Background="{Binding sequencerModel.Pressure, Converter={StaticResource ResourceKey=SensorStateConvert}}" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="3">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||||
|
<Border Width="10" Height="10" Background="Gray" CornerRadius="10" />
|
||||||
|
<TextBlock Text="未开启/未监控" Margin="10,5"/>
|
||||||
|
<Border Width="10" Height="10" Background="Green" CornerRadius="10" />
|
||||||
|
<TextBlock Text="正常" Margin="10,5"/>
|
||||||
|
<Border Width="10" Height="10" Background="Yellow" CornerRadius="10" />
|
||||||
|
<TextBlock Text="警报" Margin="10,5"/>
|
||||||
|
<Border Width="10" Height="10" Background="red" CornerRadius="10" />
|
||||||
|
<TextBlock Text="故障" Margin="10,5"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="绝缘" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||||
|
<Border Grid.Column="1" Width="20" Height="20" Background="{Binding sequencerModel.Insulation, Converter={StaticResource ResourceKey=SensorStateConvert}}" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!--状态数据展示-->
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<GroupBox Header="测序仪状态数据展示" Margin="12,3,12,18">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.IsSharedSizeScope="True" Margin="5,5,5,2" Grid.Row="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||||
|
<DataGrid ItemsSource="{Binding sequencerModellist }" FontSize="15" FontWeight="Bold" IsReadOnly="True" >
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="序号" Width="60" Binding="{Binding DataIdNum}" />
|
||||||
|
<DataGridTextColumn Header="采样时间" Width="170" Binding="{Binding SamplingTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
|
||||||
|
<DataGridTextColumn Header="试剂温度/" Width="80" Binding="{Binding ReagentTemperature}" />
|
||||||
|
<DataGridTextColumn Header="样本浓度" Width="120" Binding="{Binding SampleConcentration}"/>
|
||||||
|
<DataGridTextColumn Header="当前工作流程" Width="120" Binding="{Binding CurrentWorkflow}"/>
|
||||||
|
<DataGridTextColumn Header="设备温度" Width="105" Binding="{Binding Tem}"/>
|
||||||
|
<DataGridTextColumn Header="设备湿度" Width="105" Binding="{Binding Hum}"/>
|
||||||
|
<DataGridTextColumn Header="设备压力" Width="105" Binding="{Binding Pressure}"/>
|
||||||
|
<DataGridTextColumn Header="设备绝缘" Width="105" Binding="{Binding Insulation}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
<!--状态数据折线图-->
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<GroupBox Header="测序仪状态数据折线图 " Margin="12,3,12,18">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!--试剂温度-->
|
||||||
|
<Grid >
|
||||||
|
<lvc:CartesianChart Margin="20,35,20,5" DataContext="{Binding sequencerModel.SequencerChartsTem}" DisableAnimations="True">
|
||||||
|
<lvc:CartesianChart.Series>
|
||||||
|
<lvc:LineSeries Values="{Binding Values }" Title="{Binding Value_Name}" PointGeometrySize="0" Stroke="#FF2BEDF1" StrokeThickness="1">
|
||||||
|
<lvc:LineSeries.Fill>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientStop Color="#552BEDF1" Offset="0"/>
|
||||||
|
<GradientStop Color="Transparent" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</lvc:LineSeries.Fill>
|
||||||
|
</lvc:LineSeries>
|
||||||
|
</lvc:CartesianChart.Series>
|
||||||
|
<!--X轴-->
|
||||||
|
<lvc:CartesianChart.AxisX>
|
||||||
|
<lvc:Axis Labels="{Binding X_Time}">
|
||||||
|
<lvc:Axis.Separator>
|
||||||
|
<lvc:Separator Step="1" StrokeThickness="0"/>
|
||||||
|
</lvc:Axis.Separator>
|
||||||
|
</lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisX>
|
||||||
|
<!--Y轴-->
|
||||||
|
<lvc:CartesianChart.AxisY>
|
||||||
|
<lvc:Axis MinValue="{Binding Y_MinValue}" MaxValue="{Binding Y_MaxValue}">
|
||||||
|
<lvc:Axis.Separator>
|
||||||
|
<lvc:Separator Step="{Binding Step}" Stroke="#11FFFFFF"/>
|
||||||
|
</lvc:Axis.Separator>
|
||||||
|
</lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisY>
|
||||||
|
</lvc:CartesianChart>
|
||||||
|
|
||||||
|
<!--右上角图例 采集时间-->
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10">
|
||||||
|
<Border Width="6" Height="6" Background="#552BEDF1" Margin="5,0"/>
|
||||||
|
<TextBlock Text="{Binding sequencerModel.SamplingTime,StringFormat=yyyy/MM/dd HH:mm:ss}" FontSize="11" Foreground="Black"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!--样本浓度-->
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<lvc:CartesianChart Margin="20,35,20,5" DataContext="{Binding sequencerModel.SequencerChartsCon}" DisableAnimations="True">
|
||||||
|
<lvc:CartesianChart.Series>
|
||||||
|
<lvc:LineSeries Values="{Binding Values }" Title="{Binding Value_Name}" PointGeometrySize="0" Stroke="#E6E6FA" StrokeThickness="1">
|
||||||
|
<lvc:LineSeries.Fill>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientStop Color="#E6E6FA" Offset="0"/>
|
||||||
|
<GradientStop Color="Transparent" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</lvc:LineSeries.Fill>
|
||||||
|
</lvc:LineSeries>
|
||||||
|
</lvc:CartesianChart.Series>
|
||||||
|
<!--X轴-->
|
||||||
|
<lvc:CartesianChart.AxisX>
|
||||||
|
<lvc:Axis Labels="{Binding X_Time}">
|
||||||
|
<lvc:Axis.Separator>
|
||||||
|
<lvc:Separator Step="1" StrokeThickness="0"/>
|
||||||
|
</lvc:Axis.Separator>
|
||||||
|
</lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisX>
|
||||||
|
<!--Y轴-->
|
||||||
|
<lvc:CartesianChart.AxisY>
|
||||||
|
<lvc:Axis MinValue="{Binding Y_MinValue}" MaxValue="{Binding Y_MaxValue}">
|
||||||
|
<lvc:Axis.Separator>
|
||||||
|
<lvc:Separator Step="{Binding Step}" Stroke="#11FFFFFF"/>
|
||||||
|
</lvc:Axis.Separator>
|
||||||
|
</lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisY>
|
||||||
|
</lvc:CartesianChart>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -24,5 +24,31 @@ namespace InSituLaboratory.Views.Pages.Sensor
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持鼠标滚轮上下滚动
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
|
{
|
||||||
|
ScrollViewer viewer = sv; //sv 为Scrollview的名字,在Xaml文件中定义。
|
||||||
|
if (viewer == null) return;
|
||||||
|
double num = Math.Abs((int)(e.Delta / 2));
|
||||||
|
double offset = 0.0;
|
||||||
|
if (e.Delta > 0)
|
||||||
|
{
|
||||||
|
offset = Math.Max((double)0.0, (double)(viewer.VerticalOffset - num));//viewer.VerticalOffset获取包含滚动内容的垂直偏移量的值。
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = Math.Min(viewer.ScrollableHeight, viewer.VerticalOffset + num);
|
||||||
|
}
|
||||||
|
if (offset != viewer.VerticalOffset)
|
||||||
|
{
|
||||||
|
viewer.ScrollToVerticalOffset(offset);//将 ScrollViewer 内的内容滚动到指定的垂直偏移量位置。
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user