添加项目文件。
This commit is contained in:
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CA1416: 验证平台兼容性
|
||||
dotnet_diagnostic.CA1416.severity = silent
|
||||
14
CapMachine.Core/CapMachine.Core.csproj
Normal file
14
CapMachine.Core/CapMachine.Core.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FreeSql" Version="3.2.808" />
|
||||
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
55
CapMachine.Core/DialogViewModel.cs
Normal file
55
CapMachine.Core/DialogViewModel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 弹窗基类
|
||||
/// </summary>
|
||||
public class DialogViewModel : BindableBase, IDialogAware
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public event Action<IDialogResult>? RequestClose;
|
||||
|
||||
/// <summary>
|
||||
/// 调用RequestClose
|
||||
/// </summary>
|
||||
/// <param name="dialogResult"></param>
|
||||
public void RaiseRequestClose(IDialogResult dialogResult)
|
||||
{
|
||||
RequestClose?.Invoke(dialogResult);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否关闭窗口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CanCloseDialog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭时触发
|
||||
/// </summary>
|
||||
public void OnDialogClosed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开时触发
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public virtual void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
19
CapMachine.Core/IService/INavigationMenuService.cs
Normal file
19
CapMachine.Core/IService/INavigationMenuService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Core.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 导航服务接口
|
||||
/// </summary>
|
||||
public interface INavigationMenuService
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
void Initialize();
|
||||
}
|
||||
}
|
||||
46
CapMachine.Core/NavigationViewModel.cs
Normal file
46
CapMachine.Core/NavigationViewModel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 导航的基类
|
||||
/// </summary>
|
||||
public class NavigationViewModel : BindableBase, INavigationAware
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否重用导航对象
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航被切换触发
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public virtual void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航被执行触发
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public virtual void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
CapMachine.Model/CapMachine.Model.csproj
Normal file
11
CapMachine.Model/CapMachine.Model.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FreeSql" Version="3.2.808" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
54
CapMachine.Model/ConfigChartSelect.cs
Normal file
54
CapMachine.Model/ConfigChartSelect.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// ConfigChartSelect表设置
|
||||
/// </summary>
|
||||
[Table(Name = "ConfigChartSelect")]
|
||||
public class ConfigChartSelect
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[Column(Name = "Index")]
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类/工况
|
||||
/// </summary>
|
||||
[Column(Name = "Category", IsNullable = false, StringLength = 50)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = true)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public long ConfigChartYAxisId { get; set; }
|
||||
public ConfigChartYAxis? ConfigChartYAxis { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
56
CapMachine.Model/ConfigChartYAxis.cs
Normal file
56
CapMachine.Model/ConfigChartYAxis.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// ConfigChartYAxis表设置
|
||||
/// </summary>
|
||||
[Table(Name = "ConfigChartYAxis")]
|
||||
public class ConfigChartYAxis
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[Column(Name = "Index")]
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标尺名称
|
||||
/// </summary>
|
||||
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max
|
||||
/// </summary>
|
||||
[Column(Name = "Max")]
|
||||
public double Max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Min
|
||||
/// </summary>
|
||||
[Column(Name = "Min")]
|
||||
public double Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
[Column(Name = "Unit", IsNullable = false, StringLength = 10)]
|
||||
public string? Unit { get; set; }
|
||||
|
||||
|
||||
//[Column(ServerTime = DateTimeKind.Local, CanUpdate = true)]
|
||||
//public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
22
CapMachine.Model/ConfigValueType.cs
Normal file
22
CapMachine.Model/ConfigValueType.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
public enum ConfigValueType
|
||||
{
|
||||
/// <summary>
|
||||
/// 常值
|
||||
/// </summary>
|
||||
Constant = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 斜坡
|
||||
/// </summary>
|
||||
Slope = 2,
|
||||
|
||||
}
|
||||
}
|
||||
70
CapMachine.Model/MeterPd.cs
Normal file
70
CapMachine.Model/MeterPd.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Pd表设置
|
||||
/// </summary>
|
||||
[Table(Name = "MeterPd")]
|
||||
public class MeterPd
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤序号
|
||||
/// </summary>
|
||||
[Column(Name = "StepNo")]
|
||||
public int StepNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始值
|
||||
/// </summary>
|
||||
[Column(Name = "StartValue")]
|
||||
public double StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束值
|
||||
/// </summary>
|
||||
[Column(Name = "EndValue")]
|
||||
public double EndValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维持时间
|
||||
/// </summary>
|
||||
[Column(Name = "KeepTime")]
|
||||
public double KeepTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置值类型
|
||||
/// </summary>
|
||||
[Column(MapType = typeof(int))]
|
||||
public ConfigValueType ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 常值
|
||||
/// 在ValueType为常值时会使用
|
||||
/// </summary>
|
||||
[Column(Name = "Constant")]
|
||||
public double Constant { get; set; }
|
||||
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public long ProStepId { get; set; }
|
||||
public ProStep? ProStep { get; set; }
|
||||
}
|
||||
}
|
||||
70
CapMachine.Model/MeterPs.cs
Normal file
70
CapMachine.Model/MeterPs.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Ps表设置
|
||||
/// </summary>
|
||||
[Table(Name = "MeterPs")]
|
||||
public class MeterPs
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤序号
|
||||
/// </summary>
|
||||
[Column(Name = "StepNo")]
|
||||
public int StepNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始值
|
||||
/// </summary>
|
||||
[Column(Name = "StartValue")]
|
||||
public double StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束值
|
||||
/// </summary>
|
||||
[Column(Name = "EndValue")]
|
||||
public double EndValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维持时间
|
||||
/// </summary>
|
||||
[Column(Name = "KeepTime")]
|
||||
public double KeepTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置值类型
|
||||
/// </summary>
|
||||
[Column(MapType = typeof(int))]
|
||||
public ConfigValueType ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 常值
|
||||
/// 在ValueType为常值时会使用
|
||||
/// </summary>
|
||||
[Column(Name = "Constant")]
|
||||
public double Constant { get; set; }
|
||||
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public long ProStepId { get; set; }
|
||||
public ProStep? ProStep { get; set; }
|
||||
}
|
||||
}
|
||||
71
CapMachine.Model/MeterSpeed.cs
Normal file
71
CapMachine.Model/MeterSpeed.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 速度表设置
|
||||
/// </summary>
|
||||
[Table(Name = "MeterSpeed")]
|
||||
public class MeterSpeed
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤序号
|
||||
/// </summary>
|
||||
[Column(Name = "StepNo")]
|
||||
public int StepNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始值
|
||||
/// </summary>
|
||||
[Column(Name = "StartValue")]
|
||||
public double StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束值
|
||||
/// </summary>
|
||||
[Column(Name = "EndValue")]
|
||||
public double EndValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维持时间
|
||||
/// </summary>
|
||||
[Column(Name = "KeepTime")]
|
||||
public double KeepTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置值类型
|
||||
/// </summary>
|
||||
[Column(MapType = typeof(int))]
|
||||
public ConfigValueType ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 常值
|
||||
/// 在ValueType为常值时会使用
|
||||
/// </summary>
|
||||
[Column(Name = "Constant")]
|
||||
public double Constant { get; set; }
|
||||
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public long ProStepId { get; set; }
|
||||
public ProStep? ProStep { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
165
CapMachine.Model/ProKpStepExecute.cs
Normal file
165
CapMachine.Model/ProKpStepExecute.cs
Normal file
@@ -0,0 +1,165 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序段具体步骤执行信息
|
||||
/// </summary>
|
||||
[Table(Name = "ProStepExecute")]
|
||||
public class ProStepExecute
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段名称
|
||||
/// </summary>
|
||||
[Column(Name = "ProName", IsNullable = false, StringLength = 20)]
|
||||
public string ProName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段步骤
|
||||
/// </summary>
|
||||
[Column(Name = "ProStep", IsNullable = false)]
|
||||
public int ProStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段反复
|
||||
/// </summary>
|
||||
[Column(Name = "ProRepeat")]
|
||||
public int ProRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在执行当前程序段
|
||||
/// </summary>
|
||||
[Column(Name = "IsCurrentProStep")]
|
||||
public bool IsCurrentProStep { get; set; }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
////////////////////////程序步骤///////////////////////////////
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在执行当前程序段
|
||||
/// </summary>
|
||||
[Column(Name = "IsCurrentMeterStep")]
|
||||
public bool IsCurrentMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表功能名称
|
||||
/// </summary>
|
||||
[Column(Name = "MeterName", IsNullable = false, StringLength = 20)]
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 步骤
|
||||
/// </summary>
|
||||
[Column(Name = "MeterStep", IsNullable = false)]
|
||||
public int MeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 速度 DegC
|
||||
/// </summary>
|
||||
[Column(Name = "SV", IsNullable = true)]
|
||||
public int SV { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间-分钟
|
||||
/// </summary>
|
||||
[Column(Name = "TimeMin", IsNullable = true)]
|
||||
public int TimeMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间-秒
|
||||
/// </summary>
|
||||
[Column(Name = "TimeSec", IsNullable = true)]
|
||||
public int TimeSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID NO
|
||||
/// </summary>
|
||||
[Column(Name = "PIDNo", IsNullable = true)]
|
||||
public int PIDNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Limit NO
|
||||
/// </summary>
|
||||
[Column(Name = "LitmitNo", IsNullable = true)]
|
||||
public int LitmitNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm NO
|
||||
/// </summary>
|
||||
[Column(Name = "AlarmNo", IsNullable = true)]
|
||||
public int AlarmNo { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 时间信号
|
||||
///// </summary>
|
||||
//[Column(Name = "TimeSign1", IsNullable = true)]
|
||||
//public int TimeSign1 { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 时间信号
|
||||
///// </summary>
|
||||
//[Column(Name = "TimeSign2", IsNullable = true)]
|
||||
//public int TimeSign2 { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 时间信号
|
||||
///// </summary>
|
||||
//[Column(Name = "TimeSign3", IsNullable = true)]
|
||||
//public int TimeSign3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 步进重复
|
||||
/// </summary>
|
||||
[Column(Name = "Repeat", IsNullable = true)]
|
||||
public int StepRepeat { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 拓展字段1
|
||||
///// </summary>
|
||||
//[Column(Name = "FeildExte1", IsNullable = true)]
|
||||
//public string FeildExte1 { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 拓展字段1
|
||||
///// </summary>
|
||||
//[Column(Name = "FeildExte2", IsNullable = true)]
|
||||
//public string FeildExte2 { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 拓展字段1
|
||||
///// </summary>
|
||||
//[Column(Name = "FeildExte3", IsNullable = true)]
|
||||
//public string FeildExte3 { get; set; }
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 拓展字段1
|
||||
///// </summary>
|
||||
//[Column(Name = "FeildExte4", IsNullable = true)]
|
||||
//public string FeildExte4 { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 拓展字段1
|
||||
///// </summary>
|
||||
//[Column(Name = "FeildExte5", IsNullable = true)]
|
||||
//public string FeildExte5 { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
68
CapMachine.Model/ProStep.cs
Normal file
68
CapMachine.Model/ProStep.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 步骤
|
||||
/// </summary>
|
||||
[Table(Name = "ProStep")]
|
||||
public class ProStep
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤序号
|
||||
/// </summary>
|
||||
[Column(Name = "StepNo")]
|
||||
public int StepNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤反复次数
|
||||
/// </summary>
|
||||
[Column(Name = "StepRepeat")]
|
||||
public int StepRepeat { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 程序段反复
|
||||
///// </summary>
|
||||
//[Column(Name = "ProRepeat")]
|
||||
//public int ProRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column(Name = "Remark", IsNullable = false, StringLength = 200)]
|
||||
public string Remark { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public ICollection<MeterSpeed>? MeterSpeeds { get; set; }
|
||||
public ICollection<MeterPd>? MeterPds { get; set; }
|
||||
public ICollection<MeterPs>? MeterPss { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public long ProgramSegId { get; set; }
|
||||
public ProgramSeg? ProgramSeg { get; set; }
|
||||
}
|
||||
}
|
||||
51
CapMachine.Model/ProStepDto.cs
Normal file
51
CapMachine.Model/ProStepDto.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
public class ProStepDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序步骤序号
|
||||
/// </summary>
|
||||
public int StepNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序循环次数
|
||||
/// </summary>
|
||||
public int StepRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 压缩机转速信息
|
||||
/// </summary>
|
||||
public string? SpeedInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID信息
|
||||
/// </summary>
|
||||
public string? PID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID输出限幅信息
|
||||
/// </summary>
|
||||
public string? PIDOutLimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ps信息
|
||||
/// </summary>
|
||||
public string? Ps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pd信息
|
||||
/// </summary>
|
||||
public string? PdInfo{ get; set; }
|
||||
}
|
||||
}
|
||||
52
CapMachine.Model/ProgramSeg.cs
Normal file
52
CapMachine.Model/ProgramSeg.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
[Table(Name = "ProgramSeg")]
|
||||
public class ProgramSeg
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true,IsIdentity =true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序名称
|
||||
/// 工况名称
|
||||
/// </summary>
|
||||
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段反复
|
||||
/// </summary>
|
||||
[Column(Name = "ProRepeat")]
|
||||
public int ProRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编辑者
|
||||
/// </summary>
|
||||
[Column(Name = "UserName", IsNullable = false, StringLength = 20)]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column(Name = "Remark", IsNullable = false, StringLength = 100)]
|
||||
public string Remark { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
public ICollection<ProStep>? ProSteps { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
46
CapMachine.Model/QuickCpLimtNo.cs
Normal file
46
CapMachine.Model/QuickCpLimtNo.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
[Table(Name = "QuickCpLimtNo")]
|
||||
public class QuickCpLimtNo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 快速设置仪表名称
|
||||
/// </summary>
|
||||
[Column(Name = "MeterName", IsNullable = true, StringLength = 30)]
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[Column(Name = "IndexNo", IsNullable = false)]
|
||||
public int IndexNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上限
|
||||
/// </summary>
|
||||
[Column(Name = "Up", DbType = "decimal(5, 1)", IsNullable = true)]
|
||||
public decimal Up { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下限
|
||||
/// </summary>
|
||||
[Column(Name = "Down", DbType = "decimal(5, 1)", IsNullable = true)]
|
||||
public decimal Down { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
52
CapMachine.Model/QuickCpPIDNo.cs
Normal file
52
CapMachine.Model/QuickCpPIDNo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
[Table(Name = "QuickCpPIDNo")]
|
||||
public class QuickCpPIDNo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 快速设置仪表名称
|
||||
/// </summary>
|
||||
[Column(Name = "MeterName", IsNullable = true, StringLength = 30)]
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[Column(Name = "IndexNo", IsNullable = false)]
|
||||
public int IndexNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// P
|
||||
/// </summary>
|
||||
[Column(Name = "P", DbType = "decimal(5, 1)", IsNullable = true)]
|
||||
public decimal P { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// I
|
||||
/// </summary>
|
||||
[Column(Name = "I", IsNullable = true)]
|
||||
public int I { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// D
|
||||
/// </summary>
|
||||
[Column(Name = "D", IsNullable = true)]
|
||||
public int D { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
162
CapMachine.Model/QuickProStepExecute.cs
Normal file
162
CapMachine.Model/QuickProStepExecute.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 快速设置程序段具体步骤执行信息
|
||||
/// </summary>
|
||||
[Table(Name = "QuickProStepExecute")]
|
||||
public class QuickProStepExecute
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段名称
|
||||
/// </summary>
|
||||
[Column(Name = "ProName", IsNullable = false, StringLength = 30)]
|
||||
public string ProName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段步骤
|
||||
/// </summary>
|
||||
[Column(Name = "ProStep", IsNullable = false)]
|
||||
public int ProStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序段反复
|
||||
/// </summary>
|
||||
[Column(Name = "ProRepeat")]
|
||||
public int ProRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在执行当前程序段
|
||||
/// </summary>
|
||||
[Column(Name = "IsCurrentProStep")]
|
||||
public bool IsCurrentProStep { get; set; }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
////////////////////////程序步骤///////////////////////////////
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在执行当前程序段
|
||||
/// </summary>
|
||||
[Column(Name = "IsCurrentMeterStep")]
|
||||
public bool IsCurrentMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表功能名称
|
||||
/// </summary>
|
||||
[Column(Name = "MeterName", IsNullable = false, StringLength = 20)]
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 步骤
|
||||
/// </summary>
|
||||
[Column(Name = "MeterStep", IsNullable = false)]
|
||||
public int MeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 这个步骤是打开具体设置步骤界面的那个层面的信息,例如:2-3,代表是程序2里面的仪表步骤3,方便调试和给液击使用
|
||||
/// </summary>
|
||||
[Column(Name = "ProStepInfo", IsNullable = false)]
|
||||
public string ProStepInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SV DegC
|
||||
/// </summary>
|
||||
[Column(Name = "SV", IsNullable = true)]
|
||||
public int SV { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间-分钟-步骤维持时间
|
||||
/// </summary>
|
||||
[Column(Name = "TimeMin", IsNullable = true)]
|
||||
public int TimeMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间-秒-步骤维持时间
|
||||
/// </summary>
|
||||
[Column(Name = "TimeSec", IsNullable = true)]
|
||||
public int TimeSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID NO-PID序号
|
||||
/// </summary>
|
||||
[Column(Name = "PIDNo", IsNullable = true)]
|
||||
public int PIDNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用坡度
|
||||
/// </summary>
|
||||
[Column(Name = "ExistSlop", IsNullable = false)]
|
||||
public bool ExistSlop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间-秒-斜坡时间
|
||||
/// </summary>
|
||||
[Column(Name = "SlopTimeSec", IsNullable = true)]
|
||||
public int SlopTimeSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启用状态-没有启用就是什么数据都没有
|
||||
/// Const-常值-常值,StepValue有值,只有一个步骤,CycleTime为0
|
||||
/// MultisStep-有步骤细节-此时在一个仪表下就会有很多步骤的细节数据
|
||||
/// </summary>
|
||||
[Column(Name = "ConfigState", IsNullable = false, StringLength = 10)]
|
||||
public string ConfigState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID NO-CpPIDNoInfo-用的是Cp表的QuickCpPIDNo模型,是一样的,因为里面有仪表名称
|
||||
/// </summary>
|
||||
public QuickCpPIDNo KpPIDNoInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Limit NO
|
||||
/// </summary>
|
||||
[Column(Name = "LitmitNo", IsNullable = true)]
|
||||
public int LitmitNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PID NO-CpPIDNoInfo 用的是Cp表的QuickCpLimtNo模型,是一样的,因为里面有仪表名称
|
||||
/// </summary>
|
||||
public QuickCpLimtNo KpLimitNoInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm NO
|
||||
/// </summary>
|
||||
[Column(Name = "AlarmNo", IsNullable = true)]
|
||||
public int AlarmNo { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 步进重复
|
||||
///// </summary>
|
||||
//[Column(Name = "Repeat", IsNullable = true)]
|
||||
//public int StepRepeat { get; set; }
|
||||
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
////////////////////////步骤运行时间//////////////////////////
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
///// <summary>
|
||||
///// 当前仪表步骤执行时间信息
|
||||
///// </summary>
|
||||
//public CpRunTime CpRunTimeInfo { get; set; }
|
||||
}
|
||||
}
|
||||
15
CapMachine.Shared/CapMachine.Shared.csproj
Normal file
15
CapMachine.Shared/CapMachine.Shared.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
156
CapMachine.Shared/Controls/MeterConfig.xaml
Normal file
156
CapMachine.Shared/Controls/MeterConfig.xaml
Normal file
@@ -0,0 +1,156 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Shared.Controls.MeterConfig"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="MeterConfigInstance"
|
||||
d:DesignHeight="330"
|
||||
d:DesignWidth="360"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
</Style>
|
||||
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.ColumnSpan="3" Margin="1">
|
||||
<Border
|
||||
Padding="3"
|
||||
Background="LightSteelBlue"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}" />
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="起始速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StartValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="结束速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.EndValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="维持时间"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.KeepTime}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=AddCommand}"
|
||||
Content="增加"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="增加程序步骤内的速度设置" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=EditCommand}"
|
||||
Content="修改"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="修改程序步骤内的速度设置,请先选中" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=DeleteCommand}"
|
||||
Content="删除"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="删除程序步骤内的速度设置,请先选中" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="3"
|
||||
Margin="3,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewMeter"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=MeterSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewMeter, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding StepNo}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding StartValue}"
|
||||
Header="起始速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding EndValue}"
|
||||
Header="终止速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding KeepTime}"
|
||||
Header="持续时间" />
|
||||
</GridView>
|
||||
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
122
CapMachine.Shared/Controls/MeterConfig.xaml.cs
Normal file
122
CapMachine.Shared/Controls/MeterConfig.xaml.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CapMachine.Shared.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// MeterConfig.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MeterConfig : UserControl
|
||||
{
|
||||
public MeterConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string MeterName
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)base.GetValue(MeterConfig.MeterNameProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.MeterNameProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(MeterConfig), new PropertyMetadata("速度"));
|
||||
|
||||
|
||||
//MeterSlopCell
|
||||
public object SelectedMeter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (MeterSlopCell)base.GetValue(MeterConfig.SelectedMeterProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.SelectedMeterProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty SelectedMeterProperty = DependencyProperty.Register("SelectedMeter", typeof(object), typeof(MeterConfig), new PropertyMetadata(null));
|
||||
|
||||
|
||||
//MeterSlopCell
|
||||
public IEnumerable ListMeter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable)base.GetValue(MeterConfig.ListMeterProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.ListMeterProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty ListMeterProperty = DependencyProperty.Register("ListMeter", typeof(IEnumerable), typeof(MeterConfig), new PropertyMetadata(null));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add 命令
|
||||
/// </summary>
|
||||
public ICommand AddCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(AddCommandProperty); }
|
||||
set { SetValue(AddCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty AddCommandProperty =
|
||||
DependencyProperty.Register("AddCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
/// <summary>
|
||||
/// Edit 命令
|
||||
/// </summary>
|
||||
public ICommand EditCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(EditCommandProperty); }
|
||||
set { SetValue(EditCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty EditCommandProperty =
|
||||
DependencyProperty.Register("EditCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
/// <summary>
|
||||
/// Delete 命令
|
||||
/// </summary>
|
||||
public ICommand DeleteCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(DeleteCommandProperty); }
|
||||
set { SetValue(DeleteCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty DeleteCommandProperty =
|
||||
DependencyProperty.Register("DeleteCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
|
||||
//MeterSelectedChangedCmd
|
||||
/// <summary>
|
||||
/// Add 命令
|
||||
/// </summary>
|
||||
public ICommand MeterSelectedChangedCmd
|
||||
{
|
||||
get { return (ICommand)GetValue(MeterSelectedChangedCmdProperty); }
|
||||
set { SetValue(MeterSelectedChangedCmdProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty MeterSelectedChangedCmdProperty =
|
||||
DependencyProperty.Register("MeterSelectedChangedCmd", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
27
CapMachine.Shared/Controls/MeterSlopCell.cs
Normal file
27
CapMachine.Shared/Controls/MeterSlopCell.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Shared.Controls
|
||||
{
|
||||
public class MeterSlopCell
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始值
|
||||
/// </summary>
|
||||
public double StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束值
|
||||
/// </summary>
|
||||
public double EndValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维持时间
|
||||
/// </summary>
|
||||
public double KeepTime { get; set; }
|
||||
}
|
||||
}
|
||||
7
CapMachine.Shared/Themes/Generic.xaml
Normal file
7
CapMachine.Shared/Themes/Generic.xaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/ControllableValve.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/MFC_EPC.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/UnControllableValve.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
8
CapMachine.Wpf/App.config
Normal file
8
CapMachine.Wpf/App.config
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="connecting1" value="Data Source=192.168.40.2;user instance=false;Initial Catalog=FrontLineMachine;User ID=sa;Password=ABCabc123"/>
|
||||
<add key="connecting" value="Data Source=CT-PC;user instance=false;Initial Catalog=CapMachine;User ID=sa;Password=12345678"/>
|
||||
<add key="PLCScan" value="600"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
25
CapMachine.Wpf/App.xaml
Normal file
25
CapMachine.Wpf/App.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<prism:PrismApplication
|
||||
x:Class="CapMachine.Wpf.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:prism="http://prismlibrary.com/">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!--<materialDesign:BundledTheme
|
||||
BaseTheme="Dark"
|
||||
ColorAdjustment="{materialDesign:ColorAdjustment}"
|
||||
PrimaryColor="LightBlue"
|
||||
SecondaryColor="Amber" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/CapMachine.Shared;component/Themes/Generic.xaml" />-->
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.LightBlue.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</prism:PrismApplication>
|
||||
149
CapMachine.Wpf/App.xaml.cs
Normal file
149
CapMachine.Wpf/App.xaml.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Core.IService;
|
||||
using CapMachine.Wpf.MapperProfile;
|
||||
using CapMachine.Wpf.Services;
|
||||
using CapMachine.Wpf.ViewModels;
|
||||
using CapMachine.Wpf.Views;
|
||||
using FreeSql;
|
||||
using Prism.DryIoc;
|
||||
using Prism.Ioc;
|
||||
using Prism.Regions;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : PrismApplication
|
||||
{
|
||||
public App()
|
||||
{
|
||||
try
|
||||
{
|
||||
//24.2.7
|
||||
//Syncfusion.SfSkinManager.SfSkinManager.ApplyStylesOnApplication = true;
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzEyMzM3NkAzMjM0MmUzMDJlMzBHdjVKNUNpNWZxYXQwR05ZbVYvUEtzbGxXMnVxRjYvRGtLSlZUOGpjQW44PQ==");
|
||||
|
||||
// 授权 a717c797-59e3-48de-b6b4-574a4e03dc79
|
||||
if (!HslCommunication.Authorization.SetAuthorizationCode("a717c797-59e3-48de-b6b4-574a4e03dc79"))
|
||||
{
|
||||
//active failed
|
||||
//MessageBox.Show("授权失败!当前程序只能使用8小时!");
|
||||
//return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//IsActive = true;
|
||||
}
|
||||
|
||||
//SfSkinManager.ApplyStylesOnApplication = true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Window CreateShell() => null;
|
||||
|
||||
|
||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
////注册日志服务
|
||||
//containerRegistry.RegisterSingleton<ILogService, LogService>();
|
||||
|
||||
////注册设备服务
|
||||
//containerRegistry.RegisterSingleton<MachineDataService>();
|
||||
containerRegistry.RegisterSingleton<PlcRtDataService>();
|
||||
|
||||
//注册AutoMapper 将IAutoMapperProvider注入IOC容器,并对外提供IMapper注入类型。
|
||||
containerRegistry.RegisterSingleton<IMapperProvider, MapperConfig>();
|
||||
containerRegistry.Register(typeof(IMapper), GetMapper);
|
||||
|
||||
//注册IFreeSql实例 单例
|
||||
containerRegistry.RegisterSingleton<IFreeSql>(() =>
|
||||
{
|
||||
IFreeSql Fsql = new FreeSqlBuilder()
|
||||
//.UseConnectionString(DataType.SqlServer, "Data Source=CT-PC;user instance=false;Initial Catalog=KylinEMS;Encrypt=True;TrustServerCertificate=True;User ID=sa;Password=12345678")
|
||||
.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=CT-PC;user instance=false;Initial Catalog=CapMachine;Encrypt=True;TrustServerCertificate=True;User ID=sa;Password=12345678")
|
||||
.UseAutoSyncStructure(true)
|
||||
.Build();
|
||||
return Fsql;
|
||||
});
|
||||
|
||||
containerRegistry.RegisterSingleton<INavigationMenuService, NavigationMenuService>();
|
||||
containerRegistry.RegisterForNavigation<MainView, MainViewModel>();
|
||||
containerRegistry.RegisterForNavigation<MonitorView, MonitorViewModel>();
|
||||
containerRegistry.RegisterForNavigation<ProConfigView, ProConfigViewModel>();
|
||||
containerRegistry.RegisterForNavigation<RealTimeChartView, RealTimeChartViewModel>();
|
||||
//containerRegistry.RegisterForNavigation<ProChartView, ProChartViewModel>();
|
||||
//containerRegistry.RegisterForNavigation<ProConfigView, ProConfigViewModel>();
|
||||
|
||||
//注册Dialog视图时绑定VM
|
||||
containerRegistry.RegisterDialog<DialogCreateProView, DialogCreateProViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogEditProView, DialogEditProViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogChartRtConfigView, DialogChartRtConfigViewModel>();
|
||||
|
||||
//注册AutoMapper
|
||||
//containerRegistry.RegisterSingleton<IAutoMapperProvider, AutoMapperProvider>();
|
||||
//containerRegistry.Register(typeof(IMapper), GetMapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//private IMapper GetMapper(IContainerProvider container)
|
||||
//{
|
||||
// var provider = container.Resolve<IAutoMapperProvider>();
|
||||
// return provider.GetMapper();
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 将IAutoMapperProvider注入IOC容器,并对外提供IMapper注入类型。
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <returns></returns>
|
||||
private IMapper GetMapper(IContainerProvider container)
|
||||
{
|
||||
var provider = container.Resolve<IMapperProvider>();
|
||||
return provider.GetMapper();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统初始化
|
||||
/// </summary>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
//从容器中获取MainView的实例对象
|
||||
var container = ContainerLocator.Container;
|
||||
var shell = container.Resolve<object>("MainView");
|
||||
if (shell is Window view)
|
||||
{
|
||||
//更新Prism注册区域信息
|
||||
var regionManager = container.Resolve<IRegionManager>();
|
||||
RegionManager.SetRegionManager(view, regionManager);
|
||||
RegionManager.UpdateRegions();
|
||||
|
||||
//调用首页的INavigationAware 接口做一个初始化操作
|
||||
if (view.DataContext is INavigationAware navigationAware)
|
||||
{
|
||||
navigationAware.OnNavigatedTo(null);
|
||||
//呈现首页
|
||||
App.Current.MainWindow = view;
|
||||
}
|
||||
}
|
||||
|
||||
//先加载服务,防止在ViewModel中使用时速度慢
|
||||
var appVersionService = ContainerLocator.Container.Resolve<IFreeSql>();
|
||||
//var appVersionService1 = ContainerLocator.Container.Resolve<MachineDataService>();
|
||||
//var appVersionService2 = ContainerLocator.Container.Resolve<ILogService>();
|
||||
var appVersionService3 = ContainerLocator.Container.Resolve<PlcRtDataService>();
|
||||
|
||||
base.OnInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
10
CapMachine.Wpf/AssemblyInfo.cs
Normal file
10
CapMachine.Wpf/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
49
CapMachine.Wpf/CapMachine.Wpf.csproj
Normal file
49
CapMachine.Wpf/CapMachine.Wpf.csproj
Normal file
@@ -0,0 +1,49 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="FreeSql" Version="3.2.808" />
|
||||
<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.808" />
|
||||
<PackageReference Include="FreeSql.Repository" Version="3.2.808" />
|
||||
<PackageReference Include="HslCommunication" Version="11.7.0" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
<PackageReference Include="NLog" Version="5.2.8" />
|
||||
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
|
||||
<PackageReference Include="Syncfusion.Licensing" Version="24.2.7" />
|
||||
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="24.2.7" />
|
||||
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="Dtos\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CapMachine.Core\CapMachine.Core.csproj" />
|
||||
<ProjectReference Include="..\CapMachine.Model\CapMachine.Model.csproj" />
|
||||
<ProjectReference Include="..\CapMachine.Shared\CapMachine.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Arction.DirectX">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.DirectX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Licensing">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.Licensing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.RenderingDefinitions">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.RenderingDefinitions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Wpf.Charting.LightningChart">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.Wpf.Charting.LightningChart.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
30
CapMachine.Wpf/MapperProfile/ChartSelectProfile.cs
Normal file
30
CapMachine.Wpf/MapperProfile/ChartSelectProfile.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Wpf.Models;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// 源类的属性名称和目标类的属性名称相同(不区分大小写),直接匹配,Mapper.CreateMap<source,dest>();无需做其他处理,此处不再细述
|
||||
/// 1,智能匹配
|
||||
/// AutoMapper能够自动识别和匹配大部分对象属性:
|
||||
/// 如果源类和目标类的属性名称相同,直接匹配,不区分大小写
|
||||
/// 目标类型的CustomerName可以匹配源类型的Customer.Name
|
||||
/// 目标类型的Total可以匹配源类型的GetTotal() 方法
|
||||
/// </summary>
|
||||
public class ChartSelectProfile : Profile
|
||||
{
|
||||
public ChartSelectProfile()
|
||||
{
|
||||
CreateMap<ConfigChartSelect, ChartSelectDto>()
|
||||
.ForMember(dest => dest.Index, opt => opt.MapFrom(src => src.Index))
|
||||
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
|
||||
//.ForMember(dest => dest.Id, opt => opt.Ignore())//忽略目标类中的属性
|
||||
//.ForMember(dest => dest.OrderDate, opt => opt.UserValue<DateTime>(DateTime.Now)); //固定值匹配
|
||||
//.ForMember(dest => dest.TotalAmount, opt => opt.MapFrom(src => src.TotalAmount ?? 0)) //复杂的匹配
|
||||
//.ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.WorkEvent.Date)) //属性匹配,匹配源类中WorkEvent.Date到EventDate
|
||||
.ForMember(dest => dest.YAxis, opt => opt.MapFrom(src => src.ConfigChartYAxis))//
|
||||
.ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
CapMachine.Wpf/MapperProfile/ChartYAxisProfile.cs
Normal file
19
CapMachine.Wpf/MapperProfile/ChartYAxisProfile.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Wpf.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
public class ChartYAxisProfile:Profile
|
||||
{
|
||||
public ChartYAxisProfile()
|
||||
{
|
||||
CreateMap<ChartYAxisDto,ConfigChartYAxis>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
CapMachine.Wpf/MapperProfile/IMapperProvider.cs
Normal file
14
CapMachine.Wpf/MapperProfile/IMapperProvider.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
public interface IMapperProvider
|
||||
{
|
||||
IMapper GetMapper();
|
||||
}
|
||||
}
|
||||
34
CapMachine.Wpf/MapperProfile/MapperConfig.cs
Normal file
34
CapMachine.Wpf/MapperProfile/MapperConfig.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using AutoMapper;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
public class MapperConfig : IMapperProvider
|
||||
{
|
||||
private readonly MapperConfiguration _Configuration;
|
||||
|
||||
public MapperConfig(IContainerProvider container)
|
||||
{
|
||||
_Configuration = new MapperConfiguration(configure =>
|
||||
{
|
||||
//var assemblys = AppDomain.CurrentDomain.GetAssemblies();
|
||||
//configure.AddMaps(assemblys);
|
||||
|
||||
configure.ConstructServicesUsing(container.Resolve);
|
||||
|
||||
//扫描profile文件
|
||||
configure.AddMaps(AppDomain.CurrentDomain.GetAssemblies());
|
||||
});
|
||||
}
|
||||
|
||||
public IMapper GetMapper()
|
||||
{
|
||||
return _Configuration.CreateMapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
CapMachine.Wpf/Models/ChartConfig.cs
Normal file
36
CapMachine.Wpf/Models/ChartConfig.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线的配置
|
||||
/// </summary>
|
||||
public class ChartConfig
|
||||
{
|
||||
public List<Color> ListColor = new List<Color>()
|
||||
{
|
||||
Colors.White,
|
||||
Colors.Red,
|
||||
Colors.Blue,
|
||||
Colors.Green,
|
||||
Colors.Orange,
|
||||
Colors.Brown,
|
||||
Colors.Lime,
|
||||
Colors.LightBlue,
|
||||
Colors.Yellow,
|
||||
Colors.BurlyWood,
|
||||
Colors.Gold,
|
||||
Colors.Magenta,
|
||||
Colors.MediumVioletRed,
|
||||
Colors.MintCream,
|
||||
Colors.Cornsilk,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
63
CapMachine.Wpf/Models/ChartLvRtData.cs
Normal file
63
CapMachine.Wpf/Models/ChartLvRtData.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线图表 ListView的实时数据信息
|
||||
/// </summary>
|
||||
public class ChartLvRtData : BindableBase
|
||||
{
|
||||
|
||||
private string? _Name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name
|
||||
{
|
||||
get { return _Name; }
|
||||
set { _Name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public double Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Max;
|
||||
/// <summary>
|
||||
/// Max
|
||||
/// </summary>
|
||||
public double Max
|
||||
{
|
||||
get { return _Max; }
|
||||
set { _Max = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Min;
|
||||
/// <summary>
|
||||
/// Min
|
||||
/// </summary>
|
||||
public double Min
|
||||
{
|
||||
get { return _Min; }
|
||||
set { _Min = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private string? _Unit;
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit
|
||||
{
|
||||
get { return _Unit; }
|
||||
set { _Unit = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
250
CapMachine.Wpf/Models/ChartRtSeries.cs
Normal file
250
CapMachine.Wpf/Models/ChartRtSeries.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
using Arction.Wpf.Charting;
|
||||
using Arction.Wpf.Charting.Annotations;
|
||||
using Arction.Wpf.Charting.Axes;
|
||||
using Arction.Wpf.Charting.Series3D;
|
||||
using Arction.Wpf.Charting.SeriesXY;
|
||||
using Arction.Wpf.Charting.Views.ViewXY;
|
||||
using ImTools;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线实时系列模型
|
||||
/// </summary>
|
||||
public class ChartRtSeries:BindableBase
|
||||
{
|
||||
public ChartRtSeries(AxisY axisY, LightningChart lightningChart, string SeriesName)
|
||||
{
|
||||
//var CreateAxisY = new AxisY();
|
||||
//CreateAxisY.Title.Text = Name;
|
||||
//CreateAxisY.Title.AllowDragging = false;
|
||||
//CreateAxisY.SetRange(0, 100);
|
||||
//CreateAxisY.MajorGrid.Visible = false;
|
||||
////取消滚轮缩放
|
||||
//CreateAxisY.ZoomingEnabled = false;
|
||||
|
||||
//模型赋值
|
||||
LightningChartInstance = lightningChart;
|
||||
ChartAxisY = axisY;
|
||||
ChartAxisX = lightningChart.ViewXY.XAxes[0];
|
||||
Name = SeriesName;
|
||||
|
||||
Unit = "℃";
|
||||
|
||||
//判断别重复,因为可能共用Y轴的信息
|
||||
//绑定lightningChart
|
||||
lightningChart.ViewXY.YAxes.Add(axisY);
|
||||
|
||||
ChartPointLineSeries = new PointLineSeries(lightningChart.ViewXY, lightningChart.ViewXY.XAxes[0], axisY);
|
||||
ChartPointLineSeries.Title.Text = SeriesName;
|
||||
//绑定lightningChart
|
||||
lightningChart.ViewXY.PointLineSeries.Add(ChartPointLineSeries);
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 名称
|
||||
///// </summary>
|
||||
//public string? Name { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 值
|
||||
///// </summary>
|
||||
//public double Value { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Max
|
||||
///// </summary>
|
||||
//public double Max { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Min
|
||||
///// </summary>
|
||||
//public double Min { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 单位
|
||||
///// </summary>
|
||||
//public string? Unit { get; set; }
|
||||
|
||||
private string? _Name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name
|
||||
{
|
||||
get { return _Name; }
|
||||
set { _Name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public double Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Max;
|
||||
/// <summary>
|
||||
/// Max
|
||||
/// </summary>
|
||||
public double Max
|
||||
{
|
||||
get { return _Max; }
|
||||
set { _Max = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private double _Min;
|
||||
/// <summary>
|
||||
/// Min
|
||||
/// </summary>
|
||||
public double Min
|
||||
{
|
||||
get { return _Min; }
|
||||
set { _Min = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private string? _Unit;
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit
|
||||
{
|
||||
get { return _Unit; }
|
||||
set { _Unit = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 曲线
|
||||
/// </summary>
|
||||
public PointLineSeries? ChartPointLineSeries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y轴
|
||||
/// </summary>
|
||||
public AxisY? ChartAxisY { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X轴
|
||||
/// </summary>
|
||||
public AxisX? ChartAxisX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// LightningChart 实例
|
||||
/// </summary>
|
||||
public LightningChart LightningChartInstance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X轴滚动
|
||||
/// </summary>
|
||||
private bool ScrollEnable = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Chart图表X轴的跨度-秒
|
||||
/// </summary>
|
||||
private int ChartXDateTimeRange = 3600;
|
||||
|
||||
/// <summary>
|
||||
/// 增加数据
|
||||
/// </summary>
|
||||
public void AddValue(double Data)
|
||||
{
|
||||
//foreach (var item in lightningChart1.ViewXY.PointLineSeries)
|
||||
//{
|
||||
//Disable updates, to prevent several extra refreshes
|
||||
LightningChartInstance.BeginUpdate();
|
||||
|
||||
//Array for 1 point
|
||||
SeriesPoint[] points = new SeriesPoint[1];
|
||||
|
||||
//Convert 'Now' to X value
|
||||
var _previousX = LightningChartInstance.ViewXY.XAxes[0].DateTimeToAxisValue(DateTime.Now);
|
||||
points[0].X = _previousX;
|
||||
points[0].Y = Data;
|
||||
//Add the new point into end of first PointLineSeries
|
||||
ChartPointLineSeries.AddPoints(points, false);
|
||||
|
||||
ChartPointLineSeries.DeletePointsBeforeX(_previousX - ChartXDateTimeRange);
|
||||
//item.DeletePointsBeforeX(_previousX - 100);
|
||||
|
||||
if (ScrollEnable)
|
||||
{
|
||||
LightningChartInstance.ViewXY.XAxes[0].ScrollPosition = _previousX;
|
||||
}
|
||||
|
||||
|
||||
//Allow updates again, and update
|
||||
LightningChartInstance.EndUpdate();
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solve value from series data points array. Accurate method, but slower than SolveValueCoarse
|
||||
/// </summary>
|
||||
/// <param name="series">Series</param>
|
||||
/// <param name="xValue">X value</param>
|
||||
/// <param name="yValue">Output Y value</param>
|
||||
/// <returns>Success status</returns>
|
||||
private bool SolveValueAccurate(PointLineSeries series, double xValue, out double yValue)
|
||||
{
|
||||
AxisY axisY = LightningChartInstance.ViewXY.YAxes[series.AssignYAxisIndex];
|
||||
yValue = 0;
|
||||
|
||||
LineSeriesValueSolveResult result = series.SolveYValueAtXValue(xValue);
|
||||
if (result.SolveStatus == LineSeriesSolveStatus.OK)
|
||||
{
|
||||
//PointLineSeries may have two or more points at same X value. If so, center it between min and max
|
||||
yValue = (result.YMax + result.YMin) / 2.0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solve value from screen coordinates. Faster method, but not less accurateValue than SolveValueAccurate
|
||||
/// </summary>
|
||||
/// <param name="series">Series</param>
|
||||
/// <param name="xValue">X value</param>
|
||||
/// <param name="yValue">Output Y value</param>
|
||||
/// <returns>Success status</returns>
|
||||
private bool SolveValueCoarse(PointLineSeries series, double xValue, out double yValue)
|
||||
{
|
||||
AxisY axisY = LightningChartInstance.ViewXY.YAxes[series.AssignYAxisIndex];
|
||||
float coordX = LightningChartInstance.ViewXY.XAxes[0].ValueToCoord(xValue);
|
||||
float coordY;
|
||||
yValue = 0;
|
||||
|
||||
LineSeriesCoordinateSolveResult result = series.SolveYCoordAtXCoord(coordX);
|
||||
if (result.SolveStatus == LineSeriesSolveStatus.OK)
|
||||
{
|
||||
coordY = (result.CoordBottom + result.CoordTop) / 2f;
|
||||
if (axisY.CoordToValue((int)Math.Round(coordY), out yValue) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
48
CapMachine.Wpf/Models/ChartRtValue.cs
Normal file
48
CapMachine.Wpf/Models/ChartRtValue.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Arction.Wpf.Charting.Axes;
|
||||
using Arction.Wpf.Charting.SeriesXY;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线实时数据模型
|
||||
/// </summary>
|
||||
public class ChartRtValue
|
||||
{
|
||||
public ChartRtValue()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public double Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max
|
||||
/// </summary>
|
||||
public double Max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Min
|
||||
/// </summary>
|
||||
public double Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
57
CapMachine.Wpf/Models/ChartSelectDto.cs
Normal file
57
CapMachine.Wpf/Models/ChartSelectDto.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线选择数据
|
||||
/// </summary>
|
||||
public class ChartSelectDto : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public string? Category { get; set; }
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// Y轴
|
||||
///// </summary>
|
||||
//public string? YAxis { get; set; }
|
||||
|
||||
private ChartYAxisDto _YAxis=new ChartYAxisDto();
|
||||
/// <summary>
|
||||
/// Y轴
|
||||
/// </summary>
|
||||
public ChartYAxisDto YAxis
|
||||
{
|
||||
get { return _YAxis; }
|
||||
set { _YAxis = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Y轴
|
||||
///// </summary>
|
||||
//public ChartYAxisData? YAxis { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
36
CapMachine.Wpf/Models/ChartSrcData.cs
Normal file
36
CapMachine.Wpf/Models/ChartSrcData.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线数据源信息
|
||||
/// </summary>
|
||||
public class ChartSrcData:BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
private bool _Selected;
|
||||
/// <summary>
|
||||
/// 选中
|
||||
/// </summary>
|
||||
public bool Selected
|
||||
{
|
||||
get { return _Selected; }
|
||||
set { _Selected = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 选中
|
||||
///// </summary>
|
||||
//public bool? Selected { get; set; }
|
||||
}
|
||||
}
|
||||
44
CapMachine.Wpf/Models/ChartYAxisDto.cs
Normal file
44
CapMachine.Wpf/Models/ChartYAxisDto.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Y轴标尺
|
||||
/// </summary>
|
||||
public class ChartYAxisDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标尺名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max
|
||||
/// </summary>
|
||||
public double Max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Min
|
||||
/// </summary>
|
||||
public double Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
}
|
||||
}
|
||||
328
CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs
Normal file
328
CapMachine.Wpf/Models/Meter/MeterRtDataModel.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
using CapMachine.Model;
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 仪表实时数据
|
||||
/// </summary>
|
||||
public class MeterRtDataModel : BindableBase
|
||||
{
|
||||
public delegate void MeterStepTrackDelegate(string MeterName, int NextStep);
|
||||
public event MeterStepTrackDelegate MeterStepTrackEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public MeterRtDataModel()
|
||||
{
|
||||
ListProStepExecuteInfo = new List<ProStepExecute>();
|
||||
ListQuickProStepExecuteInfo = new List<QuickProStepExecute>();
|
||||
QuickRunTimeInfo = new QuickRunTime();
|
||||
QuickNextMeterStep = new QuickProStepExecute();
|
||||
RunTimeInfo = new MeterRunTime();
|
||||
NextMeterStep = new ProStepExecute();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 仪表类型
|
||||
/// </summary>
|
||||
public MeterType MeterTypeInfo { get; set; }
|
||||
|
||||
|
||||
private int _MeterStepTrack;
|
||||
/// <summary>
|
||||
/// 步骤追踪
|
||||
/// </summary>
|
||||
public int MeterStepTrack
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MeterStepTrack;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
if (value != _MeterStepTrack)//步骤改动
|
||||
{
|
||||
_MeterStepTrack = value;
|
||||
//MeterStepTrackEvent(MeterName, value);//开始动作
|
||||
}
|
||||
|
||||
_MeterStepTrack = value;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////仪表实时数据///////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#region 仪表实时数据
|
||||
/// <summary>
|
||||
/// 通信结果长度连续值
|
||||
/// </summary>
|
||||
private OperateResult<Int16[]> _RtOperateResultContinuousData;
|
||||
public OperateResult<Int16[]> RtOperateResultContinuousData
|
||||
{
|
||||
get { return _RtOperateResultContinuousData; }
|
||||
set { _RtOperateResultContinuousData = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通信结果PV值
|
||||
/// </summary>
|
||||
private OperateResult<Int16> _RtOperateResultPV;
|
||||
public OperateResult<Int16> RtOperateResultPV
|
||||
{
|
||||
get { return _RtOperateResultPV; }
|
||||
set { _RtOperateResultPV = value; }
|
||||
}
|
||||
private double _RtPV;
|
||||
/// <summary>
|
||||
/// 实时值PV
|
||||
/// </summary>
|
||||
public double RtPV
|
||||
{
|
||||
get { return _RtPV; }
|
||||
set { _RtPV = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通信结果MV值
|
||||
/// </summary>
|
||||
private OperateResult<Int16> _RtOperateResultMV;
|
||||
public OperateResult<Int16> RtOperateResultMV
|
||||
{
|
||||
get { return _RtOperateResultMV; }
|
||||
set { _RtOperateResultMV = value; }
|
||||
}
|
||||
|
||||
private double _RtMV;
|
||||
/// <summary>
|
||||
/// 实时值MV
|
||||
/// </summary>
|
||||
public double RtMV
|
||||
{
|
||||
get { return _RtMV; }
|
||||
set { _RtMV = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通信结果SV值
|
||||
/// </summary>
|
||||
private OperateResult<Int16> _RtOperateResultSV;
|
||||
public OperateResult<Int16> RtOperateResultSV
|
||||
{
|
||||
get { return _RtOperateResultSV; }
|
||||
set { _RtOperateResultSV = value; }
|
||||
}
|
||||
|
||||
private double _RtSV;
|
||||
/// <summary>
|
||||
/// 实时值SV
|
||||
/// </summary>
|
||||
public double RtSV
|
||||
{
|
||||
get { return _RtSV; }
|
||||
set { _RtSV = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PV值的地址
|
||||
/// </summary>
|
||||
public string RtAddressPV;
|
||||
|
||||
/// <summary>
|
||||
/// MV值的地址
|
||||
/// </summary>
|
||||
public string RtAddressMV;
|
||||
|
||||
/// <summary>
|
||||
/// SV值的地址
|
||||
/// </summary>
|
||||
public string RtAddressSV;
|
||||
|
||||
/// <summary>
|
||||
/// MV值的UI展示名称
|
||||
/// </summary>
|
||||
public string RtMVUIControlIndex;
|
||||
|
||||
/// <summary>
|
||||
/// PV值的UI展示名称
|
||||
/// </summary>
|
||||
public string RtPVUIControlIndex;
|
||||
|
||||
/// <summary>
|
||||
/// SV值的UI展示名称
|
||||
/// </summary>
|
||||
public string RtSVUIControlIndex;
|
||||
|
||||
/// <summary>
|
||||
/// UI展示名称标题
|
||||
/// </summary>
|
||||
public string RtUIControlTitle;
|
||||
|
||||
/// <summary>
|
||||
/// UI展示名称控件
|
||||
/// </summary>
|
||||
public string RtUIControlTitleIndex;
|
||||
|
||||
#endregion
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////仪表整体信息///////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#region 仪表整体信息
|
||||
/// <summary>
|
||||
/// 仪表连接状态
|
||||
/// </summary>
|
||||
public bool LinkState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表名称
|
||||
/// </summary>
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表站号
|
||||
/// </summary>
|
||||
public byte Station { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
public double MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
public double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// </summary>
|
||||
public Int16 Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采样周期
|
||||
/// </summary>
|
||||
public int SamplingPeriod { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////仪表程序使能//////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表使能状态
|
||||
/// 根据程序步骤里面有没有涉及到本仪表的步骤个数
|
||||
/// </summary>
|
||||
public bool MeterEnableState = false;
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表使能状态
|
||||
///需要在执行时发送数据给PLC
|
||||
/// </summary>
|
||||
public string MeterEnableStatePLCAddress = string.Empty;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////程序段//////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
/// 程序段和程序步骤执行具体方法
|
||||
/// </summary>
|
||||
public List<ProStepExecute> ListProStepExecuteInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 快速设置程序段和程序步骤执行具体方法
|
||||
/// </summary>
|
||||
public List<QuickProStepExecute> ListQuickProStepExecuteInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表当前步骤执行时间信息
|
||||
/// </summary>
|
||||
public MeterRunTime RunTimeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quick仪表当前步骤执行时间信息
|
||||
/// </summary>
|
||||
public QuickRunTime QuickRunTimeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仪表当前步骤是否存在下一步
|
||||
/// </summary>
|
||||
public bool IsExistMeterNextStep { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 仪表下一步具体程序步骤
|
||||
/// </summary>
|
||||
public ProStepExecute NextMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quick仪表下一步具体程序步骤
|
||||
/// </summary>
|
||||
public QuickProStepExecute QuickNextMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quick仪表【当前步骤】具体程序步骤
|
||||
/// 给看步骤是否变化使用
|
||||
/// </summary>
|
||||
public QuickProStepExecute QuickCurrentMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段名称
|
||||
/// </summary>
|
||||
public string CurrentProName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段步骤
|
||||
/// </summary>
|
||||
public int CurrentProStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段时间长
|
||||
/// </summary>
|
||||
public int CurrentProTimeSum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段开始时间
|
||||
/// </summary>
|
||||
public DateTime CurrentProStartTime { set; get; }
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////仪表步骤数据///////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表步骤
|
||||
/// </summary>
|
||||
public int CurrentMeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表步骤时间长
|
||||
/// </summary>
|
||||
public int CurrentMeterTimeSum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表开始时间
|
||||
/// </summary>
|
||||
public DateTime CurrentMeterStartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表步骤剩余时间
|
||||
/// </summary>
|
||||
public int CurrentMeterRemainTime { get; set; }
|
||||
}
|
||||
}
|
||||
80
CapMachine.Wpf/Models/Meter/MeterRunTime.cs
Normal file
80
CapMachine.Wpf/Models/Meter/MeterRunTime.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Kp表单步跟踪其运行时间跟踪信息
|
||||
/// </summary>
|
||||
public class MeterRunTime
|
||||
{
|
||||
public delegate void RunTimeCallSglDelegate(string ProName, string MeterName, int MeterStep);
|
||||
public event RunTimeCallSglDelegate RunTimeCallSglEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool RunEnable { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表名称
|
||||
/// </summary>
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段名称
|
||||
/// </summary>
|
||||
public string ProName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表程序步骤
|
||||
/// </summary>
|
||||
public int MeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤开始运行时间
|
||||
/// </summary>
|
||||
public DateTime StartDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤结束运行时间
|
||||
/// </summary>
|
||||
public DateTime EndDateTime { get; set; }
|
||||
|
||||
|
||||
private DateTime currentDateTime;
|
||||
/// <summary>
|
||||
/// 当前时间
|
||||
/// </summary>
|
||||
public DateTime CurrentDateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentDateTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (RunEnable == true && value.ToString("yyyy-MM-dd HH:mm:ss") == EndDateTime.ToString("yyyy-MM-dd HH:mm:ss"))
|
||||
{
|
||||
currentDateTime = value;
|
||||
//时间到了触发下载新的步骤
|
||||
RunTimeCallSglEvent(ProName, MeterName, MeterStep);
|
||||
//RunEnable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDateTime = value;
|
||||
RunTime = (int)(currentDateTime - StartDateTime).TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤已经运行时长-秒
|
||||
/// </summary>
|
||||
public int RunTime { get; set; }
|
||||
}
|
||||
}
|
||||
18
CapMachine.Wpf/Models/Meter/MeterType.cs
Normal file
18
CapMachine.Wpf/Models/Meter/MeterType.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 仪表类型
|
||||
/// </summary>
|
||||
public enum MeterType
|
||||
{
|
||||
KP=1,
|
||||
CP=2,
|
||||
DP=3
|
||||
}
|
||||
}
|
||||
85
CapMachine.Wpf/Models/Meter/QuickRunTime.cs
Normal file
85
CapMachine.Wpf/Models/Meter/QuickRunTime.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
public class QuickRunTime
|
||||
{
|
||||
public delegate void RunTimeCallSglDelegate(string ProName, string MeterName, int MeterStep);
|
||||
public event RunTimeCallSglDelegate RunTimeCallSglEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool RunEnable { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// RunTimeCallSglEvent 是否注册关联方法
|
||||
/// </summary>
|
||||
public bool EventRegister { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表名称
|
||||
/// </summary>
|
||||
public string MeterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序段名称
|
||||
/// </summary>
|
||||
public string ProName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前仪表程序步骤
|
||||
/// </summary>
|
||||
public int MeterStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤开始运行时间
|
||||
/// </summary>
|
||||
public DateTime StartDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤结束运行时间
|
||||
/// </summary>
|
||||
public DateTime EndDateTime { get; set; }
|
||||
|
||||
|
||||
private DateTime currentDateTime;
|
||||
/// <summary>
|
||||
/// 当前时间
|
||||
/// </summary>
|
||||
public DateTime CurrentDateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentDateTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
//value.ToString("yyyy-MM-dd HH:mm:ss") == EndDateTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
if (RunEnable == true && value >= EndDateTime)
|
||||
{
|
||||
currentDateTime = value;
|
||||
RunEnable = false;
|
||||
//时间到了触发下载新的步骤
|
||||
//RunTimeCallSglEvent(ProName, MeterName, MeterStep);
|
||||
RunTimeCallSglEvent.BeginInvoke(ProName, MeterName, MeterStep, null, null);
|
||||
//RunEnable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDateTime = value;
|
||||
RunTime = (int)(currentDateTime - StartDateTime).TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤已经运行时长-秒
|
||||
/// </summary>
|
||||
public int RunTime { get; set; }
|
||||
}
|
||||
}
|
||||
60
CapMachine.Wpf/Models/NavigationItem.cs
Normal file
60
CapMachine.Wpf/Models/NavigationItem.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Prism.Mvvm;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单功能模型
|
||||
/// </summary>
|
||||
public class NavigationItem : BindableBase
|
||||
{
|
||||
public NavigationItem(
|
||||
string icon,
|
||||
string name,
|
||||
string pageName,
|
||||
ObservableCollection<NavigationItem> items = null)
|
||||
{
|
||||
Icon = icon;
|
||||
Name = name;
|
||||
PageName = pageName;
|
||||
Items = items;
|
||||
}
|
||||
|
||||
private string name;
|
||||
private string icon;
|
||||
private ObservableCollection<NavigationItem> items;
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public string Icon
|
||||
{
|
||||
get { return icon; }
|
||||
set { icon = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单导航的页面
|
||||
/// </summary>
|
||||
public string PageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导航菜单列表
|
||||
/// 菜单子项
|
||||
/// </summary>
|
||||
public ObservableCollection<NavigationItem> Items
|
||||
{
|
||||
get { return items; }
|
||||
set { items = value; RaisePropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
53
CapMachine.Wpf/NLog.config
Normal file
53
CapMachine.Wpf/NLog.config
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="logDirectory" value="${basedir}/Log/${shortdate}"/>
|
||||
<variable name="ActionDirectory" value="${basedir}/OperationLogs/${shortdate}"/>
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
|
||||
<target xsi:type="File" name="CapMachine" fileName="${logDirectory}/ErrorMessage.txt" archiveAboveSize="10240000" maxArchiveFiles="200"
|
||||
layout="${longdate} ■${level}${newline} ▲${stacktrace}${newline} ◆${message}${newline}${newline}***************************************************************************" />
|
||||
|
||||
<target xsi:type="File" name="CapMachineOperation" fileName="${ActionDirectory}/OperationLog.txt" archiveAboveSize="10240000" maxArchiveFiles="500"
|
||||
layout="${longdate} ■${level}${newline} ◆${message}${newline}***************************************************************************" />
|
||||
|
||||
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Error" writeTo="CapMachine" />
|
||||
<logger name="*" minlevel="Info" maxlevel="Info" writeTo="CapMachineOperation" />
|
||||
</rules>
|
||||
</nlog>
|
||||
18
CapMachine.Wpf/PrismEvent/ChartRtEvent.cs
Normal file
18
CapMachine.Wpf/PrismEvent/ChartRtEvent.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using CapMachine.Wpf.Models;
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.PrismEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 曲线实时传输数据实时值
|
||||
/// </summary>
|
||||
public class ChartRtEvent:PubSubEvent<List<ChartRtValue>>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
63
CapMachine.Wpf/Services/NavigationMenuService.cs
Normal file
63
CapMachine.Wpf/Services/NavigationMenuService.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using CapMachine.Core.IService;
|
||||
using CapMachine.Wpf.Models;
|
||||
using Prism.Mvvm;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 导航服务
|
||||
/// </summary>
|
||||
public class NavigationMenuService : BindableBase, INavigationMenuService
|
||||
{
|
||||
public NavigationMenuService()
|
||||
{
|
||||
MenuItems = new ObservableCollection<NavigationItem>();
|
||||
}
|
||||
|
||||
private ObservableCollection<NavigationItem> menuItems;
|
||||
|
||||
public ObservableCollection<NavigationItem> MenuItems
|
||||
{
|
||||
get { return menuItems; }
|
||||
set { menuItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
MenuItems.Clear();
|
||||
MenuItems.Add(new NavigationItem("", "全部", "", new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("","模板匹配","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("ShapeCirclePlus","轮廓匹配",""),
|
||||
new NavigationItem("ShapeOutline","形状匹配",""),
|
||||
new NavigationItem("Clouds", "相似性匹配",""),
|
||||
new NavigationItem("ShapeOvalPlus","形变匹配",""),
|
||||
}),
|
||||
new NavigationItem("", "比较测量","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Circle","卡尺找圆",""),
|
||||
new NavigationItem("Palette","颜色检测",""),
|
||||
new NavigationItem("Ruler", "几何测量",""),
|
||||
}),
|
||||
new NavigationItem("","字符识别","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("FormatColorText", "字符识别",""),
|
||||
new NavigationItem("Barcode", "一维码识别",""),
|
||||
new NavigationItem("Qrcode", "二维码识别",""),
|
||||
}),
|
||||
new NavigationItem("","缺陷检测","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Crop", "差分模型",""),
|
||||
new NavigationItem("CropRotate", "形变模型",""),
|
||||
})
|
||||
}));
|
||||
MenuItems.Add(new NavigationItem("", "工艺过程", "MonitorView"));
|
||||
MenuItems.Add(new NavigationItem("", "工艺参数", "ProConfigView"));
|
||||
MenuItems.Add(new NavigationItem("", "工艺曲线", "RealTimeChartView"));
|
||||
MenuItems.Add(new NavigationItem("", "动作日志", "ActionLogView"));
|
||||
MenuItems.Add(new NavigationItem("", "用户管理", "UserView"));
|
||||
}
|
||||
}
|
||||
}
|
||||
74
CapMachine.Wpf/Services/PlcRtDataService.cs
Normal file
74
CapMachine.Wpf/Services/PlcRtDataService.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
public class PlcRtDataService:BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件聚合器
|
||||
/// </summary>
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ScanTask扫描Task
|
||||
/// </summary>
|
||||
static Task ScanTask { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 扫描线程使能
|
||||
/// </summary>
|
||||
public bool ThreadEnable { get; set; } = true;
|
||||
|
||||
public PlcRtDataService(IEventAggregator eventAggregator)
|
||||
{
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
|
||||
|
||||
PubRtDataStart();
|
||||
}
|
||||
|
||||
private Random random = new Random();
|
||||
|
||||
/// <summary>
|
||||
///发布实时数据
|
||||
/// </summary>
|
||||
private void PubRtDataStart()
|
||||
{
|
||||
ScanTask = Task.Run(async () =>
|
||||
{
|
||||
while (ThreadEnable)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
_EventAggregator.GetEvent<ChartRtEvent>().Publish(new List<Models.ChartRtValue>()
|
||||
{
|
||||
new Models.ChartRtValue(){Name="室温0",Value=random.NextDouble()*100,Unit="℃"},
|
||||
new Models.ChartRtValue(){Name="室温1",Value=random.NextDouble()*100,Unit="℃"},
|
||||
new Models.ChartRtValue(){Name="室温2",Value=random.NextDouble()*100,Unit="℃"},
|
||||
new Models.ChartRtValue(){Name="室温3",Value=random.NextDouble()*100,Unit="℃"},
|
||||
new Models.ChartRtValue(){Name="室温4",Value=random.NextDouble()*100,Unit="℃"},
|
||||
new Models.ChartRtValue(){Name="室温5",Value=random.NextDouble()*100,Unit="℃"},
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var dd = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
599
CapMachine.Wpf/ViewModels/DialogChartRtConfigViewModel.cs
Normal file
599
CapMachine.Wpf/ViewModels/DialogChartRtConfigViewModel.cs
Normal file
@@ -0,0 +1,599 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Wpf.Models;
|
||||
using ImTools;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class DialogChartRtConfigViewModel : DialogViewModel
|
||||
{
|
||||
public DialogChartRtConfigViewModel(IFreeSql freeSql, IMapper mapper)
|
||||
{
|
||||
this.Title = "曲线编辑";
|
||||
|
||||
//加载曲线数据源
|
||||
ChartSrcDataListViewItems = new ObservableCollection<ChartSrcData>();
|
||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||
{
|
||||
Index = 1,
|
||||
Name = "温度",
|
||||
Selected = true
|
||||
});
|
||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||
{
|
||||
Index = 2,
|
||||
Name = "压力",
|
||||
Selected = true
|
||||
});
|
||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||
{
|
||||
Index = 3,
|
||||
Name = "湿度",
|
||||
Selected = false
|
||||
});
|
||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||
{
|
||||
Index = 4,
|
||||
Name = "过冷度",
|
||||
Selected = false
|
||||
});
|
||||
|
||||
ChartYAxisDataListViewItems = new ObservableCollection<ChartYAxisDto>()
|
||||
{
|
||||
new ChartYAxisDto(){
|
||||
Name="温度",
|
||||
Max=100,
|
||||
Min=-50,
|
||||
Unit="℃",
|
||||
Index=3,
|
||||
},
|
||||
new ChartYAxisDto(){
|
||||
Name="湿度",
|
||||
Max=100,
|
||||
Min=0,
|
||||
Unit="%",
|
||||
Index=1,
|
||||
},
|
||||
new ChartYAxisDto(){
|
||||
Name="压力",
|
||||
Max=100,
|
||||
Min=-50,
|
||||
Unit="Mpa",
|
||||
Index=2,
|
||||
},
|
||||
};
|
||||
FreeSql = freeSql;
|
||||
this.Mapper = mapper;
|
||||
|
||||
RefreshChartSourceData();
|
||||
RefreshChartSelectedData();
|
||||
RefreshChartYAxisData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FreeSql
|
||||
/// </summary>
|
||||
public IFreeSql FreeSql { get; }
|
||||
/// <summary>
|
||||
/// AutoMap映射
|
||||
/// </summary>
|
||||
public IMapper Mapper { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载数据
|
||||
/// </summary>
|
||||
private void RefreshChartSourceData()
|
||||
{
|
||||
//var data = FreeSql.Select<ConfigChartSelect>().ToList();
|
||||
//Mapper.Map<List<ChartSelectDto>>(data);
|
||||
//ChartSelectDataListViewItems = new ObservableCollection<ChartSelectDto>(Mapper.Map<List<ChartSelectDto>>(data));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载选择数据
|
||||
/// </summary>
|
||||
private void RefreshChartSelectedData()
|
||||
{
|
||||
var ChartSelectedData = FreeSql.Select<ConfigChartSelect>().Include(a=>a.ConfigChartYAxis).ToList();
|
||||
ChartSelectDataListViewItems.Clear();
|
||||
foreach (var item in ChartSelectedData)
|
||||
{
|
||||
ChartSelectDataListViewItems.Add(Mapper.Map<ChartSelectDto>(item));
|
||||
}
|
||||
|
||||
//SelectedChartSelectData = null;
|
||||
|
||||
//Mapper.Map<List<ChartSelectDto>>(data);
|
||||
//ChartSelectDataListViewItems = new ObservableCollection<ChartSelectDto>(Mapper.Map<List<ChartSelectDto>>(data));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载Y轴数据信息
|
||||
/// </summary>
|
||||
private void RefreshChartYAxisData()
|
||||
{
|
||||
var ChartYAxisData = FreeSql.Select<ConfigChartYAxis>().ToList();
|
||||
ChartYAxisDataListViewItems.Clear();
|
||||
foreach (var item in ChartYAxisData)
|
||||
{
|
||||
ChartYAxisDataListViewItems.Add(Mapper.Map<ChartYAxisDto>(item));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 数据源
|
||||
|
||||
private DelegateCommand<object> _SelectionChartSourceCmd;
|
||||
/// <summary>
|
||||
/// 选中Chart数据源命令
|
||||
/// </summary>
|
||||
public DelegateCommand<object> SelectionChartSourceCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_SelectionChartSourceCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_SelectionChartSourceCmd == null)
|
||||
{
|
||||
_SelectionChartSourceCmd = new DelegateCommand<object>((str) => SelectionChartSourceCmdMethod(str));
|
||||
}
|
||||
return _SelectionChartSourceCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SelectionChartSourceCmdMethod(object par)
|
||||
{
|
||||
var data = par as ChartSrcData;
|
||||
//如果不是ProgramSeg则退出,因为刷新数据源的时候,会触发这个选择器
|
||||
if (data == null) return;
|
||||
|
||||
SelectedChartSrcData = data;
|
||||
|
||||
}
|
||||
|
||||
private ChartSrcData _SelectedChartSrcData;
|
||||
/// <summary>
|
||||
/// 当前选中Chart数据源
|
||||
/// </summary>
|
||||
public ChartSrcData SelectedChartSrcData
|
||||
{
|
||||
get { return _SelectedChartSrcData; }
|
||||
set { _SelectedChartSrcData = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<ChartSrcData> _ChartSrcDataListViewItems;
|
||||
/// <summary>
|
||||
/// 数据源控件 数据集合
|
||||
/// </summary>
|
||||
public ObservableCollection<ChartSrcData> ChartSrcDataListViewItems
|
||||
{
|
||||
get { return _ChartSrcDataListViewItems; }
|
||||
set { _ChartSrcDataListViewItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 加载最新的数据
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//private List<ProgramSeg> RefreshProSeg()
|
||||
//{
|
||||
|
||||
// ChartSrcDataListViewItems.Clear();
|
||||
// foreach (var item in ListProgramSeg)
|
||||
// {
|
||||
// ProSegListViewItems.Add(item);
|
||||
// }
|
||||
|
||||
// return ListProgramSeg;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据操作
|
||||
|
||||
|
||||
private DelegateCommand<string> _ChartSourceCmd;
|
||||
/// <summary>
|
||||
/// Chart数据 匹配操作命令
|
||||
/// </summary>
|
||||
public DelegateCommand<string> ChartSourceCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ChartSourceCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ChartSourceCmd == null)
|
||||
{
|
||||
_ChartSourceCmd = new DelegateCommand<string>((str) => ChartSourceCmdMethod(str));
|
||||
}
|
||||
return _ChartSourceCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ChartSourceCmdMethod(string par)
|
||||
{
|
||||
if (par == "Selected")//选中的操作
|
||||
{
|
||||
if (SelectedChartSrcData == null)
|
||||
{
|
||||
MessageBox.Show("请选择后再操作");
|
||||
return;
|
||||
}
|
||||
if (ChartSelectDataListViewItems.Where(a => a.Name == SelectedChartSrcData.Name).Count() > 0)
|
||||
{
|
||||
MessageBox.Show("已经选择这条曲线");
|
||||
return;
|
||||
}
|
||||
|
||||
//数据库增加
|
||||
FreeSql.Insert<ConfigChartSelect>(new ConfigChartSelect()
|
||||
{
|
||||
Name = SelectedChartSrcData.Name,
|
||||
Category = "Default",
|
||||
Index = 1,
|
||||
ConfigChartYAxis = new ConfigChartYAxis() { Name = "无单位", Unit = "无" },
|
||||
}).ExecuteAffrows();
|
||||
|
||||
//刷新图表
|
||||
RefreshChartSelectedData();
|
||||
|
||||
//更改数据源状态
|
||||
ChartSrcDataListViewItems.FindFirst(a => a.Name == SelectedChartSrcData.Name).Selected = true;
|
||||
|
||||
}
|
||||
else//删除的操作
|
||||
{
|
||||
if (SelectedChartSelectData != null)
|
||||
{
|
||||
//数据库删除
|
||||
FreeSql.Delete<ConfigChartSelect>()
|
||||
.Where(a => a.Name == SelectedChartSelectData.Name)
|
||||
.ExecuteAffrows();
|
||||
|
||||
//刷新图表
|
||||
RefreshChartSelectedData();
|
||||
|
||||
//ChartSelectDataListViewItems.Remove(SelectedChartSelectData);
|
||||
|
||||
//更改状态
|
||||
ChartSrcDataListViewItems.FindFirst(a => a.Name == SelectedChartSelectData.Name).Selected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请选择后再操作");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取默认的Y轴设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private ChartYAxisDto GetDefaultYAxis()
|
||||
{
|
||||
return new ChartYAxisDto() { Name = "温度", Unit = "℃" };
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand<string> _ChartYAxisSelectCmd;
|
||||
/// <summary>
|
||||
/// Chart 标尺数据的操作命令
|
||||
/// </summary>
|
||||
public DelegateCommand<string> ChartYAxisSelectCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ChartYAxisSelectCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ChartYAxisSelectCmd == null)
|
||||
{
|
||||
_ChartYAxisSelectCmd = new DelegateCommand<string>((str) => ChartYAxisSelectCmdMethod(str));
|
||||
}
|
||||
return _ChartYAxisSelectCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ChartYAxisSelectCmdMethod(string par)
|
||||
{
|
||||
if (par == "Selected")//选中的操作
|
||||
{
|
||||
if (SelectedChartYAxisData == null)
|
||||
{
|
||||
MessageBox.Show("请选择后再操作");
|
||||
return;
|
||||
}
|
||||
if (SelectedChartSelectData == null)
|
||||
{
|
||||
MessageBox.Show("请选择中间的【已选择曲线】后再操作");
|
||||
return;
|
||||
}
|
||||
|
||||
//数据库保存
|
||||
FreeSql.Update<ConfigChartSelect>()
|
||||
.Where(a => a.Id == SelectedChartSelectData.Id)
|
||||
.Set(a=>a.ConfigChartYAxisId, SelectedChartYAxisData.Id)
|
||||
.ExecuteAffrows();
|
||||
|
||||
//刷新图表
|
||||
RefreshChartSelectedData();
|
||||
|
||||
//SelectedChartSelectData.YAxis = SelectedChartYAxisData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据选中操作
|
||||
|
||||
private DelegateCommand<object> _SelectedChartConfigCmd;
|
||||
/// <summary>
|
||||
/// 选中Chart数据源命令
|
||||
/// </summary>
|
||||
public DelegateCommand<object> SelectedChartConfigCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_SelectedChartConfigCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_SelectedChartConfigCmd == null)
|
||||
{
|
||||
_SelectedChartConfigCmd = new DelegateCommand<object>((str) => SelectedChartConfigCmdMethod(str));
|
||||
}
|
||||
return _SelectedChartConfigCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SelectedChartConfigCmdMethod(object par)
|
||||
{
|
||||
var data = par as ChartSelectDto;
|
||||
//如果不是ProgramSeg则退出,因为刷新数据源的时候,会触发这个选择器
|
||||
if (data == null) return;
|
||||
|
||||
SelectedChartSelectData = data;
|
||||
|
||||
}
|
||||
|
||||
private ChartSelectDto _SelectedChartSelectData;
|
||||
/// <summary>
|
||||
/// 当前选中Chart数据源
|
||||
/// </summary>
|
||||
public ChartSelectDto SelectedChartSelectData
|
||||
{
|
||||
get { return _SelectedChartSelectData; }
|
||||
set { _SelectedChartSelectData = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<ChartSelectDto> _ChartSelectDataListViewItems = new ObservableCollection<ChartSelectDto>();
|
||||
/// <summary>
|
||||
/// 数据源控件 数据集合
|
||||
/// </summary>
|
||||
public ObservableCollection<ChartSelectDto> ChartSelectDataListViewItems
|
||||
{
|
||||
get { return _ChartSelectDataListViewItems; }
|
||||
set { _ChartSelectDataListViewItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 加载最新的数据
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//private List<ProgramSeg> RefreshProSeg()
|
||||
//{
|
||||
|
||||
// ChartSrcDataListViewItems.Clear();
|
||||
// foreach (var item in ListProgramSeg)
|
||||
// {
|
||||
// ProSegListViewItems.Add(item);
|
||||
// }
|
||||
|
||||
// return ListProgramSeg;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Y轴设置
|
||||
|
||||
private DelegateCommand<object> _ChartYAxisDataConfigCmd;
|
||||
/// <summary>
|
||||
/// 选中Chart数据源命令
|
||||
/// </summary>
|
||||
public DelegateCommand<object> ChartYAxisDataConfigCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ChartYAxisDataConfigCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ChartYAxisDataConfigCmd == null)
|
||||
{
|
||||
_ChartYAxisDataConfigCmd = new DelegateCommand<object>((str) => ChartYAxisDataConfigCmdMethod(str));
|
||||
}
|
||||
return _ChartYAxisDataConfigCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ChartYAxisDataConfigCmdMethod(object par)
|
||||
{
|
||||
var data = par as ChartYAxisDto;
|
||||
//如果不是ProgramSeg则退出,因为刷新数据源的时候,会触发这个选择器
|
||||
if (data == null) return;
|
||||
|
||||
SelectedChartYAxisData = data;
|
||||
|
||||
}
|
||||
|
||||
private ChartYAxisDto _SelectedChartYAxisData;
|
||||
/// <summary>
|
||||
/// 当前选中Chart数据源
|
||||
/// </summary>
|
||||
public ChartYAxisDto SelectedChartYAxisData
|
||||
{
|
||||
get { return _SelectedChartYAxisData; }
|
||||
set { _SelectedChartYAxisData = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<ChartYAxisDto> _ChartYAxisDataListViewItems = new ObservableCollection<ChartYAxisDto>();
|
||||
/// <summary>
|
||||
/// 数据源控件 数据集合
|
||||
/// </summary>
|
||||
public ObservableCollection<ChartYAxisDto> ChartYAxisDataListViewItems
|
||||
{
|
||||
get { return _ChartYAxisDataListViewItems; }
|
||||
set { _ChartYAxisDataListViewItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 加载最新的数据
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//private List<ProgramSeg> RefreshProSeg()
|
||||
//{
|
||||
|
||||
// ChartSrcDataListViewItems.Clear();
|
||||
// foreach (var item in ListProgramSeg)
|
||||
// {
|
||||
// ProSegListViewItems.Add(item);
|
||||
// }
|
||||
|
||||
// return ListProgramSeg;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "Name", Name }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
var info = parameters.GetValue<string>("par");
|
||||
}
|
||||
}
|
||||
}
|
||||
109
CapMachine.Wpf/ViewModels/DialogCreateProViewModel.cs
Normal file
109
CapMachine.Wpf/ViewModels/DialogCreateProViewModel.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using CapMachine.Core;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建弹窗的服务数据
|
||||
/// </summary>
|
||||
public class DialogCreateProViewModel : DialogViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public DialogCreateProViewModel()
|
||||
{
|
||||
this.Title = "新增工况";
|
||||
}
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Name))
|
||||
{
|
||||
MessageBox.Show("请输入正确的名称!");
|
||||
return;
|
||||
}
|
||||
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "Name", Name }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
var info = parameters.GetValue<string>("par");
|
||||
}
|
||||
}
|
||||
}
|
||||
103
CapMachine.Wpf/ViewModels/DialogEditProViewModel.cs
Normal file
103
CapMachine.Wpf/ViewModels/DialogEditProViewModel.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using CapMachine.Core;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class DialogEditProViewModel : DialogViewModel
|
||||
{
|
||||
public DialogEditProViewModel()
|
||||
{
|
||||
this.Title = "修改";
|
||||
}
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Name))
|
||||
{
|
||||
MessageBox.Show("请输入正确的名称!");
|
||||
return;
|
||||
}
|
||||
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "Name", Name }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
Name = parameters.GetValue<string>("Name");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
92
CapMachine.Wpf/ViewModels/MainViewModel.cs
Normal file
92
CapMachine.Wpf/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Core.IService;
|
||||
using CapMachine.Wpf.Models;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class MainViewModel : NavigationViewModel
|
||||
{
|
||||
public MainViewModel(IRegionManager region, INavigationMenuService menuService)
|
||||
{
|
||||
this.region = region;
|
||||
MenuService = menuService;
|
||||
NavigateCommand = new DelegateCommand<NavigationItem>(Navigate);
|
||||
}
|
||||
|
||||
public INavigationMenuService MenuService { get; }
|
||||
|
||||
public DelegateCommand<NavigationItem> NavigateCommand { get; private set; }
|
||||
|
||||
private int selectedIndex = -1;
|
||||
|
||||
public int SelectedIndex
|
||||
{
|
||||
get { return selectedIndex; }
|
||||
set { selectedIndex = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool isTopDrawerOpen;
|
||||
private readonly IRegionManager region;
|
||||
|
||||
public bool IsTopDrawerOpen
|
||||
{
|
||||
get { return isTopDrawerOpen; }
|
||||
set
|
||||
{
|
||||
isTopDrawerOpen = value;
|
||||
if (SelectedIndex == 0 && !value)
|
||||
SelectedIndex = -1;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void Navigate(NavigationItem item)
|
||||
{
|
||||
if (item == null) return;
|
||||
|
||||
if (item.Name.Equals("全部"))
|
||||
{
|
||||
IsTopDrawerOpen = true;
|
||||
return;
|
||||
}
|
||||
|
||||
NavigatePage(item.PageName);
|
||||
|
||||
|
||||
|
||||
IsTopDrawerOpen = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导航到页面信息
|
||||
/// </summary>
|
||||
/// <param name="pageName"></param>
|
||||
private void NavigatePage(string pageName)
|
||||
{
|
||||
region.Regions["MainViewContentRegion"].RequestNavigate(pageName, back =>
|
||||
{
|
||||
if (!(bool)back.Result)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(back.Error.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
MenuService.Initialize();
|
||||
//region.Regions["MainViewContentRegion"].RequestNavigate("DashboardView", back =>
|
||||
//{
|
||||
// if (!(bool)back.Result)
|
||||
// {
|
||||
|
||||
// }
|
||||
//});
|
||||
base.OnNavigatedTo(navigationContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
CapMachine.Wpf/ViewModels/MonitorViewModel.cs
Normal file
14
CapMachine.Wpf/ViewModels/MonitorViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using CapMachine.Core;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class MonitorViewModel : NavigationViewModel
|
||||
{
|
||||
public MonitorViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
1130
CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
Normal file
1130
CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
Normal file
File diff suppressed because it is too large
Load Diff
132
CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
Normal file
132
CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using CapMachine.Core;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using SharpDX.Direct3D9;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class RealTimeChartViewModel : NavigationViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public RealTimeChartViewModel(IDialogService dialogService, IFreeSql freeSql)
|
||||
{
|
||||
DialogService = dialogService;
|
||||
FreeSql = freeSql;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗服务
|
||||
/// </summary>
|
||||
public IDialogService DialogService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// FreeSQL 实例
|
||||
/// </summary>
|
||||
public IFreeSql FreeSql { get; }
|
||||
|
||||
private DelegateCommand _ChartConfigCmd;
|
||||
/// <summary>
|
||||
/// 编辑曲线数据
|
||||
/// </summary>
|
||||
public DelegateCommand ChartConfigCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ChartConfigCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ChartConfigCmd == null)
|
||||
{
|
||||
_ChartConfigCmd = new DelegateCommand(() => ChartConfigCmdMethod());
|
||||
}
|
||||
return _ChartConfigCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑曲线数据执行方法
|
||||
/// </summary>
|
||||
private void ChartConfigCmdMethod()
|
||||
{
|
||||
//弹窗
|
||||
DialogService.ShowDialog("DialogChartRtConfigView", new DialogParameters() { { "Name", "" } }, (par) =>
|
||||
{
|
||||
if (par.Result == ButtonResult.OK)
|
||||
{
|
||||
//程序名称
|
||||
var ReturnValue = par.Parameters.GetValue<string>("Name");
|
||||
|
||||
|
||||
}
|
||||
else if (par.Result == ButtonResult.Cancel)
|
||||
{
|
||||
//取消
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//#region 曲线配置
|
||||
|
||||
//private LightningChart _LightningChartInstance;
|
||||
///// <summary>
|
||||
///// LightningChart 实例
|
||||
///// </summary>
|
||||
//public LightningChart LightningChartInstance
|
||||
//{
|
||||
// get { return _LightningChartInstance; }
|
||||
// set { _LightningChartInstance = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 获取实例
|
||||
///// </summary>
|
||||
///// <param name="chart"></param>
|
||||
//public void SetChart(LightningChart chart)
|
||||
//{
|
||||
// LightningChartInstance = chart;
|
||||
//}
|
||||
|
||||
|
||||
//private AxisYCollection _YAxes=new AxisYCollection();
|
||||
///// <summary>
|
||||
///// Y轴配置
|
||||
///// </summary>
|
||||
//public AxisYCollection YAxes
|
||||
//{
|
||||
// get { return _YAxes; }
|
||||
// set { _YAxes = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//private AxisXCollection _XAxes = new AxisXCollection();
|
||||
///// <summary>
|
||||
///// X轴配置
|
||||
///// </summary>
|
||||
//public AxisXCollection XAxes
|
||||
//{
|
||||
// get { return _XAxes; }
|
||||
// set { _XAxes = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//private SampleDataSeriesCollection _ChartDataSeries;
|
||||
///// <summary>
|
||||
///// 曲线集合数据
|
||||
///// </summary>
|
||||
//public SampleDataSeriesCollection ChartDataSeries
|
||||
//{
|
||||
// get { return _ChartDataSeries; }
|
||||
// set { _ChartDataSeries = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
|
||||
//#endregion
|
||||
}
|
||||
}
|
||||
314
CapMachine.Wpf/Views/DialogChartRtConfigView.xaml
Normal file
314
CapMachine.Wpf/Views/DialogChartRtConfigView.xaml
Normal file
@@ -0,0 +1,314 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.DialogChartRtConfigView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Width="1500"
|
||||
Height="900"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
</Style>
|
||||
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
</Style>
|
||||
<Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="0.25*" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="0.25*" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- 最左侧 曲线数据源头 -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card Margin="3" materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock
|
||||
Margin="10,3"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
Foreground="Blue"
|
||||
Text="曲线数据源" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="26"
|
||||
Foreground="Gray"
|
||||
Text="{Binding SelectedChartSrcData.Name}" />
|
||||
</StackPanel>
|
||||
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Margin="3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<Border BorderBrush="Black" BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="LvChartSource"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ChartSrcDataListViewItems}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding SelectionChartSourceCmd}" CommandParameter="{Binding ElementName=LvChartSource, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
DisplayMemberBinding="{Binding Index}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="220"
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
Header="名称">
|
||||
<!--<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" TextAlignment="Center" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>-->
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100" Header="状态">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Selected}" IsEnabled="False" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</materialDesign:Card>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- 曲线选择操作 -->
|
||||
<materialDesign:Card
|
||||
Grid.Column="1"
|
||||
Margin="5,3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Vertical">
|
||||
<StackPanel.Resources>
|
||||
<Style x:Key="btnStyle" TargetType="Button" />
|
||||
</StackPanel.Resources>
|
||||
<Button
|
||||
Margin="5"
|
||||
Command="{Binding ChartSourceCmd}"
|
||||
CommandParameter="Selected"
|
||||
Content="选中>>"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Margin="5"
|
||||
Command="{Binding ChartSourceCmd}"
|
||||
CommandParameter="Delete"
|
||||
Content=">> 删除"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- 中间 已经选择曲线 -->
|
||||
<Grid Grid.Row="0" Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card
|
||||
Margin="3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2"
|
||||
Background="SkyBlue">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock
|
||||
Margin="10,3"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
Foreground="Green"
|
||||
Text="已选曲线" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="26"
|
||||
Foreground="Gray"
|
||||
Text="{Binding SelectedChartSelectData.Name}" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Margin="3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<Border BorderBrush="Black" BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="LvChartConfig"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ChartSelectDataListViewItems}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding SelectedChartConfigCmd}" CommandParameter="{Binding ElementName=LvChartConfig, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
DisplayMemberBinding="{Binding Index}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="220"
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
Header="名称" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding YAxis.Unit}"
|
||||
Header="Y标尺" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</materialDesign:Card>
|
||||
</Grid>
|
||||
<!-- Y标尺选择操作 -->
|
||||
<materialDesign:Card
|
||||
Grid.Column="3"
|
||||
Margin="5,3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Vertical">
|
||||
<StackPanel.Resources>
|
||||
<Style x:Key="btnStyle" TargetType="Button" />
|
||||
</StackPanel.Resources>
|
||||
<Button
|
||||
Margin="5"
|
||||
Command="{Binding ChartYAxisSelectCmd}"
|
||||
CommandParameter="Selected"
|
||||
Content=">>选中"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- Y标尺 -->
|
||||
<Grid Grid.Row="0" Grid.Column="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card Margin="3" materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock
|
||||
Margin="10,3"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
Foreground="Blue"
|
||||
Text="Y轴标尺" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="26"
|
||||
Foreground="Gray"
|
||||
Text="{Binding SelectedChartYAxisData.Name}" />
|
||||
</StackPanel>
|
||||
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Margin="3"
|
||||
materialDesign:ElevationAssist.Elevation="Dp2">
|
||||
<Border BorderBrush="Black" BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="LvChartYAxis"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ChartYAxisDataListViewItems}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding ChartYAxisDataConfigCmd}" CommandParameter="{Binding ElementName=LvChartYAxis, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
DisplayMemberBinding="{Binding Index}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
Header="标尺名称" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding Min}"
|
||||
Header="最小值" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding Max}"
|
||||
Header="最大值" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding Unit}"
|
||||
Header="单位" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</materialDesign:Card>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="4"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Height="40"
|
||||
Margin="80,0"
|
||||
Command="{Binding SaveCmd}"
|
||||
Content="关 闭"
|
||||
FontSize="26"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
CapMachine.Wpf/Views/DialogChartRtConfigView.xaml.cs
Normal file
28
CapMachine.Wpf/Views/DialogChartRtConfigView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogChartRtConfigView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DialogChartRtConfigView : UserControl
|
||||
{
|
||||
public DialogChartRtConfigView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
49
CapMachine.Wpf/Views/DialogCreateProView.xaml
Normal file
49
CapMachine.Wpf/Views/DialogCreateProView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.DialogCreateProView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Margin="70"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
Text="程序名称:"
|
||||
TextAlignment="Center" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
FontSize="24"
|
||||
Text="{Binding Name}" />
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="10,10"
|
||||
Command="{Binding SaveCmd}"
|
||||
Content="确定" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Command="{Binding CancelCmd}"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
15
CapMachine.Wpf/Views/DialogCreateProView.xaml.cs
Normal file
15
CapMachine.Wpf/Views/DialogCreateProView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogCreateProView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DialogCreateProView : UserControl
|
||||
{
|
||||
public DialogCreateProView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
49
CapMachine.Wpf/Views/DialogEditProView.xaml
Normal file
49
CapMachine.Wpf/Views/DialogEditProView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.DialogEditProView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Margin="70"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
Text="程序名称:"
|
||||
TextAlignment="Center" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
FontSize="24"
|
||||
Text="{Binding Name}" />
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="10,10"
|
||||
Command="{Binding SaveCmd}"
|
||||
Content="确定" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Command="{Binding CancelCmd}"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
15
CapMachine.Wpf/Views/DialogEditProView.xaml.cs
Normal file
15
CapMachine.Wpf/Views/DialogEditProView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogEditProView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DialogEditProView : UserControl
|
||||
{
|
||||
public DialogEditProView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
164
CapMachine.Wpf/Views/MainView.xaml
Normal file
164
CapMachine.Wpf/Views/MainView.xaml
Normal file
@@ -0,0 +1,164 @@
|
||||
<Window
|
||||
x:Class="CapMachine.Wpf.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Title="压缩机耐久测试平台"
|
||||
Width="1920"
|
||||
Height="1080"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<md:ColorZone md:ElevationAssist.Elevation="Dp2" Mode="PrimaryDark">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Margin="15" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,0,15,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="22"
|
||||
FontWeight="Bold"
|
||||
Text="压缩机耐久测试软件平台" />
|
||||
</StackPanel>
|
||||
|
||||
<ListBox
|
||||
x:Name="listBox"
|
||||
Grid.Column="1"
|
||||
ItemsSource="{Binding MenuService.MenuItems}"
|
||||
SelectedIndex="{Binding SelectedIndex}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Grid>
|
||||
<Border x:Name="border" />
|
||||
<Border x:Name="borderheader" Background="{TemplateBinding Background}" />
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
TextBlock.Foreground="{TemplateBinding Foreground}" />
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter TargetName="borderheader" Property="Background" Value="#ffffff" />
|
||||
<Setter TargetName="borderheader" Property="Opacity" Value="0.1" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#ffffff" />
|
||||
<Setter TargetName="border" Property="BorderThickness" Value="0,0,0,3" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="borderheader" Property="Background" Value="#ffffff" />
|
||||
<Setter TargetName="borderheader" Property="Opacity" Value="0.1" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#ffffff" />
|
||||
<Setter TargetName="border" Property="BorderThickness" Value="0,0,0,3" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
Margin="20,5"
|
||||
FontSize="16"
|
||||
Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding NavigateCommand}" CommandParameter="{Binding ElementName=listBox, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</md:ColorZone>
|
||||
|
||||
<md:DialogHost Grid.Row="1">
|
||||
<!-- Content="{Binding ElementName=MainViewContentControl, Path=Content, Mode=TwoWay}" IsTopDrawerOpen="{Binding IsTopDrawerOpen}" -->
|
||||
<md:DrawerHost Content="{Binding ElementName=MainViewContentControl, Path=Content, Mode=TwoWay}" IsTopDrawerOpen="{Binding IsTopDrawerOpen}">
|
||||
<md:DrawerHost.TopDrawerContent>
|
||||
<ItemsControl Padding="0,5,0,20" ItemsSource="{Binding MenuService.MenuItems[0].Items}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Margin="15,10" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
|
||||
<ItemsControl
|
||||
Grid.Row="1"
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Top"
|
||||
ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid VerticalAlignment="Center" Columns="2" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Height="40" Margin="5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="10,5" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</md:DrawerHost.TopDrawerContent>
|
||||
</md:DrawerHost>
|
||||
</md:DialogHost>
|
||||
|
||||
<ContentControl
|
||||
x:Name="MainViewContentControl"
|
||||
prism:RegionManager.RegionName="MainViewContentRegion"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Window>
|
||||
15
CapMachine.Wpf/Views/MainView.xaml.cs
Normal file
15
CapMachine.Wpf/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainView : Window
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
43
CapMachine.Wpf/Views/MonitorView.xaml
Normal file
43
CapMachine.Wpf/Views/MonitorView.xaml
Normal file
@@ -0,0 +1,43 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.MonitorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="1000"
|
||||
d:DesignWidth="1920"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="220" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="140" />
|
||||
<RowDefinition Height="120" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock
|
||||
FontSize="30"
|
||||
Text="调节器操作栏Hey TyroneChong! A third-party OAuth application (BotSharp) with user:email scopes was recently authorized to access your account. Visit https://github.com/settings/connections/applications/a1009924bfc48dbb7360 for more information. To see this and other security events for your account, visit https://github.com/settings/security-log If you run into problems, please contact support by visiting https://github.com/contact Thanks, The GitHub Team"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1">
|
||||
<TextBlock FontSize="30" Text="控制启动区域" />
|
||||
|
||||
</StackPanel>
|
||||
<Canvas Grid.Row="2">
|
||||
<TextBlock FontSize="30" Text="系统流程图" />
|
||||
</Canvas>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.Column="1">
|
||||
<TextBlock FontSize="30" Text="数据监视" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
15
CapMachine.Wpf/Views/MonitorView.xaml.cs
Normal file
15
CapMachine.Wpf/Views/MonitorView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MonitorView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MonitorView : UserControl
|
||||
{
|
||||
public MonitorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
551
CapMachine.Wpf/Views/ProConfigView.xaml
Normal file
551
CapMachine.Wpf/Views/ProConfigView.xaml
Normal file
@@ -0,0 +1,551 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.ProConfigView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:CapMachine.Shared.Controls;assembly=CapMachine.Shared"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
d:DesignHeight="1000"
|
||||
d:DesignWidth="1920"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
</Style>
|
||||
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="220" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="400" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="8*" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="2"
|
||||
BorderBrush="CadetBlue"
|
||||
BorderThickness="1">
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="工况程序库"
|
||||
TextAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="2"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<StackPanel>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Width="60"
|
||||
Margin="5"
|
||||
Command="{Binding ProAddCmd}"
|
||||
Content="增加"
|
||||
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="增加" />
|
||||
<Button
|
||||
Width="60"
|
||||
Margin="5"
|
||||
Command="{Binding ProEditCmd}"
|
||||
Content="修改"
|
||||
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="修改" />
|
||||
<Button
|
||||
Width="60"
|
||||
Margin="5"
|
||||
Command="{Binding ProDeleteCmd}"
|
||||
Content="删除"
|
||||
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="删除" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Background="LightBlue"
|
||||
FontSize="20"
|
||||
Text="{Binding SelectedProgramSeg.Name}"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
<Grid Grid.Row="2" Margin="2">
|
||||
<Border BorderBrush="Black" BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewPro"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ProSegListViewItems}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding ProSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewPro, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}">
|
||||
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="程序名称" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
FontSize="26"
|
||||
Text="内容区域"
|
||||
TextAlignment="Center" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="15,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="当前工况名称:" />
|
||||
<TextBox
|
||||
Width="150"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Background="DodgerBlue"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="{Binding SelectedProgramSeg.Name}"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock
|
||||
Margin="15,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="总循环次数:" />
|
||||
<TextBox
|
||||
Width="80"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Background="DodgerBlue"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="{Binding SelectedProgramSeg.ProRepeat}"
|
||||
TextAlignment="Center" />
|
||||
|
||||
<TextBlock
|
||||
Margin="15,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="当前选中步骤序号:" />
|
||||
<TextBox
|
||||
Width="80"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Background="DodgerBlue"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="{Binding SelectedProStepDto.StepNo}"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
x:Name="MainDatagrid"
|
||||
Grid.Row="2"
|
||||
AutoGenerateColumns="False"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ListProStepDtoItems}"
|
||||
SelectionMode="Extended">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding StepNo}" Header="序号" />
|
||||
<DataGridTextColumn Binding="{Binding StepRepeat}" Header="循环次数" />
|
||||
<DataGridTemplateColumn Width="200" Header="压缩机转速
信息">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding SpeedInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding PID}" Header="PID
信息" />
|
||||
<DataGridTextColumn Binding="{Binding PIDOutLimit}" Header="PID输出限幅信息" />
|
||||
<DataGridTextColumn Binding="{Binding Ps}" Header="Ps信息" />
|
||||
<DataGridTextColumn Binding="{Binding PdInfo}" Header="Pd信息" />
|
||||
</DataGrid.Columns>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding GridSelectionChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<!--<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="Background" Value="AliceBlue" />
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||
<Setter Property="Background" Value="#FFF2F2F2" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>-->
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="2"
|
||||
Margin="2">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border
|
||||
Margin="2"
|
||||
BorderBrush="CadetBlue"
|
||||
BorderThickness="1">
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="工况输入"
|
||||
TextAlignment="Center" />
|
||||
</Border>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="2"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<StackPanel>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Width="60"
|
||||
Margin="5"
|
||||
Command="{Binding ProStepAddCmd}"
|
||||
Content="增加"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="增加" />
|
||||
<Button
|
||||
Width="60"
|
||||
Command="{Binding ProStepEditCmd}"
|
||||
Content="修改"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="修改" />
|
||||
<Button
|
||||
Width="60"
|
||||
Margin="5"
|
||||
Command="{Binding ProStepDeleteCmd}"
|
||||
Content="删除"
|
||||
Style="{StaticResource MaterialDesignOutlinedDarkButton}"
|
||||
ToolTip="删除" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="2"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Text="单步循环次数"
|
||||
TextAlignment="Center" />
|
||||
|
||||
<TextBox
|
||||
Width="60"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Background="DeepSkyBlue"
|
||||
BorderThickness="2"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="{Binding ProStepCycleCount}"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Text="次" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
Grid.Row="3"
|
||||
Margin="2"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- 速度参数设置 -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.ColumnSpan="3" Margin="1">
|
||||
<Border
|
||||
Padding="3"
|
||||
Background="LightSteelBlue"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
Foreground="Blue"
|
||||
Text="速度设置" />
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="起始速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding SelectedMeterSpeed.StartValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="结束速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding SelectedMeterSpeed.EndValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="维持时间"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding SelectedMeterSpeed.KeepTime}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Command="{Binding ProStepSpeedAddCmd}"
|
||||
Content="增加"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="增加程序步骤内的速度设置" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Command="{Binding ProStepSpeedEditCmd}"
|
||||
Content="修改"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="修改程序步骤内的速度设置,请先选中" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Command="{Binding ProStepSpeedDeleteCmd}"
|
||||
Content="删除"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="删除程序步骤内的速度设置,请先选中" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="3"
|
||||
Margin="3,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewProStepSpeed"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ListMeterSpeedItems}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding MeterSpeedSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewProStepSpeed, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding StepNo}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding StartValue}"
|
||||
Header="起始速度" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding EndValue}"
|
||||
Header="终止速度" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding KeepTime}"
|
||||
Header="持续时间" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<DockPanel Grid.Row="1">
|
||||
<DockPanel>
|
||||
<TextBlock
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="Blue"
|
||||
Text="其他仪表配置"
|
||||
TextAlignment="Center" />
|
||||
</DockPanel>
|
||||
<StackPanel
|
||||
HorizontalAlignment="Right"
|
||||
DockPanel.Dock="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Width="40"
|
||||
Height="40"
|
||||
Click="ProStepOtherTapLeft"
|
||||
Style="{StaticResource MaterialDesignIconButton}"
|
||||
ToolTip="向左">
|
||||
<materialDesign:PackIcon Kind="ArrowLeftBox" />
|
||||
</Button>
|
||||
<Button
|
||||
Width="40"
|
||||
Height="40"
|
||||
Click="ProStepOtherTapRight"
|
||||
Command="{Binding ProStepOtherTapRightCmd}"
|
||||
Style="{StaticResource MaterialDesignIconButton}"
|
||||
ToolTip="向右">
|
||||
<materialDesign:PackIcon Kind="ArrowRightBox" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
<!-- 其他的参数设置 Grid.Row="1" Margin="3" SelectedIndex="{Binding TabSelectedIndex, RelativeSource={RelativeSource AncestorType={x:Type local:ProConfigView}}}" -->
|
||||
<materialDesign:Card Grid.Row="2" Margin="3">
|
||||
<TabControl x:Name="OtherTabControl" HorizontalContentAlignment="Left">
|
||||
<TabItem Header="Ps配置">
|
||||
<Controls:MeterConfig
|
||||
AddCommand="{Binding ProStepPsAddCmd}"
|
||||
DeleteCommand="{Binding ProStepPsDeleteCmd}"
|
||||
EditCommand="{Binding ProStepPsEditCmd}"
|
||||
ListMeter="{Binding ListMeterPsItems}"
|
||||
MeterName="Ps"
|
||||
MeterSelectedChangedCmd="{Binding MeterPsSelectedChangedCmd}"
|
||||
SelectedMeter="{Binding SelectedPs}" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd2配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 2" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd3配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 3" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd4配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd5配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd6配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd7配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd8配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd9配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd10配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd11配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
<TabItem Header="Pd12配置">
|
||||
<TextBlock Margin="8" Text="Not filled, required width, tab 4" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</materialDesign:Card>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
42
CapMachine.Wpf/Views/ProConfigView.xaml.cs
Normal file
42
CapMachine.Wpf/Views/ProConfigView.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ProConfigView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ProConfigView : UserControl
|
||||
{
|
||||
public ProConfigView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public int TabSelectedIndex { get; set; }
|
||||
private void ProStepOtherTapLeft(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (TabSelectedIndex > 0)
|
||||
{
|
||||
TabSelectedIndex--;
|
||||
OtherTabControl.SelectedIndex = TabSelectedIndex;
|
||||
// 将选定的 TabItem 滚动到可视范围内
|
||||
TabItem selectedItem = OtherTabControl.SelectedItem as TabItem;
|
||||
selectedItem?.BringIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
private void ProStepOtherTapRight(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (TabSelectedIndex < 12)
|
||||
{
|
||||
TabSelectedIndex++;
|
||||
OtherTabControl.SelectedIndex = TabSelectedIndex;
|
||||
// 将选定的 TabItem 滚动到可视范围内
|
||||
TabItem selectedItem = OtherTabControl.SelectedItem as TabItem;
|
||||
selectedItem?.BringIntoView();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
99
CapMachine.Wpf/Views/RealTimeChartView.xaml
Normal file
99
CapMachine.Wpf/Views/RealTimeChartView.xaml
Normal file
@@ -0,0 +1,99 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.RealTimeChartView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:LightChat="http://schemas.arction.com/charting/ultimate/"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Width="1920"
|
||||
Height="1000"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
</Style>
|
||||
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="240" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Button Background="Red" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding ChartConfigCmd}"
|
||||
Content="编辑曲线"
|
||||
Foreground="White" />
|
||||
</Grid>
|
||||
|
||||
<LightChat:LightningChart x:Name="lightningChart1" Grid.Row="1" />
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="3,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView x:Name="LvChartRtValue" Foreground="Black">
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="120"
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
Header="名称" />
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding Value}"
|
||||
Header="实时值" />
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
DisplayMemberBinding="{Binding Unit}"
|
||||
Header="单位" />
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
526
CapMachine.Wpf/Views/RealTimeChartView.xaml.cs
Normal file
526
CapMachine.Wpf/Views/RealTimeChartView.xaml.cs
Normal file
@@ -0,0 +1,526 @@
|
||||
using Arction.Wpf.Charting;
|
||||
using Arction.Wpf.Charting.Annotations;
|
||||
using Arction.Wpf.Charting.Axes;
|
||||
using Arction.Wpf.Charting.SeriesXY;
|
||||
using Arction.Wpf.Charting.Views.ViewXY;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using CapMachine.Wpf.ViewModels;
|
||||
using NLog;
|
||||
using Prism.Events;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// RealTimeChartView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class RealTimeChartView : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 定时器
|
||||
/// </summary>
|
||||
static System.Timers.Timer CurTimer { get; set; }
|
||||
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 曲线配置
|
||||
/// </summary>
|
||||
public ChartConfig ChartConfigInfo { get; set; }
|
||||
|
||||
|
||||
public RealTimeChartView(IEventAggregator eventAggregator)
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
LoadLighingChart();
|
||||
|
||||
LvChartRtValue.ItemsSource = ListChartRtSeries;
|
||||
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
_EventAggregator.GetEvent<ChartRtEvent>().Subscribe(GetChartRtEvent);
|
||||
|
||||
var CreateAxisY = new AxisY();
|
||||
CreateAxisY.Title.Text = Name;
|
||||
CreateAxisY.Title.AllowDragging = false;
|
||||
CreateAxisY.SetRange(0, 100);
|
||||
CreateAxisY.MajorGrid.Visible = false;
|
||||
//取消滚轮缩放
|
||||
CreateAxisY.ZoomingEnabled = false;
|
||||
ListChartRtSeries.Add(new ChartRtSeries(CreateAxisY, lightningChart1, "室温0"));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取曲线的实时值
|
||||
/// 数据是发布过来
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void GetChartRtEvent(List<ChartRtValue> RtData)
|
||||
{
|
||||
ListChartRtValue = RtData;
|
||||
|
||||
//UpdateLightningChartData();
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
foreach (var item in ListChartRtValue)
|
||||
{
|
||||
var Data = ListChartRtSeries.Find(a => a.Name == item.Name);
|
||||
if (Data != null)
|
||||
{
|
||||
Data.AddValue(item.Value);
|
||||
Data.Value = item.Value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void CurTimer2_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CurTimer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region ListView配置
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 曲线配置
|
||||
|
||||
/// <summary>
|
||||
/// 实时曲线数据集合
|
||||
/// </summary>
|
||||
public List<ChartRtValue> ListChartRtValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 曲线数据系列集合
|
||||
/// </summary>
|
||||
public List<ChartRtSeries> ListChartRtSeries { get; set; } = new List<ChartRtSeries>();
|
||||
|
||||
/// <summary>
|
||||
/// Chart图表X轴的跨度-秒
|
||||
/// </summary>
|
||||
private int ChartXDateTimeRange = 3600;
|
||||
|
||||
/// <summary>
|
||||
/// X轴滚动
|
||||
/// </summary>
|
||||
private bool ScrollEnable = true;
|
||||
|
||||
/// <summary>
|
||||
/// 更新图表信息
|
||||
/// </summary>
|
||||
private void UpdateLightningChartData()
|
||||
{
|
||||
//timeStamp = timeStamp.AddSeconds(-60);
|
||||
foreach (var item in lightningChart1.ViewXY.PointLineSeries)
|
||||
{
|
||||
//Disable updates, to prevent several extra refreshes
|
||||
lightningChart1.BeginUpdate();
|
||||
|
||||
//Array for 1 point
|
||||
SeriesPoint[] points = new SeriesPoint[1];
|
||||
|
||||
//Convert 'Now' to X value
|
||||
var _previousX = lightningChart1.ViewXY.XAxes[0].DateTimeToAxisValue(DateTime.Now);
|
||||
points[0].X = _previousX;
|
||||
points[0].Y = GetChartRtValue(item.Title.Text);
|
||||
//Add the new point into end of first PointLineSeries
|
||||
item.AddPoints(points, false);
|
||||
|
||||
item.DeletePointsBeforeX(_previousX - ChartXDateTimeRange);
|
||||
//item.DeletePointsBeforeX(_previousX - 100);
|
||||
|
||||
if (ScrollEnable)
|
||||
{
|
||||
lightningChart1.ViewXY.XAxes[0].ScrollPosition = _previousX;
|
||||
}
|
||||
|
||||
|
||||
//Allow updates again, and update
|
||||
lightningChart1.EndUpdate();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据名称获取曲线所需的数据
|
||||
/// </summary>
|
||||
private double GetChartRtValue(string Name)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Data = ListChartRtValue.Find(a => a.Name == Name);
|
||||
if (Data != null)
|
||||
{
|
||||
return Data.Value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace.ToString(), ex.Message.ToString()));
|
||||
return 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 曲线个数
|
||||
/// </summary>
|
||||
private int MainRealTimeChartSeriesCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// LightingChart图标的初始化
|
||||
/// </summary>
|
||||
private void LoadLighingChart()
|
||||
{
|
||||
//Disable rendering, strongly recommended before updating chart properties
|
||||
lightningChart1.BeginUpdate();
|
||||
|
||||
//Reduce memory usage and increase performance. Destroys out-scrolled data.
|
||||
lightningChart1.ViewXY.DropOldSeriesData = false;
|
||||
//多个Y曲线摆放形式
|
||||
lightningChart1.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Layered;
|
||||
//网格带
|
||||
lightningChart1.ViewXY.AxisLayout.AxisGridStrips = XYAxisGridStrips.X;
|
||||
//y轴的在左边还是右边
|
||||
lightningChart1.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.AllLeft;
|
||||
|
||||
//lightningChart1.Parent = this.panel1;
|
||||
//lightningChart1.Name = "Temperature measurement _chart";
|
||||
lightningChart1.Title.Text = "实时曲线";
|
||||
|
||||
//lightningChart1.ViewXY.
|
||||
//lightningChart1.Dock = DockStyle.Fill;
|
||||
|
||||
//清除Y轴系列
|
||||
//lightningChart1.ViewXY.YAxes.Clear();
|
||||
var InitAxisY = new AxisY(lightningChart1.ViewXY);
|
||||
InitAxisY.Visible = false;
|
||||
InitAxisY.ZoomingEnabled = false;
|
||||
lightningChart1.ViewXY.YAxes.Add(InitAxisY);
|
||||
|
||||
|
||||
|
||||
//Configure x-axis
|
||||
AxisX xAxis = lightningChart1.ViewXY.XAxes[0];
|
||||
xAxis.ValueType = AxisValueType.DateTime;
|
||||
xAxis.Title.Text = "时间";
|
||||
xAxis.AutoFormatLabels = true;
|
||||
xAxis.LabelsTimeFormat = "MM/dd \n HH:mm.ss";
|
||||
//xAxis.LabelsTimeFormat = "dd/MM/yyyy\nHH:mm.ss";
|
||||
xAxis.LabelsAngle = 45;
|
||||
//xAxis.SteppingInterval = 0.1;
|
||||
//xAxis.ScrollingGap = 15;
|
||||
|
||||
//xAxis.AllowScaling = true;
|
||||
|
||||
xAxis.ScrollMode = XAxisScrollMode.Scrolling;
|
||||
xAxis.ZoomingEnabled = true;
|
||||
|
||||
//Convert DateTime values to axis values
|
||||
DateTime now = DateTime.Now;
|
||||
double minX = xAxis.DateTimeToAxisValue(now);
|
||||
double maxX = xAxis.DateTimeToAxisValue(now.AddMinutes(60));
|
||||
xAxis.SetRange(minX, maxX);
|
||||
|
||||
|
||||
//DateTime now = DateTime.Now;
|
||||
|
||||
//xAxis.SetDateTimeRange(now,now.AddMinutes(60));
|
||||
|
||||
|
||||
|
||||
//光标数据
|
||||
//Add an annotation to show the cursor values
|
||||
//AnnotationXY cursorValueDisplay = new AnnotationXY();
|
||||
AnnotationXY cursorValueDisplay = new AnnotationXY(lightningChart1.ViewXY, lightningChart1.ViewXY.XAxes[0], lightningChart1.ViewXY.YAxes[0]);
|
||||
cursorValueDisplay.Style = AnnotationStyle.RoundedCallout;
|
||||
cursorValueDisplay.LocationCoordinateSystem = CoordinateSystem.RelativeCoordinatesToTarget;
|
||||
cursorValueDisplay.LocationRelativeOffset.X = 130;
|
||||
cursorValueDisplay.LocationRelativeOffset.Y = -100;
|
||||
cursorValueDisplay.Sizing = AnnotationXYSizing.Automatic;
|
||||
//cursorValueDisplay.TextStyle.Font = new WpfFont("Lucida console", 10f, FontStyle.Regular);
|
||||
cursorValueDisplay.TextStyle.Color = System.Windows.Media.Color.FromRgb(0, 0, 0);
|
||||
cursorValueDisplay.Text = "";
|
||||
cursorValueDisplay.Fill.Color = System.Windows.Media.Color.FromRgb(255, 255, 255);
|
||||
cursorValueDisplay.Fill.GradientColor = System.Windows.Media.Color.FromRgb(120, 120, 120);
|
||||
cursorValueDisplay.BorderVisible = false;
|
||||
cursorValueDisplay.AllowTargetMove = false;
|
||||
cursorValueDisplay.Visible = false;
|
||||
lightningChart1.ViewXY.Annotations.Add(cursorValueDisplay);
|
||||
|
||||
//Add cursor
|
||||
LineSeriesCursor cursor = new LineSeriesCursor(lightningChart1.ViewXY, lightningChart1.ViewXY.XAxes[0]);
|
||||
lightningChart1.ViewXY.LineSeriesCursors.Add(cursor);
|
||||
cursor.PositionChanged += cursor_PositionChanged;
|
||||
cursor.ValueAtXAxis = lightningChart1.ViewXY.XAxes[0].DateTimeToAxisValue(DateTime.Now.AddMinutes(30));
|
||||
cursor.LineStyle.Color = System.Windows.Media.Color.FromRgb(200, 200, 200);
|
||||
cursor.SnapToPoints = false;
|
||||
cursor.TrackPoint.Color1 = System.Windows.Media.Color.FromRgb(255, 255, 255);
|
||||
cursor.Style = CursorStyle.PointTracking;
|
||||
|
||||
|
||||
|
||||
lightningChart1.Loaded += LightningChart1_Loaded;
|
||||
lightningChart1.SizeChanged += LightningChart1_SizeChanged;
|
||||
//lightningChart1.Resize += new EventHandler(_chart_Resize);
|
||||
|
||||
////清除Y轴系列
|
||||
//lightningChart1.ViewXY.YAxes.Clear();
|
||||
|
||||
//Don't show legendbox
|
||||
lightningChart1.ViewXY.LegendBoxes[0].Visible = true;
|
||||
lightningChart1.ViewXY.LegendBoxes[0].Position = LegendBoxPositionXY.TopCenter;
|
||||
//Allow chart rendering
|
||||
lightningChart1.EndUpdate();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void LightningChart1_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
|
||||
{
|
||||
UpdateCursorResult();
|
||||
}
|
||||
|
||||
private void LightningChart1_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
UpdateCursorResult();
|
||||
}
|
||||
|
||||
private void cursor_PositionChanged(object sender, PositionChangedEventArgs e)
|
||||
{
|
||||
e.CancelRendering = true;
|
||||
|
||||
UpdateCursorResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update cursor texts.
|
||||
/// </summary>
|
||||
private void UpdateCursorResult()
|
||||
{
|
||||
bool showNextToCursor = true;
|
||||
|
||||
//Disable rendering, strongly recommended before updating chart properties
|
||||
lightningChart1.BeginUpdate();
|
||||
|
||||
//Get cursor
|
||||
LineSeriesCursor cursor = lightningChart1.ViewXY.LineSeriesCursors[0];
|
||||
|
||||
//Get annotation
|
||||
AnnotationXY cursorValueDisplay = lightningChart1.ViewXY.Annotations[0];
|
||||
|
||||
//Set annotation target. The location is relative to target.
|
||||
//Use graph bottom as target Y value.
|
||||
float targetYCoord = (float)lightningChart1.ViewXY.GetMarginsRect().Bottom;
|
||||
double y;
|
||||
lightningChart1.ViewXY.YAxes[0].CoordToValue(targetYCoord, out y);
|
||||
cursorValueDisplay.TargetAxisValues.X = cursor.ValueAtXAxis;
|
||||
cursorValueDisplay.TargetAxisValues.Y = y;
|
||||
|
||||
double seriesYValue = 0;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int seriesIndex = 1;
|
||||
|
||||
string channelStringFormat = "{0}: {1}";
|
||||
bool labelVisible = false;
|
||||
bool accurateValue = false;
|
||||
string value = "";
|
||||
|
||||
foreach (PointLineSeries pointLineSeries in lightningChart1.ViewXY.PointLineSeries)
|
||||
{
|
||||
//show series titles and cursor values in them, on the right side of the chart,
|
||||
//if cursor values are not shown next to the cursor in an annotation
|
||||
pointLineSeries.Title.Visible = !showNextToCursor;
|
||||
bool resolved = false;
|
||||
value = "";
|
||||
|
||||
if (accurateValue)
|
||||
resolved = SolveValueAccurate(pointLineSeries, cursor.ValueAtXAxis, out seriesYValue);
|
||||
else
|
||||
resolved = SolveValueCoarse(pointLineSeries, cursor.ValueAtXAxis, out seriesYValue);
|
||||
|
||||
AxisY axisY = lightningChart1.ViewXY.YAxes[pointLineSeries.AssignYAxisIndex];
|
||||
|
||||
if (resolved)
|
||||
{
|
||||
labelVisible = true;
|
||||
//value = string.Format(channelStringFormat, seriesIndex, seriesYValue.ToString("0.000"), axisY.Units.Text);
|
||||
value = string.Format(channelStringFormat, pointLineSeries.Title.Text, seriesYValue.ToString("0.000"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//value = string.Format(channelStringFormat, seriesIndex, "---", axisY.Units.Text);
|
||||
value = string.Format(channelStringFormat, pointLineSeries.Title.Text, "---");
|
||||
}
|
||||
sb.AppendLine(value);
|
||||
//这个会改变曲线标题的名称,影响曲线的定位、删除等操作
|
||||
//pointLineSeries.Title.Text = value;
|
||||
seriesIndex++;
|
||||
}
|
||||
|
||||
//sb.AppendLine("");
|
||||
//sb.AppendLine("时间: " + lightningChart1.ViewXY.XAxes[0].TimeString(cursor.ValueAtXAxis, "HH:mm:ss.ffff"));
|
||||
|
||||
////Set text
|
||||
cursorValueDisplay.Text = sb.ToString();
|
||||
|
||||
////Show the label only if it selected to be shown
|
||||
cursorValueDisplay.Visible = labelVisible && showNextToCursor;
|
||||
|
||||
//Allow chart rendering
|
||||
lightningChart1.EndUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solve value from series data points array. Accurate method, but slower than SolveValueCoarse
|
||||
/// </summary>
|
||||
/// <param name="series">Series</param>
|
||||
/// <param name="xValue">X value</param>
|
||||
/// <param name="yValue">Output Y value</param>
|
||||
/// <returns>Success status</returns>
|
||||
private bool SolveValueAccurate(PointLineSeries series, double xValue, out double yValue)
|
||||
{
|
||||
AxisY axisY = lightningChart1.ViewXY.YAxes[series.AssignYAxisIndex];
|
||||
yValue = 0;
|
||||
|
||||
LineSeriesValueSolveResult result = series.SolveYValueAtXValue(xValue);
|
||||
if (result.SolveStatus == LineSeriesSolveStatus.OK)
|
||||
{
|
||||
//PointLineSeries may have two or more points at same X value. If so, center it between min and max
|
||||
yValue = (result.YMax + result.YMin) / 2.0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Solve value from screen coordinates. Faster method, but not less accurateValue than SolveValueAccurate
|
||||
/// </summary>
|
||||
/// <param name="series">Series</param>
|
||||
/// <param name="xValue">X value</param>
|
||||
/// <param name="yValue">Output Y value</param>
|
||||
/// <returns>Success status</returns>
|
||||
private bool SolveValueCoarse(PointLineSeries series, double xValue, out double yValue)
|
||||
{
|
||||
AxisY axisY = lightningChart1.ViewXY.YAxes[series.AssignYAxisIndex];
|
||||
float coordX = lightningChart1.ViewXY.XAxes[0].ValueToCoord(xValue);
|
||||
float coordY;
|
||||
yValue = 0;
|
||||
|
||||
LineSeriesCoordinateSolveResult result = series.SolveYCoordAtXCoord(coordX);
|
||||
if (result.SolveStatus == LineSeriesSolveStatus.OK)
|
||||
{
|
||||
coordY = (result.CoordBottom + result.CoordTop) / 2f;
|
||||
if (axisY.CoordToValue((int)Math.Round(coordY), out yValue) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 增加Y轴
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <param name="MaxVal"></param>
|
||||
/// <param name="MinVal"></param>
|
||||
private void AddYAxis(string Name, double MinVal, double MaxVal)
|
||||
{
|
||||
lightningChart1.BeginUpdate();
|
||||
|
||||
var CreateAxisY = new AxisY();
|
||||
CreateAxisY.Title.Text = Name;
|
||||
CreateAxisY.Title.AllowDragging = false;
|
||||
CreateAxisY.SetRange(MinVal, MaxVal);
|
||||
CreateAxisY.MajorGrid.Visible = false;
|
||||
//取消滚轮缩放
|
||||
CreateAxisY.ZoomingEnabled = false;
|
||||
lightningChart1.ViewXY.YAxes.Add(CreateAxisY);
|
||||
|
||||
//Configure and add series to the chart
|
||||
PointLineSeries CreateSeries = new PointLineSeries(lightningChart1.ViewXY, lightningChart1.ViewXY.XAxes[0], CreateAxisY);
|
||||
CreateSeries.Title.Text = Name;
|
||||
CreateSeries.LineStyle.Color = ChartConfigInfo.ListColor[lightningChart1.ViewXY.YAxes.Count + 1];
|
||||
CreateSeries.AllowUserInteraction = false;
|
||||
lightningChart1.ViewXY.PointLineSeries.Add(CreateSeries);
|
||||
|
||||
lightningChart1.EndUpdate();
|
||||
MainRealTimeChartSeriesCount++;
|
||||
}
|
||||
|
||||
private void DeleteYAxis(string Name)
|
||||
{
|
||||
lightningChart1.BeginUpdate();
|
||||
|
||||
for (int i = 0; i < lightningChart1.ViewXY.YAxes.Count; i++)
|
||||
{
|
||||
if (lightningChart1.ViewXY.YAxes[i].Title.Text == Name)
|
||||
{
|
||||
lightningChart1.ViewXY.YAxes.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < lightningChart1.ViewXY.PointLineSeries.Count; i++)
|
||||
{
|
||||
if (lightningChart1.ViewXY.PointLineSeries[i].Title.Text == Name)
|
||||
{
|
||||
lightningChart1.ViewXY.PointLineSeries.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lightningChart1.EndUpdate();
|
||||
if (MainRealTimeChartSeriesCount <= 0)
|
||||
{
|
||||
MainRealTimeChartSeriesCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainRealTimeChartSeriesCount--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
48
CapMachine.sln
Normal file
48
CapMachine.sln
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34622.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CapMachine.Wpf", "CapMachine.Wpf\CapMachine.Wpf.csproj", "{74FE017A-0DA4-4644-9363-DAA025378F2B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CapMachine.Model", "CapMachine.Model\CapMachine.Model.csproj", "{AB5B5040-6B8A-4E7F-86BC-4286967AC4D9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CapMachine.Shared", "CapMachine.Shared\CapMachine.Shared.csproj", "{3BE4B27A-E02B-4517-A7DE-7BEEB85BEF79}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CapMachine.Core", "CapMachine.Core\CapMachine.Core.csproj", "{51B7AE04-F40C-4843-88D7-3794E18F2573}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B8BCF01C-3B68-4F5C-93F4-7BA58B02ED51}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{74FE017A-0DA4-4644-9363-DAA025378F2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74FE017A-0DA4-4644-9363-DAA025378F2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74FE017A-0DA4-4644-9363-DAA025378F2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{74FE017A-0DA4-4644-9363-DAA025378F2B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB5B5040-6B8A-4E7F-86BC-4286967AC4D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB5B5040-6B8A-4E7F-86BC-4286967AC4D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB5B5040-6B8A-4E7F-86BC-4286967AC4D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB5B5040-6B8A-4E7F-86BC-4286967AC4D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3BE4B27A-E02B-4517-A7DE-7BEEB85BEF79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3BE4B27A-E02B-4517-A7DE-7BEEB85BEF79}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3BE4B27A-E02B-4517-A7DE-7BEEB85BEF79}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3BE4B27A-E02B-4517-A7DE-7BEEB85BEF79}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51B7AE04-F40C-4843-88D7-3794E18F2573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51B7AE04-F40C-4843-88D7-3794E18F2573}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51B7AE04-F40C-4843-88D7-3794E18F2573}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{51B7AE04-F40C-4843-88D7-3794E18F2573}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BD82B67A-6645-4724-B226-9E13892C0933}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user