提交了仪表的模型
This commit is contained in:
20
CapMachine.Wpf/Services/ConfigService.cs
Normal file
20
CapMachine.Wpf/Services/ConfigService.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置服务中心
|
||||
/// </summary>
|
||||
public class ConfigService:BindableBase
|
||||
{
|
||||
public ConfigService()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
20
CapMachine.Wpf/Services/ILogService.cs
Normal file
20
CapMachine.Wpf/Services/ILogService.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// NLog服务
|
||||
/// </summary>
|
||||
public interface ILogService
|
||||
{
|
||||
void Debug(string msg);
|
||||
void Error(string msg);
|
||||
void Fatal(string msg);
|
||||
void Info(string msg);
|
||||
void Warn(string msg);
|
||||
}
|
||||
}
|
||||
83
CapMachine.Wpf/Services/LogService.cs
Normal file
83
CapMachine.Wpf/Services/LogService.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using NLog;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// NLog 服务
|
||||
/// </summary>
|
||||
public class LogService : ILogService
|
||||
{
|
||||
private static Logger logger = LogManager.GetCurrentClassLogger(); //初始化日志类
|
||||
|
||||
/// <summary>
|
||||
/// 调试日志
|
||||
/// </summary>
|
||||
/// <param name="msg">日志内容</param>
|
||||
public void Debug(string msg)
|
||||
{
|
||||
logger.Debug(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 信息日志
|
||||
/// </summary>
|
||||
/// <param name="msg">日志内容</param>
|
||||
/// <remarks>
|
||||
/// 适用大部分场景
|
||||
/// 1.记录日志文件
|
||||
/// </remarks>
|
||||
public void Info(string msg)
|
||||
{
|
||||
logger.Info(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 错误日志
|
||||
/// </summary>
|
||||
/// <param name="msg">日志内容</param>
|
||||
/// <remarks>
|
||||
/// 适用异常,错误日志记录
|
||||
/// 1.记录日志文件
|
||||
/// </remarks>
|
||||
public void Error(string msg)
|
||||
{
|
||||
logger.Error(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 严重致命错误日志
|
||||
/// </summary>
|
||||
/// <param name="msg">日志内容</param>
|
||||
/// <remarks>
|
||||
/// 1.记录日志文件
|
||||
/// 2.控制台输出
|
||||
/// </remarks>
|
||||
public void Fatal(string msg)
|
||||
{
|
||||
logger.Fatal(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 警告日志
|
||||
/// </summary>
|
||||
/// <param name="msg">日志内容</param>
|
||||
/// <remarks>
|
||||
/// 1.记录日志文件
|
||||
/// 2.发送日志邮件
|
||||
/// </remarks>
|
||||
public void Warn(string msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.Warn(msg);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,38 +26,36 @@ namespace CapMachine.Wpf.Services
|
||||
public void Initialize()
|
||||
{
|
||||
MenuItems.Clear();
|
||||
MenuItems.Add(new NavigationItem("", "全部", "", new ObservableCollection<NavigationItem>()
|
||||
MenuItems.Add(new NavigationItem("", "系统", "", new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("","模板匹配","",new ObservableCollection<NavigationItem>()
|
||||
new NavigationItem("","系统配置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("ShapeCirclePlus","轮廓匹配",""),
|
||||
new NavigationItem("ShapeOutline","形状匹配",""),
|
||||
new NavigationItem("Clouds", "相似性匹配",""),
|
||||
new NavigationItem("ShapeOvalPlus","形变匹配",""),
|
||||
new NavigationItem("ShapeCirclePlus","日志文件",""),
|
||||
new NavigationItem("ShapeOutline","工况预设",""),
|
||||
new NavigationItem("Clouds", "高速记录",""),
|
||||
new NavigationItem("ShapeOvalPlus","系统配置",""),
|
||||
}),
|
||||
new NavigationItem("", "比较测量","",new ObservableCollection<NavigationItem>()
|
||||
new NavigationItem("", "计算信息","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Circle","卡尺找圆",""),
|
||||
new NavigationItem("Palette","颜色检测",""),
|
||||
new NavigationItem("Ruler", "几何测量",""),
|
||||
new NavigationItem("Circle","过热度",""),
|
||||
new NavigationItem("Palette","过冷度",""),
|
||||
}),
|
||||
new NavigationItem("","字符识别","",new ObservableCollection<NavigationItem>()
|
||||
new NavigationItem("", "PID设置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("FormatColorText", "字符识别",""),
|
||||
new NavigationItem("Barcode", "一维码识别",""),
|
||||
new NavigationItem("Qrcode", "二维码识别",""),
|
||||
new NavigationItem("Circle","转速PID",""),
|
||||
}),
|
||||
new NavigationItem("","缺陷检测","",new ObservableCollection<NavigationItem>()
|
||||
new NavigationItem("","版本信息","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Crop", "差分模型",""),
|
||||
new NavigationItem("CropRotate", "形变模型",""),
|
||||
})
|
||||
new NavigationItem("FormatColorText", "操作手册",""),
|
||||
new NavigationItem("Barcode", "版本更新信息",""),
|
||||
}),
|
||||
|
||||
}));
|
||||
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"));
|
||||
MenuItems.Add(new NavigationItem("", "用户管理", "UserManageView"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
49
CapMachine.Wpf/Services/SysService.cs
Normal file
49
CapMachine.Wpf/Services/SysService.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统资源
|
||||
/// </summary>
|
||||
public class SysService : BindableBase
|
||||
{
|
||||
public SysService()
|
||||
{
|
||||
// 创建一个定时器,设置间隔时间为2000毫秒(即2秒)
|
||||
CurTimer = new System.Timers.Timer(5000);
|
||||
CurTimer.AutoReset = true;
|
||||
// 设置Elapsed事件处理程序
|
||||
CurTimer.Elapsed += CurTimer_Elapsed;
|
||||
// 启动定时器
|
||||
CurTimer.Start();
|
||||
|
||||
}
|
||||
|
||||
private void CurTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
CurDateTime=DateTime.Now;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时器
|
||||
/// </summary>
|
||||
private System.Timers.Timer CurTimer { get; set; }
|
||||
|
||||
private DateTime _CurDateTime;
|
||||
/// <summary>
|
||||
/// 当前时间信息
|
||||
/// </summary>
|
||||
public DateTime CurDateTime
|
||||
{
|
||||
get { return _CurDateTime; }
|
||||
set { _CurDateTime = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user