完成甲烷同位素分析仪页面数据布局
This commit is contained in:
parent
df079dfaa6
commit
3d2a80239c
105
InSituLaboratory.Entities/Sensor/CH4IsotopeModel.cs
Normal file
105
InSituLaboratory.Entities/Sensor/CH4IsotopeModel.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using LiveCharts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InSituLaboratory.Entities.Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 甲烷同位素分析仪
|
||||||
|
/// </summary>
|
||||||
|
public class CH4IsotopeModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键
|
||||||
|
/// </summary>
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采样时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime SamplingTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--设备温度 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Tem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--设备湿度 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Hum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--压力 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Pressure { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--绝缘 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Insulation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C1浓度
|
||||||
|
/// </summary>
|
||||||
|
public float C1 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C2浓度
|
||||||
|
/// </summary>
|
||||||
|
public float C2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 丰度
|
||||||
|
/// </summary>
|
||||||
|
public float Abundance { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public int DataIdNum { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ChartsModel CH4IsotopeChartsC1 { get; set; } = new ChartsModel()
|
||||||
|
{
|
||||||
|
Values = new ChartValues<float>(),
|
||||||
|
Value_Name = "C1浓度",
|
||||||
|
X_Time = new List<string>(),
|
||||||
|
Y_MinValue = Convert.ToInt32(tools.GetAppSetting("甲烷同位素分析仪C1浓度Min")),
|
||||||
|
Y_MaxValue = Convert.ToInt32(tools.GetAppSetting("甲烷同位素分析仪C1浓度Max"))
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public ChartsModel CH4IsotopeChartsC2 { get; set; } = new ChartsModel()
|
||||||
|
{
|
||||||
|
Values = new ChartValues<float>(),
|
||||||
|
Value_Name = "C2浓度",
|
||||||
|
X_Time = new List<string>(),
|
||||||
|
Y_MinValue = Convert.ToInt32(tools.GetAppSetting("甲烷同位素分析仪C2浓度Min")),
|
||||||
|
Y_MaxValue = Convert.ToInt32(tools.GetAppSetting("甲烷同位素分析仪C2浓度Max"))
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public ChartsModel CH4IsotopeChartsAbundance { 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"))
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -101,6 +101,34 @@ namespace InSituLaboratory.IService.Sensor
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 甲烷同位素分析仪
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取甲烷同位素分析仪数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<CH4IsotopeModel> GetCh4Isotope();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取甲烷同位素分析仪数据--图表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<CH4IsotopeModel> GetCh4ISotopeData();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取甲烷同位素分析仪数据--分页 按时间倒序排序
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="totalCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<CH4IsotopeModel> GetCh4ISotopeData(string key, int pageSize, int pageIndex, out int totalCount);
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
70
InSituLaboratory.Models/Sendsor/CH4IsotopeModels.cs
Normal file
70
InSituLaboratory.Models/Sendsor/CH4IsotopeModels.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
using InSituLaboratory.Entities;
|
||||||
|
using LiveCharts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InSituLaboratory.Models.Sendsor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 甲烷同位素分析仪
|
||||||
|
/// </summary>
|
||||||
|
public class CH4IsotopeModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采样时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime SamplingTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--设备温度 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Tem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--设备湿度 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Hum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--压力 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Pressure { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码--绝缘 (未开启/未监控 正常 警报 故障)
|
||||||
|
/// </summary>
|
||||||
|
public string? Insulation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C1浓度
|
||||||
|
/// </summary>
|
||||||
|
public float C1 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// C2浓度
|
||||||
|
/// </summary>
|
||||||
|
public float C2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 丰度
|
||||||
|
/// </summary>
|
||||||
|
public float Abundance { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -78,5 +78,6 @@ namespace InSituLaboratory.ORM
|
|||||||
public virtual DbSet<MEMSSpModel> MEMSSpModel { get; set; }
|
public virtual DbSet<MEMSSpModel> MEMSSpModel { get; set; }
|
||||||
public virtual DbSet<MEMSZpModel> MEMSZpModel { get; set; }
|
public virtual DbSet<MEMSZpModel> MEMSZpModel { get; set; }
|
||||||
public virtual DbSet<ColorMSModel> ColorMSModel { get; set; }
|
public virtual DbSet<ColorMSModel> ColorMSModel { get; set; }
|
||||||
|
public virtual DbSet<CH4IsotopeModel> CH4IsotopeModel { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,5 +147,48 @@ namespace InSituLaboratory.Service.Sensor
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 甲烷同位素分析仪
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取甲烷同位素分析仪数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<CH4IsotopeModel> GetCh4Isotope()
|
||||||
|
{
|
||||||
|
return this.Query<CH4IsotopeModel>(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<CH4IsotopeModel> GetCh4ISotopeData()
|
||||||
|
{
|
||||||
|
return this.Query<CH4IsotopeModel>(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<CH4IsotopeModel> GetCh4ISotopeData(string key, int pageSize, int pageIndex, out int totalCount)
|
||||||
|
{
|
||||||
|
var pResult = this.QueryPage<CH4IsotopeModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
||||||
|
|
||||||
|
totalCount = pResult.TotalCount;
|
||||||
|
|
||||||
|
return pResult.DataList;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,6 +54,13 @@
|
|||||||
<add key="色质联用仪C9浓度Max" value="10"/>
|
<add key="色质联用仪C9浓度Max" value="10"/>
|
||||||
<add key="色质联用仪C9浓度Min" value="0"/>
|
<add key="色质联用仪C9浓度Min" value="0"/>
|
||||||
|
|
||||||
|
<add key="甲烷同位素分析仪C1浓度Max" value="10"/>
|
||||||
|
<add key="甲烷同位素分析仪C1浓度Min" value="0"/>
|
||||||
|
<add key="甲烷同位素分析仪C2浓度Max" value="10"/>
|
||||||
|
<add key="甲烷同位素分析仪C2浓度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\\"/>
|
||||||
|
|||||||
@ -234,6 +234,7 @@ namespace InSituLaboratory.Base
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ColorMSModel
|
#region ColorMSModel
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取类的属性集合(以便生成CSV文件的所有Column标题)
|
/// 获取类的属性集合(以便生成CSV文件的所有Column标题)
|
||||||
@ -331,5 +332,95 @@ namespace InSituLaboratory.Base
|
|||||||
return successFlag;
|
return successFlag;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region CH4IsotopeModel
|
||||||
|
/// <summary>
|
||||||
|
/// 获取类的属性集合(以便生成CSV文件的所有Column标题)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static PropertyInfo[] GetCH4IsotopeInfoArray()
|
||||||
|
{
|
||||||
|
PropertyInfo[] props = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Type type = typeof(CH4IsotopeModels);
|
||||||
|
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 SaveCh4IsotopeDataToCSVFile(ObservableCollection<CH4IsotopeModels> BaseStationList, string filePath)
|
||||||
|
{
|
||||||
|
bool successFlag = true;
|
||||||
|
|
||||||
|
StringBuilder strColumn = new StringBuilder();
|
||||||
|
StringBuilder strValue = new StringBuilder();
|
||||||
|
StreamWriter sw = null;
|
||||||
|
PropertyInfo[] props = GetCH4IsotopeInfoArray();
|
||||||
|
|
||||||
|
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].C1);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].C2);
|
||||||
|
strValue.Append(",");
|
||||||
|
strValue.Append(BaseStationList[i].Abundance);
|
||||||
|
|
||||||
|
|
||||||
|
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,178 @@ namespace InSituLaboratory.ViewModels.Pages.Sensor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CH4IsotopeViewModel : ViewModelBase
|
public class CH4IsotopeViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
public CH4IsotopeViewModel(IRegionManager regionManager) : base(regionManager)
|
|
||||||
|
#region 实体类
|
||||||
|
public CH4IsotopeModel cH4IsotopeModel { get; set; } = new CH4IsotopeModel();
|
||||||
|
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||||
|
|
||||||
|
public ObservableCollection<CH4IsotopeModel> cH4IsotopeModellist { get; set; } = new ObservableCollection<CH4IsotopeModel>();
|
||||||
|
public ObservableCollection<CH4IsotopeModels> cH4IsotopeModelslist { get; set; } = new ObservableCollection<CH4IsotopeModels>();
|
||||||
|
|
||||||
|
public DispatcherTimer timerDownloadDataMsgHidden = new DispatcherTimer();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
ISensorService _iSensorService;
|
||||||
|
public CH4IsotopeViewModel(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()
|
||||||
|
{
|
||||||
|
///状态数据展示
|
||||||
|
cH4IsotopeModellist.Clear();
|
||||||
|
cH4IsotopeModelslist.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.Values.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.X_Time.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.Values.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.X_Time.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.Values.Clear();
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.X_Time.Clear();
|
||||||
|
|
||||||
|
var CH4Isotopelistforchart = _iSensorService.GetCh4ISotopeData();
|
||||||
|
var CH4Isotopelist = _iSensorService.GetCh4ISotopeData(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||||
|
|
||||||
|
|
||||||
|
///状态监控
|
||||||
|
if (CH4Isotopelist.Count() != 0)
|
||||||
|
{
|
||||||
|
var data = _iSensorService.GetCh4Isotope().FirstOrDefault();
|
||||||
|
cH4IsotopeModel.Tem = data.Tem;
|
||||||
|
cH4IsotopeModel.Hum = data.Hum;
|
||||||
|
cH4IsotopeModel.Pressure = data.Pressure;
|
||||||
|
cH4IsotopeModel.Insulation = data.Insulation;
|
||||||
|
cH4IsotopeModel.SamplingTime = data.SamplingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
///列表清单数据
|
||||||
|
int index = 0;
|
||||||
|
foreach (var item in CH4Isotopelist)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
cH4IsotopeModellist.Add(new CH4IsotopeModel
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
C1 = item.C1,
|
||||||
|
C2 = item.C2,
|
||||||
|
Abundance = item.Abundance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
///图表数据及下载
|
||||||
|
int indexm = 0;
|
||||||
|
foreach (var item in CH4Isotopelistforchart)
|
||||||
|
{
|
||||||
|
indexm++;
|
||||||
|
cH4IsotopeModelslist.Add(new CH4IsotopeModels
|
||||||
|
{
|
||||||
|
Id = indexm,
|
||||||
|
SamplingTime = item.SamplingTime,
|
||||||
|
CreateTime = item.CreateTime,
|
||||||
|
Tem = item.Tem,
|
||||||
|
Hum = item.Hum,
|
||||||
|
Pressure = item.Pressure,
|
||||||
|
Insulation = item.Insulation,
|
||||||
|
C1 = item.C1,
|
||||||
|
C2 = item.C2,
|
||||||
|
Abundance = item.Abundance
|
||||||
|
});
|
||||||
|
if (cH4IsotopeModel.CH4IsotopeChartsC1.Values.Count >= Convert.ToInt32(tools.GetAppSetting("Chart_Limit")))
|
||||||
|
{
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.Values.RemoveAt(0);
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.X_Time.RemoveAt(0);
|
||||||
|
}
|
||||||
|
if (cH4IsotopeModel.CH4IsotopeChartsC2.Values.Count >= Convert.ToInt32(tools.GetAppSetting("Chart_Limit")))
|
||||||
|
{
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.Values.RemoveAt(0);
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.X_Time.RemoveAt(0);
|
||||||
|
}
|
||||||
|
if (cH4IsotopeModel.CH4IsotopeChartsAbundance.Values.Count >= Convert.ToInt32(tools.GetAppSetting("Chart_Limit")))
|
||||||
|
{
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.Values.RemoveAt(0);
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.X_Time.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.Values.Add(Convert.ToSingle(item.C1));
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC1.X_Time.Add(item.SamplingTime.ToShortTimeString());
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.Values.Add(Convert.ToSingle(item.C2));
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsC2.X_Time.Add(item.SamplingTime.ToShortTimeString());
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.Values.Add(Convert.ToSingle(item.Abundance));
|
||||||
|
cH4IsotopeModel.CH4IsotopeChartsAbundance.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.SaveCh4IsotopeDataToCSVFile(cH4IsotopeModelslist, 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,10 +3,289 @@
|
|||||||
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>
|
<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.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 cH4IsotopeModel.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 cH4IsotopeModel.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 cH4IsotopeModel.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 cH4IsotopeModel.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 cH4IsotopeModellist }" 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="C1浓度/%" Width="100" Binding="{Binding C1}" />
|
||||||
|
<DataGridTextColumn Header="C2浓度/ppm" Width="100" Binding="{Binding C2}"/>
|
||||||
|
<DataGridTextColumn Header="丰度/‰" Width="100" Binding="{Binding Abundance}"/>
|
||||||
|
<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="甲烷同位素分析仪状态数据折线图 C1 / C2 / 丰度" Margin="12,3,12,18">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid >
|
||||||
|
<lvc:CartesianChart Margin="20,35,20,5" DataContext="{Binding cH4IsotopeModel.CH4IsotopeChartsC1}" 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 cH4IsotopeModel.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 cH4IsotopeModel.CH4IsotopeChartsC2}" 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 Grid.Row="2">
|
||||||
|
<lvc:CartesianChart Margin="20,35,20,5" DataContext="{Binding cH4IsotopeModel.CH4IsotopeChartsAbundance}" DisableAnimations="True">
|
||||||
|
<lvc:CartesianChart.Series>
|
||||||
|
<lvc:LineSeries Values="{Binding Values }" Title="{Binding Value_Name}" PointGeometrySize="0" Stroke="#87CEFA" StrokeThickness="1">
|
||||||
|
<lvc:LineSeries.Fill>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientStop Color="#87CEFA" 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